重启之后清除登录信息
This commit is contained in:
@@ -1,38 +1,22 @@
|
||||
import { Tray, Menu, app, BrowserWindow } from 'electron'
|
||||
import { Tray, Menu, app, BrowserWindow, shell } from 'electron'
|
||||
import { join } from 'path'
|
||||
import icon from '../../resources/icon.png?asset'
|
||||
import { getMainWindow, createWindow, createApiConfigWindow, createConfigWindow ,getDragWindow} from './window.js'
|
||||
import { getStoreValue, setStoreValue, clearStore } from './store.js'
|
||||
import { createDrageWindow, getDrageWindow } from './window.js'
|
||||
import logger from './utils/logger'
|
||||
import { clearAllWindowsCache } from './utils/cacheUtils.js'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
let tray = null
|
||||
|
||||
import {checkForUpdates} from "./utils/updateUtils"
|
||||
|
||||
async function clearBrowserCache() {
|
||||
export async function clearBrowserCache() {
|
||||
try {
|
||||
// 清除所有窗口的浏览器缓存
|
||||
const windows = BrowserWindow.getAllWindows()
|
||||
for (const window of windows) {
|
||||
const session = window.webContents.session
|
||||
await session.clearStorageData({
|
||||
storages: [
|
||||
'appcache',
|
||||
'cookies',
|
||||
'filesystem',
|
||||
'indexdb',
|
||||
'localstorage',
|
||||
'shadercache',
|
||||
'websql',
|
||||
'serviceworkers',
|
||||
'cachestorage'
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
logger.info('浏览器缓存清除成功')
|
||||
// 使用统一的缓存清理函数
|
||||
await clearAllWindowsCache('tray-clear-cache');
|
||||
} catch (error) {
|
||||
logger.error('清除浏览器缓存失败:', error)
|
||||
}
|
||||
@@ -108,6 +92,7 @@ export function createTray() {
|
||||
checkForUpdates(menuItem,true)
|
||||
}
|
||||
},
|
||||
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: '清除缓存',
|
||||
|
||||
Reference in New Issue
Block a user