feat: DSL 磁力聚合 — 搜索/解析/预览/投递 + cilisousuo 源 + 中英双语 + Docker 部署

This commit is contained in:
ice-a
2026-10-16 18:53:45 +08:00
commit d6999104bf
64 changed files with 16524 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { normalizeClient, type BtClientConfig } from '../../utils/appconfig'
import { endpointOf, friendlyClientError, getAdapter } from '../../utils/clients'
/** 保存前先试连一次,确认地址 / 账号可用 */
export default defineEventHandler(async (event) => {
const body = await readBody(event).catch(() => ({}))
const cfg: BtClientConfig = normalizeClient((body?.client || body) as Partial<BtClientConfig>)
const adapter = getAdapter(cfg.type)
if (!adapter) throw createError({ statusCode: 400, statusMessage: `不支持的客户端类型:${cfg.type}` })
try {
const result = await adapter.probe(cfg)
return { ok: true, online: result.online, version: result.version || null, endpoint: endpointOf(cfg) }
} catch (err) {
return {
ok: false,
online: false,
endpoint: endpointOf(cfg),
error: friendlyClientError(err)
}
}
})