feat(publish): add bilibili and qiehao desktop adapters
Wire bilibili and qiehao (om.qq.com) into the publish adapter registry and auth-failure classifier. Bilibili bind uses WBI-signed space-info fallback to retrieve the avatar when nav lacks a face URL, and the account list image renders with a no-referrer policy so bilibili CDN serves the avatar cross-origin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,31 @@ function classifyBaijiahaoFailure(input: PlatformFailureInput): PlatformFailureC
|
||||
return classifyFailure(input);
|
||||
}
|
||||
|
||||
function classifyQiehaoFailure(input: PlatformFailureInput): PlatformFailureClassification {
|
||||
const code = typeof input.error?.code === "string" ? input.error.code : "";
|
||||
if (code === "qiehao_challenge_required") {
|
||||
return "challenge";
|
||||
}
|
||||
if (code === "qiehao_not_logged_in" || code === "qiehao_cookie_missing") {
|
||||
return "auth_failure";
|
||||
}
|
||||
if (code.startsWith("qiehao_")) {
|
||||
return "ok";
|
||||
}
|
||||
return classifyFailure(input);
|
||||
}
|
||||
|
||||
function classifyBilibiliFailure(input: PlatformFailureInput): PlatformFailureClassification {
|
||||
const code = typeof input.error?.code === "string" ? input.error.code : "";
|
||||
if (code === "bilibili_not_logged_in" || code === "bilibili_csrf_missing") {
|
||||
return "auth_failure";
|
||||
}
|
||||
if (code.startsWith("bilibili_")) {
|
||||
return "ok";
|
||||
}
|
||||
return classifyFailure(input);
|
||||
}
|
||||
|
||||
const genericAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition);
|
||||
@@ -155,6 +180,26 @@ const baijiahaoAdapter: PlatformAdapter = {
|
||||
classifyFailure: classifyBaijiahaoFailure,
|
||||
};
|
||||
|
||||
const qiehaoAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition);
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshPublishAccountSession(account, partition);
|
||||
},
|
||||
classifyFailure: classifyQiehaoFailure,
|
||||
};
|
||||
|
||||
const bilibiliAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition);
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshPublishAccountSession(account, partition);
|
||||
},
|
||||
classifyFailure: classifyBilibiliFailure,
|
||||
};
|
||||
|
||||
const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
[
|
||||
...aiPlatformCatalog.map((platform) => platform.id),
|
||||
@@ -179,7 +224,11 @@ const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
? wenxinAdapter
|
||||
: platform === "baijiahao"
|
||||
? baijiahaoAdapter
|
||||
: genericAdapter,
|
||||
: platform === "qiehao"
|
||||
? qiehaoAdapter
|
||||
: platform === "bilibili"
|
||||
? bilibiliAdapter
|
||||
: genericAdapter,
|
||||
]),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user