feat: add desktop storage cleanup controls

This commit is contained in:
2026-06-18 23:50:56 +08:00
parent 889a575188
commit d8195bc935
7 changed files with 976 additions and 1 deletions
+13 -1
View File
@@ -70,6 +70,11 @@ import { createRuntimeAccountSnapshot, createRuntimeSnapshot } from './runtime-s
import { initScheduler } from './scheduler'
import { initSessionRegistry } from './session-registry'
import { initSingleInstance } from './single-instance'
import {
cleanDesktopStorage,
getDesktopStorageSnapshot,
startStorageCleanupScheduler,
} from './storage-cleaner'
import {
cancelDesktopTask,
checkDesktopClientRelease,
@@ -1085,12 +1090,18 @@ function registerBridgeHandlers(): void {
safeHandle(
'desktop:set-app-setting',
async (_event, key: DesktopAppSettingKey, value: boolean) => {
if (key !== 'openAtLogin' && key !== 'keepRunningInBackground') {
if (
key !== 'openAtLogin' &&
key !== 'keepRunningInBackground' &&
key !== 'autoCleanStorageWeekly'
) {
throw new Error('unsupported_app_setting')
}
return setDesktopAppSetting(key, value)
},
)
safeHandle('desktop:storage-snapshot', () => getDesktopStorageSnapshot())
safeHandle('desktop:clean-storage', () => cleanDesktopStorage())
safeHandle(
'desktop:runtime-session-sync',
(_event, session: DesktopRuntimeSessionSyncRequest | null) => {
@@ -1168,6 +1179,7 @@ if (!hasSingleInstanceLock) {
initAccountHealth()
initTransport()
initScheduler()
startStorageCleanupScheduler()
initProcessMetricsSampler()
startHotViewReaper()
startHiddenPlaywrightReaper()