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
+23
View File
@@ -628,6 +628,29 @@
- `git diff --check` passed.
- `pnpm --filter @geo/desktop-client typecheck` failed before checking runtime changes because `electron.vite.config.ts` has a Vite 5/8 plugin type mismatch.
### 2026-04-28 Dongchedi Publish Debug
- **Status:** in_progress
- Actions taken:
- Queried local `geo-postgres` through `docker exec` because `psql` is not installed on the host.
- Verified article `95` reconstructs to normal markdown through `repository.LoadArticleVersionContent`; removed the temporary inspection test after use.
- Updated `apps/desktop-client/src/main/adapters/dongchedi.ts` so body images first try Dongchedi `spice/image`; local/relative images use ImageX upload and then run through `spice/image` before replacement.
- Added redacted Dongchedi publish rejection diagnostics to the adapter error payload/logs.
- Added `apps/desktop-client/src/main/adapters/dongchedi-content.ts` and a unit test to downgrade table HTML to paragraph rows before Dongchedi submit.
- Followed up after another `server exception` retry where diagnostics showed no table tags, no local asset URL, and one body image.
- Removed `&nbsp;` entities from Dongchedi table-downgraded body HTML.
- Changed body image handling so ImageX-uploaded local images try Dongchedi `spice/image` through both session and page-context requests before replacement.
- After the platform returned `dongchedi_image_upload_failed:content_images_missing_1_of_1`, tried an ImageX direct URL fallback; the next retry still returned `server exception` with `content_image_upload_strategies = ['imagex_direct_fallback']`.
- Removed the direct ImageX正文图 fallback. Local正文图片 that cannot be converted to a Dongchedi `spice` URL are now removed from `content` instead of failing early or submitting a rejected ImageX URL.
- After a no-body-image retry still returned `server exception`, changed `extra.content_word_cnt` from the reference extension's hardcoded `267` to the actual text count of the final submitted HTML.
- Added `content_word_cnt` and `computed_text_count` to Dongchedi rejection diagnostics.
- Expanded rejection diagnostics with body image host summaries, body image upload strategies, tag/entity counts, content end excerpt, and cover upload dimensions/hosts.
- Verification:
- `pnpm --filter @geo/desktop-client typecheck` passed.
- `pnpm --filter @geo/desktop-client test -- dongchedi` passed.
- `pnpm --filter @geo/desktop-client test` passed.
- `pnpm --filter @geo/desktop-client build` passed and refreshed `out/main/bootstrap.cjs`.
- `git diff --check` passed.
## 5-Question Reboot Check
| Question | Answer |
|----------|--------|