feat: rebuild portable auto-update flow
This commit is contained in:
@@ -143,6 +143,22 @@ export const rustfsConfigSchema = z.object({
|
||||
region: z.string().default('us-east-1')
|
||||
})
|
||||
|
||||
/**
|
||||
* Update service configuration schema
|
||||
*/
|
||||
export const updateConfigSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
allowDevMode: z.boolean().default(false),
|
||||
endpoint: z.string().default(''),
|
||||
accessKey: z.string().default(''),
|
||||
secretKey: z.string().default(''),
|
||||
bucket: z.string().default(''),
|
||||
region: z.string().default('us-east-1'),
|
||||
basePrefix: z.string().default('updates/win-portable'),
|
||||
checkIntervalMinutes: z.number().int().min(1).max(1440).default(30),
|
||||
maxAdminHistoryPerChannel: z.number().int().min(1).max(100).default(10)
|
||||
})
|
||||
|
||||
/**
|
||||
* 完整应用配置 Schema
|
||||
*/
|
||||
@@ -155,7 +171,8 @@ export const fullConfigSchema = z.object({
|
||||
cleaner: cleanerConfigSchema,
|
||||
orderResolution: orderResolutionSchema,
|
||||
logging: loggingConfigSchema,
|
||||
rustfs: rustfsConfigSchema.optional()
|
||||
rustfs: rustfsConfigSchema.optional(),
|
||||
update: updateConfigSchema.optional()
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -168,6 +185,7 @@ export type SqlServerConfig = z.infer<typeof sqlServerConfigSchema>
|
||||
export type ErpSystemConfig = z.infer<typeof erpSystemConfigSchema>
|
||||
export type LoggingConfig = z.infer<typeof loggingConfigSchema>
|
||||
export type RustfsConfig = z.infer<typeof rustfsConfigSchema>
|
||||
export type UpdateConfig = z.infer<typeof updateConfigSchema>
|
||||
|
||||
/**
|
||||
* 验证并解析配置
|
||||
|
||||
66
src/main/types/update.types.ts
Normal file
66
src/main/types/update.types.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { UserType } from './user.types'
|
||||
|
||||
export type ReleaseChannel = 'stable' | 'preview'
|
||||
|
||||
export type UpdatePhase =
|
||||
| 'idle'
|
||||
| 'checking'
|
||||
| 'available'
|
||||
| 'downloading'
|
||||
| 'downloaded'
|
||||
| 'installing'
|
||||
| 'error'
|
||||
|
||||
export interface UpdateRelease {
|
||||
version: string
|
||||
channel: ReleaseChannel
|
||||
artifactKey: string
|
||||
sha256: string
|
||||
size: number
|
||||
publishedAt: string
|
||||
changelogKey: string
|
||||
notesSummary?: string
|
||||
}
|
||||
|
||||
export interface UpdateCatalog {
|
||||
stable: UpdateRelease[]
|
||||
preview: UpdateRelease[]
|
||||
}
|
||||
|
||||
export interface DownloadedRelease extends UpdateRelease {
|
||||
localPath: string
|
||||
}
|
||||
|
||||
export interface UpdateStatus {
|
||||
enabled: boolean
|
||||
supported: boolean
|
||||
phase: UpdatePhase
|
||||
currentVersion: string
|
||||
currentChannel: ReleaseChannel
|
||||
currentUserType: UserType | null
|
||||
message?: string
|
||||
latestVersion?: string
|
||||
latestChannel?: ReleaseChannel
|
||||
progress?: number
|
||||
downloadedRelease?: Pick<DownloadedRelease, 'version' | 'channel' | 'localPath'>
|
||||
recommendedRelease?: UpdateRelease
|
||||
error?: string
|
||||
adminHasAnyRelease?: boolean
|
||||
}
|
||||
|
||||
export interface UpdateDialogCatalog {
|
||||
mode: 'user' | 'admin' | 'disabled'
|
||||
recommendedRelease?: UpdateRelease
|
||||
channels?: UpdateCatalog
|
||||
}
|
||||
|
||||
export interface DownloadReleaseRequest {
|
||||
version: string
|
||||
channel: ReleaseChannel
|
||||
artifactKey: string
|
||||
sha256: string
|
||||
size: number
|
||||
publishedAt: string
|
||||
changelogKey: string
|
||||
notesSummary?: string
|
||||
}
|
||||
Reference in New Issue
Block a user