feat: add music source service — NetEase/QQ providers, unified interface, cookie auth

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.6 committed 2026-03-30 00:39:47 +08:00
1 parent 17d2decc91
commit 94902fc2c4
8 files changed
+2081 -3

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import fs from "node:fs";
import path from "node:path";
export interface CookieStore {
save(platform: "netease" | "qq", cookie: string): void;
load(platform: "netease" | "qq"): string;
}
export function createCookieStore(cookieDir: string): CookieStore {
if (!fs.existsSync(cookieDir)) {
fs.mkdirSync(cookieDir, { recursive: true });
}
return {
save(platform: "netease" | "qq", cookie: string): void {
const filePath = path.join(cookieDir, `${platform}.json`);
fs.writeFileSync(
filePath,
JSON.stringify({ cookie, updatedAt: new Date().toISOString() }),
"utf-8"
);
},
load(platform: "netease" | "qq"): string {
const filePath = path.join(cookieDir, `${platform}.json`);
if (!fs.existsSync(filePath)) return "";
try {
const data = JSON.parse(fs.readFileSync(filePath, "utf-8"));
return data.cookie ?? "";
} catch {
return "";
}
},
};
}