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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user