feat(subtitles): 字幕站(SubHD、字幕库)在线搜索与下载;rar / 7z 解压;验证码与页面解析在沙箱里

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-10-03 02:28:29 +08:00
1 parent 92d456d123
commit 59b3680f35
32 files changed
+1704 -166

No files matched your search

@@ -129,7 +129,15 @@ describe.skipIf(!up)("站点类型:API、调度与 RSS", () => {
.map((d) => d.key)
.sort(),
).toEqual([...pub].sort());
expect(items.filter((d) => !pub.includes(d.key)).every((d) => d.kind === "pt")).toBe(true);
// 内置字幕站(SubHD、字幕库)也在定义列表里,类型 subtitle
const subs = ["subhd", "zimuku"];
expect(
items
.filter((d) => d.kind === "subtitle")
.map((d) => d.key)
.sort(),
).toEqual(subs);
expect(items.filter((d) => !pub.includes(d.key) && !subs.includes(d.key)).every((d) => d.kind === "pt")).toBe(true);
const nyaa = await json(
await h.req("/sites", { body: { key: "nyaa", name: "Nyaa", adapter: "api", baseUrl: "https://nyaa.si/" } }),
);
@@ -203,4 +211,23 @@ describe.skipIf(!up)("站点类型:API、调度与 RSS", () => {
reason: "unsupported",
});
});
it("字幕站:只能从内置字幕站添加;不排快照、不进搜索、能力为空", async () => {
const ok = await json(
await h.req("/sites", {
body: { kind: "subtitle", key: "zimuku", name: "字幕库", adapter: "subtitle", baseUrl: "https://zmk.pw/" },
}),
);
expect(ok.status).toBe(200);
expect(ok.body.data).toMatchObject({
kind: "subtitle",
snapshotEnabled: false,
searchDefault: false,
capabilities: [],
});
const bad = await h.req("/sites", {
body: { kind: "subtitle", key: "random", name: "x", adapter: "subtitle", baseUrl: "https://x.example/" },
});
expect(bad.status).toBe(400);
});
});