feat: add trusted mirror update source

Version checks and downloads previously depended on GitHub Release. About & Updates now offers GitHub or a validated mirror source, keeps the selector beneath the startup-check switch, and disables it when startup checks are off.

The website resolves platform downloads from a bounded OSS release index with a GitHub fallback. Tagged releases publish and verify immutable OSS assets through OIDC before switching the latest-version index; deployment requires the configured Alibaba Cloud environment variables and role.

Release note: “关于与更新”新增 GitHub 与镜像节点选择,启动检查、手动检查和下载页使用同一可信来源;官网下载也可按系统、架构和安装包类型直接选择。
This commit is contained in:
mesalogo
2026-08-17 17:20:24 +08:00
parent ce15e7021c
commit dc8f86ff3e
32 changed files with 1680 additions and 66 deletions
+27 -1
View File
@@ -20,7 +20,7 @@ export {
} from '../shared/application-settings-contracts'
export type { ApplicationSettings } from '../shared/application-settings-contracts'
const CURRENT_SETTINGS_VERSION = 5
const CURRENT_SETTINGS_VERSION = 6
const legacyStoredApplicationSettingsSchema = z
.object({
@@ -47,11 +47,20 @@ const versionThreeStoredApplicationSettingsSchema = z
.strict()
const versionFourStoredApplicationSettingsSchema = applicationSettingsSchema
.omit({ updateSource: true })
.extend({
version: z.literal(4)
})
.strict()
const versionFiveStoredApplicationSettingsSchema = applicationSettingsSchema
.omit({ updateSource: true })
.extend({
version: z.literal(5),
lastSeenReleaseNotesVersion: releaseVersionSchema.nullable()
})
.strict()
const storedApplicationSettingsSchema = applicationSettingsSchema
.extend({
version: z.literal(CURRENT_SETTINGS_VERSION),
@@ -65,6 +74,7 @@ type StoredApplicationSettings = z.infer<
export const defaultApplicationSettings: ApplicationSettings = {
checkUpdatesOnStartup: true,
updateSource: 'github',
magicNotesEnabled: false,
magicNoteCommentMode: 'immediate',
magicNoteCommentFormat: 'combined'
@@ -121,12 +131,23 @@ export class ApplicationSettingsStore {
)
const result = storedApplicationSettingsSchema.safeParse(parsed)
if (!result.success) {
const versionFiveResult =
versionFiveStoredApplicationSettingsSchema.safeParse(parsed)
if (versionFiveResult.success) {
this.settings = {
...versionFiveResult.data,
version: CURRENT_SETTINGS_VERSION,
updateSource: 'github'
}
return this.settings
}
const versionFourResult =
versionFourStoredApplicationSettingsSchema.safeParse(parsed)
if (versionFourResult.success) {
this.settings = {
...versionFourResult.data,
version: CURRENT_SETTINGS_VERSION,
updateSource: 'github',
lastSeenReleaseNotesVersion: null
}
return this.settings
@@ -137,6 +158,7 @@ export class ApplicationSettingsStore {
this.settings = {
...versionThreeResult.data,
version: CURRENT_SETTINGS_VERSION,
updateSource: 'github',
magicNoteCommentFormat: 'combined',
lastSeenReleaseNotesVersion: null
}
@@ -148,6 +170,7 @@ export class ApplicationSettingsStore {
this.settings = {
...versionTwoResult.data,
version: CURRENT_SETTINGS_VERSION,
updateSource: 'github',
magicNoteCommentMode: 'immediate',
magicNoteCommentFormat: 'combined',
lastSeenReleaseNotesVersion: null
@@ -161,6 +184,7 @@ export class ApplicationSettingsStore {
version: CURRENT_SETTINGS_VERSION,
checkUpdatesOnStartup:
legacyResult.data.checkUpdatesOnStartup,
updateSource: 'github',
magicNotesEnabled: false,
magicNoteCommentMode: 'immediate',
magicNoteCommentFormat: 'combined',
@@ -200,6 +224,7 @@ export class ApplicationSettingsStore {
const stored = await this.loadStored()
return {
checkUpdatesOnStartup: stored.checkUpdatesOnStartup,
updateSource: stored.updateSource,
magicNotesEnabled: stored.magicNotesEnabled,
magicNoteCommentMode: stored.magicNoteCommentMode,
magicNoteCommentFormat: stored.magicNoteCommentFormat,
@@ -231,6 +256,7 @@ export class ApplicationSettingsStore {
this.warnings = []
return {
checkUpdatesOnStartup: next.checkUpdatesOnStartup,
updateSource: next.updateSource,
magicNotesEnabled: next.magicNotesEnabled,
magicNoteCommentMode: next.magicNoteCommentMode,
magicNoteCommentFormat: next.magicNoteCommentFormat