feat(publish): unify image fetch failure message across adapters
Deployment Config CI / Deployment Config (push) Successful in 30s
Desktop Client Build / Resolve Build Metadata (push) Successful in 17s
Frontend CI / Frontend (push) Successful in 3m35s
Backend CI / Backend (push) Successful in 16m50s
Desktop Client Build / Build Desktop Client (push) Successful in 24m2s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 30s
Deployment Config CI / Deployment Config (push) Successful in 30s
Desktop Client Build / Resolve Build Metadata (push) Successful in 17s
Frontend CI / Frontend (push) Successful in 3m35s
Backend CI / Backend (push) Successful in 16m50s
Desktop Client Build / Build Desktop Client (push) Successful in 24m2s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 30s
Consolidate per-platform cover/image fetch failure prompts into a single PUBLISH_IMAGE_FETCH_FAILED_MESSAGE constant shared by baijiahao, bilibili, dongchedi, qiehao, smzdm, and zol adapters, and generalize the normalizer to match any *_image_fetch_failed / *_cover_fetch_failed code. Also split desktop publish list loading into initial vs manual-refresh states so the refresh button no longer blanks the table, and fix admin-web active-task detection to cover all pending statuses.
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
prepareBaijiahaoMarkdown,
|
||||
} from '../../../../../packages/publisher-platforms/src/baijiahao'
|
||||
|
||||
import { PUBLISH_IMAGE_FETCH_FAILED_MESSAGE } from '../../shared/publisher-errors'
|
||||
import { resolveDesktopApiURL } from '../transport/api-client'
|
||||
import type { PublishAdapter, PublishAdapterContext } from './base'
|
||||
import {
|
||||
@@ -436,7 +437,7 @@ function failureResult(
|
||||
) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '百家号封面文件读取失败,请重新上传封面图后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'baijiahao_cover_fetch_failed',
|
||||
message,
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createHash } from 'node:crypto'
|
||||
import type { JsonValue } from '@geo/shared-types'
|
||||
import { renderTablesAsParagraphRows } from '../../../../../packages/publisher-platforms/src/baijiahao'
|
||||
|
||||
import { PUBLISH_IMAGE_FETCH_FAILED_MESSAGE } from '../../shared/publisher-errors'
|
||||
import { resolveDesktopApiURL } from '../transport/api-client'
|
||||
import type { PublishAdapter, PublishAdapterContext } from './base'
|
||||
import {
|
||||
@@ -639,7 +640,7 @@ function buildFailureResult(
|
||||
) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: 'bilibili 正文图片读取失败,请检查文章图片后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'bilibili_image_fetch_failed',
|
||||
message,
|
||||
|
||||
@@ -2,7 +2,10 @@ import { createHash, createHmac } from 'node:crypto'
|
||||
|
||||
import type { JsonValue } from '@geo/shared-types'
|
||||
|
||||
import { DONGCHEDI_PLATFORM_EXCEPTION_MESSAGE } from '../../shared/publisher-errors'
|
||||
import {
|
||||
DONGCHEDI_PLATFORM_EXCEPTION_MESSAGE,
|
||||
PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
} from '../../shared/publisher-errors'
|
||||
import type { PublishAdapter, PublishAdapterContext } from './base'
|
||||
import {
|
||||
ensureViewLoaded,
|
||||
@@ -944,7 +947,7 @@ function failureResult(
|
||||
) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '懂车帝封面文件读取失败,请重新上传封面图后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'dongchedi_cover_fetch_failed',
|
||||
message,
|
||||
@@ -958,7 +961,7 @@ function failureResult(
|
||||
) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '懂车帝正文图片读取失败,请检查文章图片后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'dongchedi_image_fetch_failed',
|
||||
message,
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { JsonValue } from '@geo/shared-types'
|
||||
import { prepareQiehaoArticleHtml } from '../../../../../packages/publisher-platforms/src/qiehao'
|
||||
|
||||
import {
|
||||
PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
QIEHAO_REAL_NAME_AUTH_MESSAGE,
|
||||
isQiehaoRealNameAuthError,
|
||||
} from '../../shared/publisher-errors'
|
||||
@@ -425,7 +426,7 @@ function failureResult(
|
||||
if (message === 'qiehao_cover_fetch_failed' || message.startsWith('qiehao_cover_fetch_failed:')) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '企鹅号封面文件读取失败,请重新上传封面图后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'qiehao_cover_fetch_failed',
|
||||
message,
|
||||
@@ -436,7 +437,7 @@ function failureResult(
|
||||
if (message === 'qiehao_image_fetch_failed' || message.startsWith('qiehao_image_fetch_failed:')) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '企鹅号正文图片读取失败,请检查文章图片后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'qiehao_image_fetch_failed',
|
||||
message,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { createCipheriv, createHash } from 'node:crypto'
|
||||
import type { JsonValue } from '@geo/shared-types'
|
||||
import { nativeImage } from 'electron'
|
||||
|
||||
import { PUBLISH_IMAGE_FETCH_FAILED_MESSAGE } from '../../shared/publisher-errors'
|
||||
import { resolveDesktopApiURL } from '../transport/api-client'
|
||||
import type { PublishAdapter, PublishAdapterContext } from './base'
|
||||
import {
|
||||
@@ -776,7 +777,7 @@ function failureResult(
|
||||
if (message.startsWith('smzdm_cover_fetch_failed')) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '什么值得买封面文件读取失败,请重新上传封面图后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'smzdm_cover_fetch_failed',
|
||||
message,
|
||||
@@ -787,7 +788,7 @@ function failureResult(
|
||||
if (message.startsWith('smzdm_image_fetch_failed')) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '图片获取错误,请检查你文章和封面图片是否正确',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'smzdm_image_fetch_failed',
|
||||
message,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { JsonValue } from '@geo/shared-types'
|
||||
|
||||
import { PUBLISH_IMAGE_FETCH_FAILED_MESSAGE } from '../../shared/publisher-errors'
|
||||
import type { PublishAdapter, PublishAdapterContext } from './base'
|
||||
import {
|
||||
extractImageSources,
|
||||
@@ -488,7 +489,7 @@ function failureResult(
|
||||
if (message.startsWith('zol_cover_fetch_failed')) {
|
||||
return {
|
||||
status: 'failed',
|
||||
summary: '中关村在线封面文件读取失败,请重新上传封面图后重试。',
|
||||
summary: PUBLISH_IMAGE_FETCH_FAILED_MESSAGE,
|
||||
error: {
|
||||
code: 'zol_cover_fetch_failed',
|
||||
message,
|
||||
|
||||
Reference in New Issue
Block a user