fix: enable weekly storage cleanup
Desktop Client Build / Resolve Build Metadata (push) Successful in 32s
Frontend CI / Frontend (push) Successful in 2m6s
Backend CI / Backend (push) Successful in 16m11s
Desktop Client Build / Build Desktop Client (push) Successful in 23m50s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 37s
Desktop Client Build / Resolve Build Metadata (push) Successful in 32s
Frontend CI / Frontend (push) Successful in 2m6s
Backend CI / Backend (push) Successful in 16m11s
Desktop Client Build / Build Desktop Client (push) Successful in 23m50s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 37s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@geo/desktop-client",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.1",
|
||||
"private": true,
|
||||
"description": "省心推客户端 — 连接和管理您的媒体账号,轻松发布和监控内容表现。",
|
||||
"author": {
|
||||
|
||||
@@ -19,7 +19,7 @@ interface DesktopAppInternalFlags {
|
||||
const DEFAULT_DESKTOP_APP_SETTINGS: DesktopAppSettings = {
|
||||
openAtLogin: false,
|
||||
keepRunningInBackground: true,
|
||||
autoCleanStorageWeekly: false,
|
||||
autoCleanStorageWeekly: true,
|
||||
}
|
||||
|
||||
const DEFAULT_INTERNAL_FLAGS: DesktopAppInternalFlags = {
|
||||
|
||||
@@ -166,6 +166,7 @@ let loginWindow: ElectronBrowserWindow | null = null
|
||||
let settingsWindow: ElectronBrowserWindow | null = null
|
||||
let mainRendererContents: ElectronWebContents | null = null
|
||||
let quitReleaseInFlight = false
|
||||
let quitAfterSaasLogoutPromise: Promise<void> | null = null
|
||||
let mainWindowCreatePromise: Promise<ElectronBrowserWindow> | null = null
|
||||
let loginWindowCreatePromise: Promise<ElectronBrowserWindow> | null = null
|
||||
let settingsWindowCreatePromise: Promise<ElectronBrowserWindow> | null = null
|
||||
@@ -516,6 +517,36 @@ function revealActiveWindowSafely(source: string): void {
|
||||
})
|
||||
}
|
||||
|
||||
function timeout(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
function quitAfterClearingSaasSession(): void {
|
||||
if (quitAfterSaasLogoutPromise) {
|
||||
return
|
||||
}
|
||||
|
||||
quitAfterSaasLogoutPromise = (async () => {
|
||||
currentWindowMode = 'login'
|
||||
persistWindowMode('login')
|
||||
|
||||
// Only clear the Shengxintui SaaS session. Bound media/AI account browser
|
||||
// partitions are intentionally preserved so the same account can reuse them
|
||||
// after signing in again.
|
||||
await Promise.race([clearRendererDesktopSessions(), timeout(1000)])
|
||||
await Promise.race([releaseRuntimeSession(), timeout(1500)])
|
||||
})()
|
||||
.catch((error) => {
|
||||
console.warn('[desktop-main] quit after clearing saas session failed', {
|
||||
message: error instanceof Error ? error.message : String(error),
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
quitReleaseInFlight = true
|
||||
app.quit()
|
||||
})
|
||||
}
|
||||
|
||||
function windowFromIpcEvent(event: IpcMainInvokeEvent): ElectronBrowserWindow | null {
|
||||
const window = BrowserWindow.fromWebContents(event.sender)
|
||||
if (!window || window.isDestroyed()) {
|
||||
@@ -1190,9 +1221,14 @@ if (!hasSingleInstanceLock) {
|
||||
mainRendererContents.send('desktop:runtime-invalidated', event)
|
||||
})
|
||||
await queueWindowModeSwitch(currentWindowMode)
|
||||
initTray(() => {
|
||||
revealActiveWindowSafely('tray')
|
||||
})
|
||||
initTray(
|
||||
() => {
|
||||
revealActiveWindowSafely('tray')
|
||||
},
|
||||
() => {
|
||||
quitAfterClearingSaasSession()
|
||||
},
|
||||
)
|
||||
startDesktopHealthIndicator(() => currentMainWindow())
|
||||
queueDesktopDeepLink(extractDesktopDeepLink(process.argv))
|
||||
flushPendingDesktopDeepLinks()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { nativeImage } from 'electron/common'
|
||||
import type { Tray as ElectronTray } from 'electron/main'
|
||||
import { Menu, Tray, app } from 'electron/main'
|
||||
import { Menu, Tray } from 'electron/main'
|
||||
|
||||
import { TRAY_DANGER_ICON_BASE64, TRAY_ICON_BASE64, TRAY_WINDOWS_ICON_BASE64 } from './brand-icons'
|
||||
|
||||
@@ -84,7 +84,7 @@ export function updateTrayIssueIndicator(issueCount: number): void {
|
||||
tray.setToolTip(hasIssues ? `省心推 · ${safeCount} 个账号健康问题` : '省心推')
|
||||
}
|
||||
|
||||
export function initTray(onOpen: () => void): ElectronTray {
|
||||
export function initTray(onOpen: () => void, onQuit: () => void): ElectronTray {
|
||||
if (tray) {
|
||||
return tray
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export function initTray(onOpen: () => void): ElectronTray {
|
||||
Menu.buildFromTemplate([
|
||||
{ label: '打开省心推', click: () => onOpen() },
|
||||
{ type: 'separator' },
|
||||
{ label: '退出省心推', click: () => app.quit() },
|
||||
{ label: '退出省心推', click: () => onQuit() },
|
||||
]),
|
||||
)
|
||||
tray.on('click', () => onOpen())
|
||||
|
||||
@@ -56,7 +56,7 @@ const activeSection = ref<SectionKey>('general')
|
||||
const appSettings = ref<DesktopAppSettings>({
|
||||
openAtLogin: false,
|
||||
keepRunningInBackground: true,
|
||||
autoCleanStorageWeekly: false,
|
||||
autoCleanStorageWeekly: true,
|
||||
})
|
||||
const serverBaseURL = ref(apiBaseURL.value)
|
||||
const settingsLoaded = ref(false)
|
||||
|
||||
@@ -623,6 +623,9 @@ function uploadButtonText(kind: 'installer' | 'updater') {
|
||||
if (isUploading && typeof progress === 'number' && progress < 100) {
|
||||
return `上传中 ${progress}%`
|
||||
}
|
||||
if (isUploading && progress === 100) {
|
||||
return '校验并写入 OSS...'
|
||||
}
|
||||
if (isUploading) {
|
||||
return '写入 OSS...'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user