feat(publish): add seven publish adapters for new media platforms
Wire sohuhao, wangyihao, juejin, smzdm, weixin-gzh, zol, and dongchedi into the publish runtime: each ships its own publish protocol and auth-failure classifier (login/token/challenge codes) plus registry entries in selectPublishAdapter and the auth adapter map. Smzdm bind detection now triple-falls-back across page-context fetch, session fetch, cookie fetch, and a final cookie-derived account so the nickname-less guest profile still resolves to a stable platform UID. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,4 +45,76 @@ describe("platform auth adapters", () => {
|
||||
}),
|
||||
).toBe("auth_failure");
|
||||
});
|
||||
|
||||
it("classifies Juejin missing login as auth failure", () => {
|
||||
const adapter = getPlatformAdapter("juejin");
|
||||
|
||||
expect(
|
||||
adapter.classifyFailure({
|
||||
error: {
|
||||
code: "juejin_not_logged_in",
|
||||
},
|
||||
}),
|
||||
).toBe("auth_failure");
|
||||
});
|
||||
|
||||
it("classifies Sohuhao missing login as auth failure", () => {
|
||||
const adapter = getPlatformAdapter("sohuhao");
|
||||
|
||||
expect(
|
||||
adapter.classifyFailure({
|
||||
error: {
|
||||
code: "sohuhao_not_logged_in",
|
||||
},
|
||||
}),
|
||||
).toBe("auth_failure");
|
||||
});
|
||||
|
||||
it("classifies Wangyihao missing token as auth failure", () => {
|
||||
const adapter = getPlatformAdapter("wangyihao");
|
||||
|
||||
expect(
|
||||
adapter.classifyFailure({
|
||||
error: {
|
||||
code: "wangyihao_token_missing",
|
||||
},
|
||||
}),
|
||||
).toBe("auth_failure");
|
||||
});
|
||||
|
||||
it("classifies Weixin GZH verification as challenge", () => {
|
||||
const adapter = getPlatformAdapter("weixin_gzh");
|
||||
|
||||
expect(
|
||||
adapter.classifyFailure({
|
||||
error: {
|
||||
code: "weixin_gzh_challenge_required",
|
||||
},
|
||||
}),
|
||||
).toBe("challenge");
|
||||
});
|
||||
|
||||
it("classifies ZOL missing login as auth failure", () => {
|
||||
const adapter = getPlatformAdapter("zol");
|
||||
|
||||
expect(
|
||||
adapter.classifyFailure({
|
||||
error: {
|
||||
code: "zol_not_logged_in",
|
||||
},
|
||||
}),
|
||||
).toBe("auth_failure");
|
||||
});
|
||||
|
||||
it("classifies Dongchedi platform verification as challenge", () => {
|
||||
const adapter = getPlatformAdapter("dongchedi");
|
||||
|
||||
expect(
|
||||
adapter.classifyFailure({
|
||||
error: {
|
||||
code: "dongchedi_challenge_required",
|
||||
},
|
||||
}),
|
||||
).toBe("challenge");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user