Compare commits
2 Commits
8396bdeb48
...
3f8971aa55
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f8971aa55 | |||
| b7ba3ba58a |
@@ -63,6 +63,24 @@ import { initTray, showTrayBalloon } from './tray'
|
|||||||
import { STANDARD_USER_AGENT } from './user-agent'
|
import { STANDARD_USER_AGENT } from './user-agent'
|
||||||
import { startHotViewReaper } from './view-pool'
|
import { startHotViewReaper } from './view-pool'
|
||||||
|
|
||||||
|
// In dev (no packaged Info.plist / NSIS metadata) Electron falls back to the
|
||||||
|
// generic "Electron" name, so the macOS menu bar and Windows task switcher
|
||||||
|
// show "Electron". Pin the dev-time app name to the product brand. Packaged
|
||||||
|
// builds ignore this because Info.plist `CFBundleName` (driven by
|
||||||
|
// electron-builder `productName`) takes precedence.
|
||||||
|
app.setName('ShengxinPush')
|
||||||
|
|
||||||
|
// The macOS "About" panel pulls from a separate options bag — `setName` alone
|
||||||
|
// leaves it as "Electron 41.x". Set explicit copy here so the dev About dialog
|
||||||
|
// matches the brand. Packaged macOS again wins via Info.plist.
|
||||||
|
app.setAboutPanelOptions({
|
||||||
|
applicationName: 'ShengxinPush',
|
||||||
|
applicationVersion: app.getVersion(),
|
||||||
|
version: app.getVersion(),
|
||||||
|
copyright: 'Copyright © 2026 shengxintui.com',
|
||||||
|
website: 'https://shengxintui.com',
|
||||||
|
})
|
||||||
|
|
||||||
app.commandLine.appendSwitch(
|
app.commandLine.appendSwitch(
|
||||||
'disable-features',
|
'disable-features',
|
||||||
'PostQuantumKyber,EncryptedClientHello,UseDnsHttpsSvcb,UseDnsHttpsSvcbAlpn',
|
'PostQuantumKyber,EncryptedClientHello,UseDnsHttpsSvcb,UseDnsHttpsSvcbAlpn',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
BAIJIAHAO_CHALLENGE_REQUIRED_MESSAGE,
|
||||||
PUBLISH_ACCOUNT_NOT_LOGGED_IN_MESSAGE,
|
PUBLISH_ACCOUNT_NOT_LOGGED_IN_MESSAGE,
|
||||||
QIEHAO_REAL_NAME_AUTH_MESSAGE,
|
QIEHAO_REAL_NAME_AUTH_MESSAGE,
|
||||||
WANGYIHAO_DRAFT_SAVE_PARAMETER_MESSAGE,
|
WANGYIHAO_DRAFT_SAVE_PARAMETER_MESSAGE,
|
||||||
@@ -8,6 +9,7 @@ import {
|
|||||||
WANGYIHAO_TOKEN_MISSING_MESSAGE,
|
WANGYIHAO_TOKEN_MISSING_MESSAGE,
|
||||||
WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
|
WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
|
||||||
isQiehaoRealNameAuthError,
|
isQiehaoRealNameAuthError,
|
||||||
|
normalizeBaijiahaoPublishErrorMessage,
|
||||||
normalizePublisherErrorMessage,
|
normalizePublisherErrorMessage,
|
||||||
normalizePublisherLoginErrorMessage,
|
normalizePublisherLoginErrorMessage,
|
||||||
normalizeQiehaoPublishErrorMessage,
|
normalizeQiehaoPublishErrorMessage,
|
||||||
@@ -76,6 +78,18 @@ describe('publisher error normalization', () => {
|
|||||||
).toBe(WANGYIHAO_PUBLISH_CLICK_MESSAGE)
|
).toBe(WANGYIHAO_PUBLISH_CLICK_MESSAGE)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('normalizes Baijiahao challenge-required failures', () => {
|
||||||
|
expect(normalizePublisherErrorMessage('baijiahao_challenge_required')).toBe(
|
||||||
|
BAIJIAHAO_CHALLENGE_REQUIRED_MESSAGE,
|
||||||
|
)
|
||||||
|
expect(
|
||||||
|
normalizePublisherErrorMessage('baijiahao_challenge_required:您所在网络环境异常,请完成验证'),
|
||||||
|
).toBe(BAIJIAHAO_CHALLENGE_REQUIRED_MESSAGE)
|
||||||
|
expect(normalizeBaijiahaoPublishErrorMessage('Error: baijiahao_challenge_required')).toBe(
|
||||||
|
BAIJIAHAO_CHALLENGE_REQUIRED_MESSAGE,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it('normalizes Weixin GZH missing public URL failures', () => {
|
it('normalizes Weixin GZH missing public URL failures', () => {
|
||||||
expect(normalizePublisherErrorMessage('weixin_gzh_public_url_missing:100000093')).toBe(
|
expect(normalizePublisherErrorMessage('weixin_gzh_public_url_missing:100000093')).toBe(
|
||||||
WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
|
WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE,
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ export const WANGYIHAO_PUBLISH_CLICK_MESSAGE =
|
|||||||
'网易号草稿已保存,但自动发布未完成。请打开网易号后台确认草稿状态后重试。'
|
'网易号草稿已保存,但自动发布未完成。请打开网易号后台确认草稿状态后重试。'
|
||||||
export const WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE =
|
export const WEIXIN_GZH_PUBLIC_URL_MISSING_MESSAGE =
|
||||||
'微信公众号可能已触发管理员/运营者授权发布,桌面端未能获取到文章外链。请打开公众号后台完成授权发布,并在发表记录中确认文章链接。'
|
'微信公众号可能已触发管理员/运营者授权发布,桌面端未能获取到文章外链。请打开公众号后台完成授权发布,并在发表记录中确认文章链接。'
|
||||||
|
export const BAIJIAHAO_CHALLENGE_REQUIRED_MESSAGE =
|
||||||
|
'百家号检测到网络环境异常,需要人机验证。请打开百家号后台手动完成一次发稿或验证后再重试发布。'
|
||||||
|
|
||||||
const PUBLISH_PLATFORM_LABELS: Record<string, string> = {
|
const PUBLISH_PLATFORM_LABELS: Record<string, string> = {
|
||||||
baijiahao: '百家号',
|
baijiahao: '百家号',
|
||||||
@@ -124,12 +126,27 @@ export function normalizeWeixinGzhPublishErrorMessage(
|
|||||||
return normalized
|
return normalized
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeBaijiahaoPublishErrorMessage(
|
||||||
|
message: string | null | undefined,
|
||||||
|
): string | null {
|
||||||
|
const normalized = normalizeErrorText(message)
|
||||||
|
if (!normalized) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/\bbaijiahao_challenge_required\b/i.test(normalized)) {
|
||||||
|
return BAIJIAHAO_CHALLENGE_REQUIRED_MESSAGE
|
||||||
|
}
|
||||||
|
return normalized
|
||||||
|
}
|
||||||
|
|
||||||
export function normalizePublisherErrorMessage(message: string | null | undefined): string | null {
|
export function normalizePublisherErrorMessage(message: string | null | undefined): string | null {
|
||||||
if (message === 'compliance_blocked') {
|
if (message === 'compliance_blocked') {
|
||||||
return '内容合规检测已阻断本次发布,请修改文章后重新发布。'
|
return '内容合规检测已阻断本次发布,请修改文章后重新发布。'
|
||||||
}
|
}
|
||||||
const qiehaoMessage = normalizeQiehaoPublishErrorMessage(message)
|
const qiehaoMessage = normalizeQiehaoPublishErrorMessage(message)
|
||||||
const wangyihaoMessage = normalizeWangyihaoPublishErrorMessage(qiehaoMessage)
|
const wangyihaoMessage = normalizeWangyihaoPublishErrorMessage(qiehaoMessage)
|
||||||
const loginMessage = normalizePublisherLoginErrorMessage(wangyihaoMessage)
|
const baijiahaoMessage = normalizeBaijiahaoPublishErrorMessage(wangyihaoMessage)
|
||||||
|
const loginMessage = normalizePublisherLoginErrorMessage(baijiahaoMessage)
|
||||||
return normalizeWeixinGzhPublishErrorMessage(loginMessage)
|
return normalizeWeixinGzhPublishErrorMessage(loginMessage)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user