feat(publish/dongchedi): publish via page context with cover and conservative HTML

懂车帝发布闸现走 Playwright/WebContents 内的 fetch,附带 CSRF token、自动
draft+commit 两步保存,并在前置流程中把正文 HTML 收敛到 p/strong/img、表格
降级为段落、过滤本地素材 URL。同步把懂车帝纳入封面强制平台,更新中英文
提示与错误码文案。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 18:35:36 +08:00
parent bf7594ccd8
commit 4c4795e029
10 changed files with 684 additions and 106 deletions
+4 -4
View File
@@ -900,7 +900,7 @@ const enUS = {
platformsHint: "This stays in sync with Media Management so you can edit the article's publish platforms directly.",
coverTitle: "Cover image",
coverHint: "Off by default. Once uploaded, the cover is saved with the article.",
coverRequired: "Baijiahao is selected, so the cover image becomes required.",
coverRequired: "A selected publishing platform requires a cover image.",
coverUpload: "Upload cover image",
coverReplace: "Choose again",
coverRemove: "Remove cover",
@@ -1060,7 +1060,7 @@ const enUS = {
partial: "Publish finished with {success} succeeded and {failed} failed.",
partialTitle: "Partial publish failure",
selectPlatform: "Choose at least one available platform first.",
coverRequired: "Baidu Baijiahao is selected. Please upload a cover image first.",
coverRequired: "A selected publishing platform requires a cover image. Please upload one first.",
failureTitle: "Publish failed",
failureItem: "Publishing to [{platform}] failed: [{reason}]",
unknownFailure: "Unknown error",
@@ -1088,10 +1088,10 @@ const enUS = {
dropzoneTitle: "Upload image",
dropzoneHint: "Supports PNG, JPG, GIF, and WebP up to 10MB. Uploads are converted to WebP in the browser first.",
previewTitle: "Cover crop preview",
previewHintLocked: "Baijiahao is selected, so the cover will be exported as 16:9 when you confirm.",
previewHintLocked: "A selected platform requires a fixed cover ratio, so the cover will be exported using the current platform requirement.",
previewHintFree: "There is no forced cover ratio right now. You can upload the original image directly or adjust framing before confirming.",
requirementsTitle: "Platform requirements",
requirementsHint: "Requirements switch automatically based on the selected publish platforms. Baijiahao is mandatory.",
requirementsHint: "Requirements switch automatically based on the selected publish platforms. Baijiahao and Dongchedi require a cover image.",
recommendedRatio: "Recommended ratio",
recommendedSize: "Recommended size",
required: "Required",
+4 -4
View File
@@ -907,7 +907,7 @@ const zhCN = {
platformsHint: "这里会同步媒体管理中的平台和绑定状态,支持直接编辑文章的发布平台。",
coverTitle: "封面图",
coverHint: "默认关闭。上传后会保存为文章封面素材。",
coverRequired: "已选择百家号,封面图为必传项。",
coverRequired: "已选择需要封面的发布平台,封面图为必传项。",
coverUpload: "上传封面图",
coverReplace: "重新选择",
coverRemove: "移除封面",
@@ -1067,7 +1067,7 @@ const zhCN = {
partial: "发布执行完成,成功 {success} 个,失败 {failed} 个",
partialTitle: "部分发布失败",
selectPlatform: "请先选择至少一个可发布的平台",
coverRequired: "已选择百家号,请先上传封面图",
coverRequired: "已选择需要封面的发布平台,请先上传封面图",
failureTitle: "发布失败",
failureItem: "文章发布到平台【{platform}】失败【{reason}】",
unknownFailure: "未知错误",
@@ -1095,10 +1095,10 @@ const zhCN = {
dropzoneTitle: "上传图片",
dropzoneHint: "支持 PNG、JPG、GIF、WebP,上传前会在前端转为 WebP,最大 10MB",
previewTitle: "封面裁剪预览",
previewHintLocked: "已选择百家号,确认时会按 16:9 输出封面。",
previewHintLocked: "已选择需要固定封面比例的平台,确认时会按当前平台要求输出封面。",
previewHintFree: "当前不限制封面比例,可直接上传原图;如需调整也可拖拽缩放后再确认。",
requirementsTitle: "平台封面要求",
requirementsHint: "会根据当前选中的发布平台自动切换要求,百家号为强制上传。",
requirementsHint: "会根据当前选中的发布平台自动切换要求,百家号和懂车帝为强制上传。",
recommendedRatio: "推荐比例",
recommendedSize: "推荐尺寸",
required: "必传",
@@ -33,6 +33,15 @@ const requirementCatalog: Record<string, Partial<PlatformCoverRequirement>> = {
outputHeight: 800,
priority: 100,
},
dongchedi: {
required: true,
supportMode: "native",
aspectRatio: 4 / 3,
aspectLabel: "4:3",
outputWidth: 1200,
outputHeight: 900,
priority: 90,
},
};
export function getPlatformCoverRequirements(platformIds?: Array<string | null | undefined>): PlatformCoverRequirement[] {
+1 -1
View File
@@ -50,7 +50,7 @@ const errorMessageMap: Record<string, string> = {
question_limit_reached: "当前关键词下的问题数量已达上限",
brand_not_found: "品牌不存在或已删除",
keyword_not_found: "关键词不存在或已删除",
publish_cover_required: "已选择百家号,请先上传封面图",
publish_cover_required: "当前选择的平台要求上传封面图,请先上传封面图",
desktop_account_client_missing: "所选账号还没有绑定桌面客户端,暂时无法发布",
desktop_account_not_found: "所选桌面账号不存在,请刷新后重试",
desktop_client_offline: "当前登录账号的桌面客户端未在线,请先打开 desktop-client",