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

@@ -0,0 +1,31 @@
import type { Kysely } from "kysely";
import { execDdl, oneOf } from "../src/migration-helpers.ts";
// 字幕站(docs/plan/subtitles.md 第 2 步):站点类型 subtitle、适配器 subtitle(SubHD、字幕库),
// 复用站点的代理 / 限流 / 健康 / 浏览器会话;不参与资源搜索、快照、RSS。
const KINDS = ["pt", "public_bt", "rss_feed", "torznab", "subtitle"];
const ADAPTERS = ["nexusphp", "mteam_api", "api", "generic_rss", "subtitle"];
const OLD_KINDS = ["pt", "public_bt", "rss_feed", "torznab"];
const OLD_ADAPTERS = ["nexusphp", "mteam_api", "api", "generic_rss"];
// biome-ignore lint/suspicious/noExplicitAny: 迁移不依赖应用表类型
export async function up(db: Kysely<any>): Promise<void> {
await execDdl(
db,
`alter table site drop constraint if exists site_kind_check;
alter table site add constraint site_kind_check ${oneOf("kind", KINDS)};
alter table site drop constraint if exists site_adapter_check;
alter table site add constraint site_adapter_check ${oneOf("adapter", ADAPTERS)};`,
);
}
// biome-ignore lint/suspicious/noExplicitAny: 同上
export async function down(db: Kysely<any>): Promise<void> {
await execDdl(
db,
`delete from site where kind = 'subtitle';
alter table site drop constraint if exists site_kind_check;
alter table site add constraint site_kind_check ${oneOf("kind", OLD_KINDS)};
alter table site drop constraint if exists site_adapter_check;
alter table site add constraint site_adapter_check ${oneOf("adapter", OLD_ADAPTERS)};`,
);
}
+2 -2
View File
@@ -241,10 +241,10 @@ export type SecretPurpose =
| "other";
export type ServerMappingItemType = "movie" | "series" | "season" | "episode" | "other";
export type ServerMappingMatchStatus = "matched" | "ambiguous" | "unmatched" | "stale";
export type SiteAdapter = "nexusphp" | "mteam_api" | "api" | "generic_rss";
export type SiteAdapter = "nexusphp" | "mteam_api" | "api" | "generic_rss" | "subtitle";
export type SiteHealthStatus = "unknown" | "healthy" | "degraded" | "failing" | "disabled";
export type SiteCircuitState = "closed" | "open" | "half_open";
export type SiteKind = "pt" | "public_bt" | "rss_feed" | "torznab";
export type SiteKind = "pt" | "public_bt" | "rss_feed" | "torznab" | "subtitle";
export type SiteAccountAuthKind = "cookie" | "passkey" | "api_key" | "password";
export type SiteAccountStatus = "unknown" | "active" | "invalid" | "expired" | "challenge";
export type SiteSnapshotKind = "periodic" | "backfill" | "live_search" | "manual";