fix(publish/sohuhao): align manage URL with v4 console and emit article URL
The v3 manage URL has been retired and now redirects through a login gate, breaking the post-publish "管理" deeplink and login detection. Switch the binding console URL and the adapter SOHU_MANAGE_URL to the v4 contentManagement endpoints, and synthesize external_article_url for publish (not draft) results from the article id and account uid so the publish list can offer a "查看文章" link without an extra fetch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2839,7 +2839,7 @@ const publishBindingDefinitions: Record<string, PublishPlatformBindingDefinition
|
|||||||
id: "sohuhao",
|
id: "sohuhao",
|
||||||
label: "搜狐号",
|
label: "搜狐号",
|
||||||
loginUrl: "https://mp.sohu.com/mpfe/v4/login",
|
loginUrl: "https://mp.sohu.com/mpfe/v4/login",
|
||||||
consoleUrl: "https://mp.sohu.com/mpfe/v4/news/create",
|
consoleUrl: "https://mp.sohu.com/mpfe/v4/contentManagement/news/addarticle",
|
||||||
detect: detectSohu,
|
detect: detectSohu,
|
||||||
},
|
},
|
||||||
qiehao: {
|
qiehao: {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ type SohuAccount = {
|
|||||||
type SohuPublishType = "publish" | "draft";
|
type SohuPublishType = "publish" | "draft";
|
||||||
|
|
||||||
const SOHU_ORIGIN = "https://mp.sohu.com";
|
const SOHU_ORIGIN = "https://mp.sohu.com";
|
||||||
const SOHU_MANAGE_URL = `${SOHU_ORIGIN}/mpfe/v3/main/first/page?newsType=1`;
|
const SOHU_MANAGE_URL = `${SOHU_ORIGIN}/mpfe/v4/contentManagement/first/page?newsType=1`;
|
||||||
const SOHU_PUBLISH_URL = `${SOHU_ORIGIN}/mpbp/bp/news/v4/news/publish/v2`;
|
const SOHU_PUBLISH_URL = `${SOHU_ORIGIN}/mpbp/bp/news/v4/news/publish/v2`;
|
||||||
const SOHU_DRAFT_URL = `${SOHU_ORIGIN}/mpbp/bp/news/v4/news/draft/v2`;
|
const SOHU_DRAFT_URL = `${SOHU_ORIGIN}/mpbp/bp/news/v4/news/draft/v2`;
|
||||||
|
|
||||||
@@ -249,17 +249,22 @@ async function submitArticle(
|
|||||||
|
|
||||||
function buildResultPayload(
|
function buildResultPayload(
|
||||||
articleId: string,
|
articleId: string,
|
||||||
|
accountId: string,
|
||||||
mediaName: string,
|
mediaName: string,
|
||||||
publishType: SohuPublishType,
|
publishType: SohuPublishType,
|
||||||
): Record<string, JsonValue> {
|
): Record<string, JsonValue> {
|
||||||
const editUrl =
|
const editUrl =
|
||||||
`${SOHU_ORIGIN}/mpfe/v4/contentManagement/news/addarticle?spm=smmp.articlelist.0.0&contentStatus=2&id=${encodeURIComponent(articleId)}`;
|
`${SOHU_ORIGIN}/mpfe/v4/contentManagement/news/addarticle?spm=smmp.articlelist.0.0&contentStatus=2&id=${encodeURIComponent(articleId)}`;
|
||||||
|
const articleUrl =
|
||||||
|
publishType === "publish"
|
||||||
|
? `https://www.sohu.com/a/${encodeURIComponent(articleId)}_${encodeURIComponent(accountId)}`
|
||||||
|
: null;
|
||||||
return {
|
return {
|
||||||
platform: "sohuhao",
|
platform: "sohuhao",
|
||||||
media_name: mediaName,
|
media_name: mediaName,
|
||||||
external_article_id: articleId,
|
external_article_id: articleId,
|
||||||
external_manage_url: editUrl || SOHU_MANAGE_URL,
|
external_manage_url: editUrl || SOHU_MANAGE_URL,
|
||||||
external_article_url: null,
|
external_article_url: articleUrl,
|
||||||
publish_type: publishType,
|
publish_type: publishType,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -353,7 +358,7 @@ export const sohuhaoAdapter: PublishAdapter = {
|
|||||||
return {
|
return {
|
||||||
status: "succeeded",
|
status: "succeeded",
|
||||||
summary: publishType === "draft" ? "搜狐号草稿保存成功。" : "搜狐号发布成功。",
|
summary: publishType === "draft" ? "搜狐号草稿保存成功。" : "搜狐号发布成功。",
|
||||||
payload: buildResultPayload(articleId, account.name, publishType),
|
payload: buildResultPayload(articleId, account.id, account.name, publishType),
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return failureResult(error);
|
return failureResult(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user