feat(publish): add baijiahao and jianshu desktop adapters
Wires up Baijiahao (百家号) and Jianshu (简书) as first-class desktop publish targets, with risk-control prompts surfaced in the runtime controller and a normalized error message in publish records. Adds external-link buttons in the publish management table, an asset format conversion endpoint for cover image compatibility, and reorders publish-status display priority so failures take precedence over partial successes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,20 @@ function classifyWenxinFailure(input: PlatformFailureInput): PlatformFailureClas
|
||||
return classifyFailure(input);
|
||||
}
|
||||
|
||||
function classifyBaijiahaoFailure(input: PlatformFailureInput): PlatformFailureClassification {
|
||||
const code = typeof input.error?.code === "string" ? input.error.code : "";
|
||||
if (code === "baijiahao_challenge_required") {
|
||||
return "challenge";
|
||||
}
|
||||
if (code === "baijiahao_not_logged_in" || code === "baijiahao_token_missing") {
|
||||
return "auth_failure";
|
||||
}
|
||||
if (code.startsWith("baijiahao_")) {
|
||||
return "ok";
|
||||
}
|
||||
return classifyFailure(input);
|
||||
}
|
||||
|
||||
const genericAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition);
|
||||
@@ -131,6 +145,16 @@ const wenxinAdapter: PlatformAdapter = {
|
||||
classifyFailure: classifyWenxinFailure,
|
||||
};
|
||||
|
||||
const baijiahaoAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition);
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshPublishAccountSession(account, partition);
|
||||
},
|
||||
classifyFailure: classifyBaijiahaoFailure,
|
||||
};
|
||||
|
||||
const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
[
|
||||
...aiPlatformCatalog.map((platform) => platform.id),
|
||||
@@ -153,6 +177,8 @@ const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
? doubaoAdapter
|
||||
: platform === "wenxin"
|
||||
? wenxinAdapter
|
||||
: platform === "baijiahao"
|
||||
? baijiahaoAdapter
|
||||
: genericAdapter,
|
||||
]),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user