feat: 设置功能

This commit is contained in:
Wxw-Gu
2026-07-30 09:49:56 +08:00
parent 0adb064681
commit 77adc744e0
27 changed files with 1430 additions and 17 deletions
+1 -1
View File
@@ -68,4 +68,4 @@ publish:
provider: github provider: github
owner: Wxw-Gu owner: Wxw-Gu
repo: WechatExplorer repo: WechatExplorer
releaseType: draft releaseType: release
+139
View File
@@ -0,0 +1,139 @@
"use strict";
const electron = require("electron");
const preload = require("@electron-toolkit/preload");
const api = {
writeAppLog: (entry) => electron.ipcRenderer.invoke("app-log:write", entry),
getAppLogPath: () => electron.ipcRenderer.invoke("app-log:getPath"),
revealAppLog: () => electron.ipcRenderer.invoke("app-log:reveal"),
getAppUpdateState: () => electron.ipcRenderer.invoke("app-update:getState"),
checkAppUpdate: () => electron.ipcRenderer.invoke("app-update:check"),
downloadAppUpdate: () => electron.ipcRenderer.invoke("app-update:download"),
installAppUpdate: () => electron.ipcRenderer.invoke("app-update:install"),
onAppUpdateState: (callback) => {
const listener = (_event, state) => callback(state);
electron.ipcRenderer.on("app-update:state", listener);
return () => electron.ipcRenderer.removeListener("app-update:state", listener);
},
getCacheSummary: () => electron.ipcRenderer.invoke("cache:getSummary"),
clearCache: (scope) => electron.ipcRenderer.invoke("cache:clear", scope),
initDb: (key) => electron.ipcRenderer.invoke("db:init", key),
getBootstrapCache: () => electron.ipcRenderer.invoke("db:getBootstrapCache"),
getStartupCache: () => electron.ipcRenderer.invoke("db:getStartupCache"),
getContacts: (filter) => electron.ipcRenderer.invoke("db:getContacts", filter),
getContactAvatars: (usernames) => electron.ipcRenderer.invoke("db:getContactAvatars", usernames),
getCachedMessages: (userMd5, startTime, endTime) => electron.ipcRenderer.invoke("db:getCachedMessages", userMd5, startTime, endTime),
getCachedMessagePage: (userMd5, startTime, endTime) => electron.ipcRenderer.invoke("db:getCachedMessagePage", userMd5, startTime, endTime),
getMessages: (userMd5, startTime, endTime, options) => electron.ipcRenderer.invoke("db:getMessages", userMd5, startTime, endTime, options),
getGroupSnapshot: (userMd5) => electron.ipcRenderer.invoke("db:getGroupSnapshot", userMd5),
search: (keyword) => electron.ipcRenderer.invoke("db:search", keyword),
aiChat: (messages, options) => electron.ipcRenderer.invoke("ai:chat", messages, options),
listAIProviders: () => electron.ipcRenderer.invoke("ai:listProviders"),
getAIRuntimeConfig: () => electron.ipcRenderer.invoke("ai:getRuntimeConfig"),
saveAIProvider: (provider) => electron.ipcRenderer.invoke("ai:saveProvider", provider),
deleteAIProvider: (providerId) => electron.ipcRenderer.invoke("ai:deleteProvider", providerId),
setDefaultAIProvider: (providerId) => electron.ipcRenderer.invoke("ai:setDefaultProvider", providerId),
testAIProvider: (providerId) => electron.ipcRenderer.invoke("ai:testProvider", providerId),
testAIVision: (request) => electron.ipcRenderer.invoke("ai:testVision", request),
migrateLegacyAIConfig: (config) => electron.ipcRenderer.invoke("ai:migrateLegacy", config),
copyImage: (base64String) => electron.ipcRenderer.invoke("copy-image", base64String),
getVoiceData: (sessionId, localId, createTime, svrId) => electron.ipcRenderer.invoke("db:getVoiceData", sessionId, localId, createTime, svrId),
parseMessage: (content, messageType) => electron.ipcRenderer.invoke("db:parseMessage", content, messageType),
getImage: (imageMd5, imageDatNameOrThumb, sessionId, options) => electron.ipcRenderer.invoke("db:getImage", imageMd5, imageDatNameOrThumb, sessionId, options),
getVideo: (hashes) => electron.ipcRenderer.invoke("db:getVideo", hashes),
getSticker: (cdnUrl, md5) => electron.ipcRenderer.invoke("db:getSticker", cdnUrl, md5),
startExport: (request) => electron.ipcRenderer.invoke("export:start", request),
cancelExport: (jobId) => electron.ipcRenderer.invoke("export:cancel", jobId),
revealExport: (path) => electron.ipcRenderer.invoke("export:reveal", path),
onExportProgress: (callback) => {
const listener = (_event, progress) => callback(progress);
electron.ipcRenderer.on("export:progress", listener);
return () => electron.ipcRenderer.removeListener("export:progress", listener);
},
exportGroupReport: (request) => electron.ipcRenderer.invoke("report:export", request),
listGeneratedReports: () => electron.ipcRenderer.invoke("report:listGenerated"),
saveGeneratedReport: (request) => electron.ipcRenderer.invoke("report:saveGenerated", request),
deleteGeneratedReport: (reportId) => electron.ipcRenderer.invoke("report:deleteGenerated", reportId),
revealGroupReport: (filePath) => electron.ipcRenderer.invoke("report:reveal", filePath),
getSavedDbKey: () => electron.ipcRenderer.invoke("key:getSavedDbKey"),
getDatabaseKeyEnvironment: () => electron.ipcRenderer.invoke("key:getEnvironment"),
readDatabaseKeyClipboard: () => electron.ipcRenderer.invoke("key:readClipboardDbKey"),
autoGetDbKey: (options) => electron.ipcRenderer.invoke("key:autoGetDbKey", options),
autoGetImageKey: (options) => electron.ipcRenderer.invoke("key:autoGetImageKey", options),
getImageKeyConfig: () => electron.ipcRenderer.invoke("image:getConfig"),
getImageDecryptionStatus: () => electron.ipcRenderer.invoke("image:getStatus"),
saveImageKeyConfig: (request) => electron.ipcRenderer.invoke("image:saveConfig", request),
testImageDecryption: (request) => electron.ipcRenderer.invoke("image:testConfig", request),
clearImageKeyConfig: () => electron.ipcRenderer.invoke("image:clearConfig"),
pasteAndSaveDbKey: () => electron.ipcRenderer.invoke("key:pasteAndSaveDbKey"),
saveDbKey: (key) => electron.ipcRenderer.invoke("key:saveDbKey", key),
clearSavedDbKey: () => electron.ipcRenderer.invoke("key:clearSavedDbKey"),
onWcdbChange: (callback) => {
const listener = (_event, payload) => callback(payload);
electron.ipcRenderer.on("wcdb-change", listener);
return () => electron.ipcRenderer.removeListener("wcdb-change", listener);
},
onDbKeyStatus: (callback) => {
const listener = (_event, payload) => callback(payload);
electron.ipcRenderer.on("key:dbKeyStatus", listener);
return () => electron.ipcRenderer.removeListener("key:dbKeyStatus", listener);
},
onImageKeyStatus: (callback) => {
const listener = (_event, payload) => callback(payload);
electron.ipcRenderer.on("key:imageKeyStatus", listener);
return () => electron.ipcRenderer.removeListener("key:imageKeyStatus", listener);
},
getSettings: () => electron.ipcRenderer.invoke("settings:get"),
setSettings: (patch) => electron.ipcRenderer.invoke("settings:set", patch),
getSelf: () => electron.ipcRenderer.invoke("settings:getSelf"),
testConnection: (key, accountRoot) => electron.ipcRenderer.invoke("db:testConnection", key, accountRoot),
reopenWithRoot: (accountRoot) => electron.ipcRenderer.invoke("db:reopenWithRoot", accountRoot),
selectDbRoot: () => electron.ipcRenderer.invoke("settings:selectDbRoot"),
openAccountRoot: () => electron.ipcRenderer.invoke("settings:openAccountRoot"),
disconnectDb: (options) => electron.ipcRenderer.invoke("db:disconnect", options),
apiStatus: () => electron.ipcRenderer.invoke("api:getStatus"),
apiStart: (host, port) => electron.ipcRenderer.invoke("api:start", host, port),
apiStop: () => electron.ipcRenderer.invoke("api:stop"),
apiToggle: (enabled) => electron.ipcRenderer.invoke("api:toggle", enabled),
getReaderSkillStatus: () => electron.ipcRenderer.invoke("api:skillStatus"),
readReaderSkill: () => electron.ipcRenderer.invoke("api:readSkill"),
revealReaderSkill: () => electron.ipcRenderer.invoke("api:revealSkill"),
openReaderSkillGithub: () => electron.ipcRenderer.invoke("api:openSkillGithub"),
testLocalApiRequest: (request) => electron.ipcRenderer.invoke("api:testLocalRequest", request),
copyText: (text) => electron.ipcRenderer.invoke("api:copyText", text),
// ============================================================
// AI 图片理解基础设施(ImageInsightService)
// ============================================================
imageListCandidates: (query) => electron.ipcRenderer.invoke("image:listCandidates", query),
imageAnalyze: (request) => electron.ipcRenderer.invoke("image:analyze", request),
getImageInsight: (imageHash) => electron.ipcRenderer.invoke("image:getInsight", imageHash),
listImageInsights: (sessionId, limit) => electron.ipcRenderer.invoke("image:listInsights", sessionId, limit),
getAgentHubStatus: () => electron.ipcRenderer.invoke("agent-hub:getStatus"),
getAgentHubLogs: () => electron.ipcRenderer.invoke("agent-hub:getLogs"),
clearAgentHubLogs: () => electron.ipcRenderer.invoke("agent-hub:clearLogs"),
startAgentHubLogin: () => electron.ipcRenderer.invoke("agent-hub:startLogin"),
cancelAgentHubLogin: () => electron.ipcRenderer.invoke("agent-hub:cancelLogin"),
reconnectAgentHub: () => electron.ipcRenderer.invoke("agent-hub:reconnect"),
disconnectAgentHub: () => electron.ipcRenderer.invoke("agent-hub:disconnect"),
selectAgentHubTestImage: () => electron.ipcRenderer.invoke("agent-hub:selectTestImage"),
onAgentHubStatus: (callback) => {
const listener = (_event, status) => callback(status);
electron.ipcRenderer.on("agent-hub:status", listener);
return () => electron.ipcRenderer.removeListener("agent-hub:status", listener);
},
onAgentHubLog: (callback) => {
const listener = (_event, entry) => callback(entry);
electron.ipcRenderer.on("agent-hub:log", listener);
return () => electron.ipcRenderer.removeListener("agent-hub:log", listener);
}
};
if (process.contextIsolated) {
try {
electron.contextBridge.exposeInMainWorld("electron", preload.electronAPI);
electron.contextBridge.exposeInMainWorld("api", api);
} catch (error) {
console.error(error);
}
} else {
window.electron = preload.electronAPI;
window.api = api;
}
+1
View File
@@ -48,6 +48,7 @@
"@electron-toolkit/utils": "^4.0.0", "@electron-toolkit/utils": "^4.0.0",
"@koromix/koffi-win32-x64": "3.1.0", "@koromix/koffi-win32-x64": "3.1.0",
"@tanstack/react-virtual": "^3.14.6", "@tanstack/react-virtual": "^3.14.6",
"electron-updater": "^6.6.2",
"fs-extra": "^11.3.2", "fs-extra": "^11.3.2",
"fzstd": "^0.1.1", "fzstd": "^0.1.1",
"jsonrepair": "^3.15.0", "jsonrepair": "^3.15.0",
+40 -5
View File
@@ -20,6 +20,7 @@ specifiers:
'@vitejs/plugin-react': ^5.1.1 '@vitejs/plugin-react': ^5.1.1
electron: ^43.0.0 electron: ^43.0.0
electron-builder: ^26.0.12 electron-builder: ^26.0.12
electron-updater: ^6.6.2
electron-vite: ^5.0.0 electron-vite: ^5.0.0
eslint: ^9.39.1 eslint: ^9.39.1
eslint-plugin-react: ^7.37.5 eslint-plugin-react: ^7.37.5
@@ -44,6 +45,7 @@ dependencies:
'@electron-toolkit/utils': 4.0.0_electron@43.1.0 '@electron-toolkit/utils': 4.0.0_electron@43.1.0
'@koromix/koffi-win32-x64': 3.1.0 '@koromix/koffi-win32-x64': 3.1.0
'@tanstack/react-virtual': 3.14.6_bokjwhiew3ov3ffvbmafuwoalq '@tanstack/react-virtual': 3.14.6_bokjwhiew3ov3ffvbmafuwoalq
electron-updater: 6.8.9
fs-extra: 11.3.2 fs-extra: 11.3.2
fzstd: 0.1.1 fzstd: 0.1.1
jsonrepair: 3.15.0 jsonrepair: 3.15.0
@@ -1705,7 +1707,6 @@ packages:
/argparse/2.0.1: /argparse/2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
dev: true
/array-buffer-byte-length/1.0.2: /array-buffer-byte-length/1.0.2:
resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==}
@@ -1894,6 +1895,16 @@ packages:
- supports-color - supports-color
dev: true dev: true
/builder-util-runtime/9.7.0:
resolution: {integrity: sha512-g/kR520giAFYkSXTzcmF3kqQq7wi8F6N6SzeDgZrqTBN+VHdmgWOyTdD1yD7AATDId/yXLvuP34CxW46/BwCdw==}
engines: {node: '>=12.0.0'}
dependencies:
debug: 4.4.3
sax: 1.4.3
transitivePeerDependencies:
- supports-color
dev: false
/builder-util/26.0.11: /builder-util/26.0.11:
resolution: {integrity: sha512-xNjXfsldUEe153h1DraD0XvDOpqGR0L5eKFkdReB7eFW5HqysDZFfly4rckda6y9dF39N3pkPlOblcfHKGw+uA==} resolution: {integrity: sha512-xNjXfsldUEe153h1DraD0XvDOpqGR0L5eKFkdReB7eFW5HqysDZFfly4rckda6y9dF39N3pkPlOblcfHKGw+uA==}
dependencies: dependencies:
@@ -2354,6 +2365,21 @@ packages:
resolution: {integrity: sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==} resolution: {integrity: sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==}
dev: true dev: true
/electron-updater/6.8.9:
resolution: {integrity: sha512-ZhVxM9iGONUpZGI1FxdMRgJjUFXi7AYGVa5PwKlO1tV1/4zDxQmfKpXOHVztKrd6L9rLcFjERvi1Mf2vxyTkig==}
dependencies:
builder-util-runtime: 9.7.0
fs-extra: 10.1.0
js-yaml: 4.1.1
lazy-val: 1.0.5
lodash.escaperegexp: 4.1.2
lodash.isequal: 4.5.0
semver: 7.7.3
tiny-typed-emitter: 2.1.0
transitivePeerDependencies:
- supports-color
dev: false
/electron-vite/5.0.0_vite@7.2.7: /electron-vite/5.0.0_vite@7.2.7:
resolution: {integrity: sha512-OHp/vjdlubNlhNkPkL/+3JD34ii5ov7M0GpuXEVdQeqdQ3ulvVR7Dg/rNBLfS5XPIFwgoBLDf9sjjrL+CuDyRQ==} resolution: {integrity: sha512-OHp/vjdlubNlhNkPkL/+3JD34ii5ov7M0GpuXEVdQeqdQ3ulvVR7Dg/rNBLfS5XPIFwgoBLDf9sjjrL+CuDyRQ==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
@@ -2874,7 +2900,6 @@ packages:
graceful-fs: 4.2.11 graceful-fs: 4.2.11
jsonfile: 6.2.0 jsonfile: 6.2.0
universalify: 2.0.1 universalify: 2.0.1
dev: true
/fs-extra/11.3.2: /fs-extra/11.3.2:
resolution: {integrity: sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==} resolution: {integrity: sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==}
@@ -3539,7 +3564,6 @@ packages:
hasBin: true hasBin: true
dependencies: dependencies:
argparse: 2.0.1 argparse: 2.0.1
dev: true
/jsesc/3.1.0: /jsesc/3.1.0:
resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}
@@ -3614,7 +3638,6 @@ packages:
/lazy-val/1.0.5: /lazy-val/1.0.5:
resolution: {integrity: sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==} resolution: {integrity: sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==}
dev: true
/levn/0.4.1: /levn/0.4.1:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
@@ -3631,6 +3654,15 @@ packages:
p-locate: 5.0.0 p-locate: 5.0.0
dev: true dev: true
/lodash.escaperegexp/4.1.2:
resolution: {integrity: sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==}
dev: false
/lodash.isequal/4.5.0:
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
dev: false
/lodash.merge/4.6.2: /lodash.merge/4.6.2:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
dev: true dev: true
@@ -4419,7 +4451,6 @@ packages:
/sax/1.4.3: /sax/1.4.3:
resolution: {integrity: sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==} resolution: {integrity: sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==}
dev: true
/scheduler/0.27.0: /scheduler/0.27.0:
resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==} resolution: {integrity: sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==}
@@ -4767,6 +4798,10 @@ packages:
semver: 5.7.2 semver: 5.7.2
dev: true dev: true
/tiny-typed-emitter/2.1.0:
resolution: {integrity: sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==}
dev: false
/tinyglobby/0.2.15: /tinyglobby/0.2.15:
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
+3 -2
View File
@@ -2,6 +2,7 @@ import { app, shell } from 'electron'
import fs from 'fs-extra' import fs from 'fs-extra'
import path from 'path' import path from 'path'
import type { AppLogEntry } from '../shared/app-log' import type { AppLogEntry } from '../shared/app-log'
import { isPackagedRuntime } from './runtime-mode'
const MAX_LOG_BYTES = 5 * 1024 * 1024 const MAX_LOG_BYTES = 5 * 1024 * 1024
const REDACTED_KEY = /(?:api[-_]?key|authorization|token|secret|password|database[-_]?key)/i const REDACTED_KEY = /(?:api[-_]?key|authorization|token|secret|password|database[-_]?key)/i
@@ -52,14 +53,14 @@ export class AppLogger {
this.rotateIfNeeded() this.rotateIfNeeded()
const record = { const record = {
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
mode: app.isPackaged ? 'packaged' : 'development', mode: isPackagedRuntime() ? 'packaged' : 'development',
level: entry.level, level: entry.level,
scope: String(entry.scope || 'app').slice(0, 80), scope: String(entry.scope || 'app').slice(0, 80),
message: String(entry.message || '').slice(0, 500), message: String(entry.message || '').slice(0, 500),
details: sanitize(entry.details || {}) details: sanitize(entry.details || {})
} }
fs.appendFileSync(this.logPath, `${JSON.stringify(record)}\n`, { encoding: 'utf8' }) fs.appendFileSync(this.logPath, `${JSON.stringify(record)}\n`, { encoding: 'utf8' })
if (!app.isPackaged) { if (!isPackagedRuntime()) {
const method = const method =
entry.level === 'error' entry.level === 'error'
? console.error ? console.error
+14
View File
@@ -76,6 +76,9 @@ import { installSafeConsole } from './safe-log'
import { agentHubService } from './services/agent-hub-service' import { agentHubService } from './services/agent-hub-service'
import { appLogger } from './app-logger' import { appLogger } from './app-logger'
import type { AppLogEntry } from '../shared/app-log' import type { AppLogEntry } from '../shared/app-log'
import { appUpdateService } from './services/app-update-service'
import { clearCache, getCacheSummary } from './services/cache-service'
import type { CacheClearScope } from './services/cache-service'
import { configureRecallArchive, RecallArchiveMonitor } from './services/recall-archive-service' import { configureRecallArchive, RecallArchiveMonitor } from './services/recall-archive-service'
import { VideoAssetService } from './video-asset-service' import { VideoAssetService } from './video-asset-service'
import { cancelExport, revealExport, runExport } from './export-service' import { cancelExport, revealExport, runExport } from './export-service'
@@ -349,6 +352,17 @@ app.whenReady().then(async () => {
ipcMain.handle('app-log:write', (_, entry: AppLogEntry) => appLogger.write(entry)) ipcMain.handle('app-log:write', (_, entry: AppLogEntry) => appLogger.write(entry))
ipcMain.handle('app-log:getPath', () => appLogger.logPath) ipcMain.handle('app-log:getPath', () => appLogger.logPath)
ipcMain.handle('app-log:reveal', () => appLogger.reveal()) ipcMain.handle('app-log:reveal', () => appLogger.reveal())
ipcMain.handle('app-update:getState', () => appUpdateService.getState())
ipcMain.handle('app-update:check', () => appUpdateService.check())
ipcMain.handle('app-update:download', () => appUpdateService.download())
ipcMain.handle('app-update:install', () => appUpdateService.install())
ipcMain.handle('cache:getSummary', () => getCacheSummary())
ipcMain.handle('cache:clear', async (_, scope: CacheClearScope) => {
const allowedScopes: CacheClearScope[] = ['bootstrap', 'electron', 'all']
if (!allowedScopes.includes(scope)) return getCacheSummary()
imageDecryptService = null
return clearCache(scope)
})
ipcMain.handle('db:init', async (_, key: string) => { ipcMain.handle('db:init', async (_, key: string) => {
if (dbInitInFlight) return dbInitInFlight if (dbInitInFlight) return dbInitInFlight
+12
View File
@@ -0,0 +1,12 @@
import { app } from 'electron'
import { existsSync } from 'fs'
import { join } from 'path'
export function isPackagedRuntime(): boolean {
if (app.isPackaged) return true
return (
existsSync(join(process.resourcesPath, 'app.asar')) &&
existsSync(join(process.resourcesPath, 'app-update.yml'))
)
}
+3 -2
View File
@@ -15,6 +15,7 @@ import type {
import type { AppSettings } from './settings-store' import type { AppSettings } from './settings-store'
import { generateAgentGroupReport } from './agent-group-report-service' import { generateAgentGroupReport } from './agent-group-report-service'
import { AIProviderService } from './ai-provider-service' import { AIProviderService } from './ai-provider-service'
import { isPackagedRuntime } from '../runtime-mode'
import { import {
getGroupSnapshot, getGroupSnapshot,
isReady, isReady,
@@ -68,7 +69,7 @@ const agentAIProvider = new AIProviderService()
function resolveBundledBinary( function resolveBundledBinary(
resourceSegments: string[], resourceSegments: string[],
executable: string, executable: string,
packaged = app.isPackaged, packaged = isPackagedRuntime(),
platform = process.platform, platform = process.platform,
arch = process.arch arch = process.arch
): string { ): string {
@@ -80,7 +81,7 @@ function resolveBundledBinary(
} }
export function resolveWechatConnectorBinaryPath( export function resolveWechatConnectorBinaryPath(
packaged = app.isPackaged, packaged = isPackagedRuntime(),
platform = process.platform, platform = process.platform,
arch = process.arch arch = process.arch
): string { ): string {
+120
View File
@@ -0,0 +1,120 @@
import { app, BrowserWindow } from 'electron'
import { autoUpdater, type ProgressInfo } from 'electron-updater'
import type { AppUpdateCheckResult, AppUpdateState } from '../../shared/app-update'
import { isPackagedRuntime } from '../runtime-mode'
export class AppUpdateService {
private state: AppUpdateState = {
status: 'idle',
currentVersion: app.getVersion()
}
constructor() {
autoUpdater.autoDownload = false
autoUpdater.autoInstallOnAppQuit = true
autoUpdater.on('checking-for-update', () => this.setState({ status: 'checking' }))
autoUpdater.on('update-available', (info) =>
this.setState({ status: 'available', version: info.version, message: '发现新版本' })
)
autoUpdater.on('update-not-available', () =>
this.setState({ status: 'not-available', message: '当前已是最新版本' })
)
autoUpdater.on('download-progress', (progress: ProgressInfo) =>
this.setState({
status: 'downloading',
percent: progress.percent,
transferred: progress.transferred,
total: progress.total,
bytesPerSecond: progress.bytesPerSecond
})
)
autoUpdater.on('update-downloaded', (info) =>
this.setState({
status: 'downloaded',
version: info.version,
percent: 100,
message: '更新已下载'
})
)
autoUpdater.on('error', (error) =>
this.setState({ status: 'error', message: error.message || '更新失败' })
)
}
getState(): AppUpdateState {
return { ...this.state, currentVersion: app.getVersion() }
}
async check(): Promise<AppUpdateCheckResult> {
if (!isPackagedRuntime()) {
const state = this.setState({
status: 'unsupported',
message: '开发模式不执行安装包更新,请在正式安装包中检查更新'
})
return { success: false, state }
}
try {
const result = await autoUpdater.checkForUpdates()
if (result?.updateInfo.version) {
this.setState({
status: 'available',
version: result.updateInfo.version,
message: '发现新版本'
})
}
return { success: true, state: this.getState() }
} catch (error) {
const state = this.setState({
status: 'error',
message: error instanceof Error ? error.message : String(error)
})
return { success: false, state }
}
}
async download(): Promise<AppUpdateCheckResult> {
if (!isPackagedRuntime()) {
const state = this.setState({ status: 'unsupported', message: '开发模式不能下载更新' })
return { success: false, state }
}
try {
this.setState({ status: 'downloading', percent: 0 })
await autoUpdater.downloadUpdate()
return { success: true, state: this.getState() }
} catch (error) {
const state = this.setState({
status: 'error',
message: error instanceof Error ? error.message : String(error)
})
return { success: false, state }
}
}
install(): { success: boolean; error?: string } {
if (this.state.status !== 'downloaded') {
return { success: false, error: '更新包尚未下载完成' }
}
autoUpdater.quitAndInstall()
return { success: true }
}
handleState(callback: (state: AppUpdateState) => void): () => void {
this.listeners.add(callback)
callback(this.getState())
return () => this.listeners.delete(callback)
}
private listeners = new Set<(state: AppUpdateState) => void>()
private setState(patch: Partial<AppUpdateState>): AppUpdateState {
this.state = { ...this.state, ...patch, currentVersion: app.getVersion() }
const state = this.getState()
for (const window of BrowserWindow.getAllWindows()) {
if (!window.isDestroyed()) window.webContents.send('app-update:state', state)
}
for (const listener of this.listeners) listener(state)
return state
}
}
export const appUpdateService = new AppUpdateService()
+7
View File
@@ -369,6 +369,13 @@ export function flushBootstrapCacheWritesSync(): void {
} }
} }
export function clearBootstrapCache(): void {
for (const timer of writeTimers.values()) clearTimeout(timer)
writeTimers.clear()
writeQueues.clear()
memoryCache.clear()
}
export function saveCachedMessages( export function saveCachedMessages(
accountRoot: string, accountRoot: string,
userMd5: string, userMd5: string,
+73
View File
@@ -0,0 +1,73 @@
import { app, session } from 'electron'
import fs from 'fs-extra'
import path from 'path'
import { clearBootstrapCache } from './bootstrap-cache'
import type { CacheClearScope, CacheSummary, CacheSummaryItem } from '../../shared/cache'
export type { CacheClearScope } from '../../shared/cache'
const BOOTSTRAP_CACHE_DIR = path.join(app.getPath('userData'), 'cache', 'bootstrap')
function inspectDirectory(directory: string): { sizeBytes: number; fileCount: number } {
if (!fs.existsSync(directory)) return { sizeBytes: 0, fileCount: 0 }
let sizeBytes = 0
let fileCount = 0
const visit = (current: string): void => {
let entries: fs.Dirent[]
try {
entries = fs.readdirSync(current, { withFileTypes: true })
} catch {
return
}
for (const entry of entries) {
const target = path.join(current, entry.name)
if (entry.isDirectory()) {
visit(target)
} else if (entry.isFile()) {
try {
sizeBytes += fs.statSync(target).size
fileCount += 1
} catch {
// A cache file can disappear while it is being inspected.
}
}
}
}
visit(directory)
return { sizeBytes, fileCount }
}
export function getCacheSummary(): CacheSummary {
const bootstrap = inspectDirectory(BOOTSTRAP_CACHE_DIR)
const electron = inspectDirectory(path.join(app.getPath('userData'), 'Cache'))
const items: CacheSummaryItem[] = [
{
id: 'bootstrap',
label: '启动与聊天缓存',
description: '联系人、头像、群成员和最近聊天记录的本地副本。',
...bootstrap
},
{
id: 'electron',
label: '应用临时缓存',
description: 'Electron 页面资源缓存,清理后会自动重新生成。',
...electron
}
]
return {
items,
totalBytes: items.reduce((total, item) => total + item.sizeBytes, 0),
updatedAt: Date.now()
}
}
export async function clearCache(scope: CacheClearScope): Promise<CacheSummary> {
if (scope === 'bootstrap' || scope === 'all') {
clearBootstrapCache()
await fs.remove(BOOTSTRAP_CACHE_DIR)
}
if (scope === 'electron' || scope === 'all') {
await session.defaultSession.clearCache()
}
return getCacheSummary()
}
+7 -1
View File
@@ -32,6 +32,9 @@ export interface AppSettings {
debugEnabled: boolean debugEnabled: boolean
autoLogin: boolean autoLogin: boolean
autoLoginPreferenceSet: boolean autoLoginPreferenceSet: boolean
appearanceTheme: 'system' | 'light' | 'dark'
compactMode: boolean
showStartupProgress: boolean
} }
function getDefaultDbRoot(): string { function getDefaultDbRoot(): string {
@@ -112,7 +115,10 @@ const DEFAULT_SETTINGS: AppSettings = {
.trim() .trim()
.toLowerCase() .toLowerCase()
), ),
autoLoginPreferenceSet: false autoLoginPreferenceSet: false,
appearanceTheme: 'system',
compactMode: false,
showStartupProgress: true
} }
const SETTINGS_FILE = path.join( const SETTINGS_FILE = path.join(
+2 -1
View File
@@ -1,6 +1,7 @@
import { app, shell } from 'electron' import { app, shell } from 'electron'
import { existsSync, promises as fs } from 'fs' import { existsSync, promises as fs } from 'fs'
import { dirname, join } from 'path' import { dirname, join } from 'path'
import { isPackagedRuntime } from '../runtime-mode'
const SKILL_RELATIVE_PATH = join('skill', 'wechatexplorer-reader', 'SKILL.md') const SKILL_RELATIVE_PATH = join('skill', 'wechatexplorer-reader', 'SKILL.md')
const GITHUB_URL = const GITHUB_URL =
@@ -23,7 +24,7 @@ function getSkillCandidates(): { path: string; source: 'development' | 'bundled'
join(dirname(app.getAppPath()), SKILL_RELATIVE_PATH), join(dirname(app.getAppPath()), SKILL_RELATIVE_PATH),
join(dirname(process.execPath), 'resources', SKILL_RELATIVE_PATH) join(dirname(process.execPath), 'resources', SKILL_RELATIVE_PATH)
] ]
return app.isPackaged return isPackagedRuntime()
? bundledPaths.map((path) => ({ path, source: 'bundled' as const })) ? bundledPaths.map((path) => ({ path, source: 'bundled' as const }))
: [ : [
{ path: developmentPath, source: 'development' as const }, { path: developmentPath, source: 'development' as const },
+2 -1
View File
@@ -2,6 +2,7 @@ import { app } from 'electron'
import { join } from 'path' import { join } from 'path'
import { existsSync } from 'fs' import { existsSync } from 'fs'
import { Wcdb4Client } from './wcdb4-client' import { Wcdb4Client } from './wcdb4-client'
import { isPackagedRuntime } from './runtime-mode'
export class VoiceService { export class VoiceService {
private wcdb4Client: Wcdb4Client private wcdb4Client: Wcdb4Client
@@ -101,7 +102,7 @@ export class VoiceService {
private async decodeSilkToPcm(silkData: Buffer, sampleRate: number): Promise<Buffer | null> { private async decodeSilkToPcm(silkData: Buffer, sampleRate: number): Promise<Buffer | null> {
try { try {
let wasmPath: string let wasmPath: string
if (app.isPackaged) { if (isPackagedRuntime()) {
wasmPath = join( wasmPath = join(
process.resourcesPath, process.resourcesPath,
'app.asar.unpacked', 'app.asar.unpacked',
+21
View File
@@ -39,6 +39,8 @@ import type {
} from '../shared/image-insight' } from '../shared/image-insight'
import type { AgentHubActionResult, AgentHubLogEntry, AgentHubStatus } from '../shared/agent-hub' import type { AgentHubActionResult, AgentHubLogEntry, AgentHubStatus } from '../shared/agent-hub'
import type { AppLogEntry } from '../shared/app-log' import type { AppLogEntry } from '../shared/app-log'
import type { AppUpdateCheckResult, AppUpdateState } from '../shared/app-update'
import type { CacheSummary } from '../shared/cache'
import type { ExportRequest, ExportJobProgress, ExportResult } from '../shared/export' import type { ExportRequest, ExportJobProgress, ExportResult } from '../shared/export'
export type ParsedContent = export type ParsedContent =
@@ -103,6 +105,13 @@ declare global {
writeAppLog: (entry: AppLogEntry) => Promise<void> writeAppLog: (entry: AppLogEntry) => Promise<void>
getAppLogPath: () => Promise<string> getAppLogPath: () => Promise<string>
revealAppLog: () => Promise<void> revealAppLog: () => Promise<void>
getAppUpdateState: () => Promise<AppUpdateState>
checkAppUpdate: () => Promise<AppUpdateCheckResult>
downloadAppUpdate: () => Promise<AppUpdateCheckResult>
installAppUpdate: () => Promise<{ success: boolean; error?: string }>
onAppUpdateState: (callback: (state: AppUpdateState) => void) => () => void
getCacheSummary: () => Promise<CacheSummary>
clearCache: (scope: 'bootstrap' | 'electron' | 'all') => Promise<CacheSummary>
initDb: ( initDb: (
key: string key: string
) => Promise<boolean | { success: boolean; error?: string; monitoring?: boolean }> ) => Promise<boolean | { success: boolean; error?: string; monitoring?: boolean }>
@@ -255,6 +264,9 @@ declare global {
debugEnabled: boolean debugEnabled: boolean
autoLogin: boolean autoLogin: boolean
autoLoginPreferenceSet: boolean autoLoginPreferenceSet: boolean
appearanceTheme: 'system' | 'light' | 'dark'
compactMode: boolean
showStartupProgress: boolean
imageXorKey: string imageXorKey: string
imageAesKey: string imageAesKey: string
} }
@@ -283,6 +295,9 @@ declare global {
debugEnabled: boolean debugEnabled: boolean
autoLogin: boolean autoLogin: boolean
autoLoginPreferenceSet: boolean autoLoginPreferenceSet: boolean
appearanceTheme: 'system' | 'light' | 'dark'
compactMode: boolean
showStartupProgress: boolean
imageXorKey: string imageXorKey: string
imageAesKey: string imageAesKey: string
} }
@@ -299,6 +314,9 @@ declare global {
debugEnabled: boolean debugEnabled: boolean
autoLogin: boolean autoLogin: boolean
autoLoginPreferenceSet: boolean autoLoginPreferenceSet: boolean
appearanceTheme: 'system' | 'light' | 'dark'
compactMode: boolean
showStartupProgress: boolean
imageXorKey: string imageXorKey: string
imageAesKey: string imageAesKey: string
}> }>
@@ -313,6 +331,9 @@ declare global {
debugEnabled: boolean debugEnabled: boolean
autoLogin: boolean autoLogin: boolean
autoLoginPreferenceSet: boolean autoLoginPreferenceSet: boolean
appearanceTheme: 'system' | 'light' | 'dark'
compactMode: boolean
showStartupProgress: boolean
imageXorKey: string imageXorKey: string
imageAesKey: string imageAesKey: string
} }
+15
View File
@@ -17,6 +17,8 @@ import type {
} from '../shared/image-insight' } from '../shared/image-insight'
import type { AgentHubLogEntry, AgentHubStatus } from '../shared/agent-hub' import type { AgentHubLogEntry, AgentHubStatus } from '../shared/agent-hub'
import type { AppLogEntry } from '../shared/app-log' import type { AppLogEntry } from '../shared/app-log'
import type { AppUpdateState } from '../shared/app-update'
import type { CacheSummary } from '../shared/cache'
import type { ExportRequest, ExportJobProgress } from '../shared/export' import type { ExportRequest, ExportJobProgress } from '../shared/export'
// 渲染器的自定义 API // 渲染器的自定义 API
@@ -24,6 +26,19 @@ const api = {
writeAppLog: (entry: AppLogEntry) => ipcRenderer.invoke('app-log:write', entry), writeAppLog: (entry: AppLogEntry) => ipcRenderer.invoke('app-log:write', entry),
getAppLogPath: () => ipcRenderer.invoke('app-log:getPath'), getAppLogPath: () => ipcRenderer.invoke('app-log:getPath'),
revealAppLog: () => ipcRenderer.invoke('app-log:reveal'), revealAppLog: () => ipcRenderer.invoke('app-log:reveal'),
getAppUpdateState: (): Promise<AppUpdateState> => ipcRenderer.invoke('app-update:getState'),
checkAppUpdate: () => ipcRenderer.invoke('app-update:check'),
downloadAppUpdate: () => ipcRenderer.invoke('app-update:download'),
installAppUpdate: () => ipcRenderer.invoke('app-update:install'),
onAppUpdateState: (callback: (state: AppUpdateState) => void) => {
const listener = (_event: Electron.IpcRendererEvent, state: AppUpdateState): void =>
callback(state)
ipcRenderer.on('app-update:state', listener)
return () => ipcRenderer.removeListener('app-update:state', listener)
},
getCacheSummary: (): Promise<CacheSummary> => ipcRenderer.invoke('cache:getSummary'),
clearCache: (scope: 'bootstrap' | 'electron' | 'all'): Promise<CacheSummary> =>
ipcRenderer.invoke('cache:clear', scope),
initDb: (key: string) => ipcRenderer.invoke('db:init', key), initDb: (key: string) => ipcRenderer.invoke('db:init', key),
getBootstrapCache: () => ipcRenderer.invoke('db:getBootstrapCache'), getBootstrapCache: () => ipcRenderer.invoke('db:getBootstrapCache'),
getStartupCache: () => ipcRenderer.invoke('db:getStartupCache'), getStartupCache: () => ipcRenderer.invoke('db:getStartupCache'),
+24 -1
View File
@@ -256,6 +256,17 @@ function App(): React.ReactElement {
const [bootState, setBootState] = useState<'loading' | 'connecting' | 'login'>('loading') const [bootState, setBootState] = useState<'loading' | 'connecting' | 'login'>('loading')
const [autoConnectSource, setAutoConnectSource] = useState<'env' | 'saved' | null>(null) const [autoConnectSource, setAutoConnectSource] = useState<'env' | 'saved' | null>(null)
const [startupProgress, setStartupProgress] = useState<StartupProgress | null>(null) const [startupProgress, setStartupProgress] = useState<StartupProgress | null>(null)
const [appearanceSettings, setAppearanceSettings] = React.useState<{
theme: 'system' | 'light' | 'dark'
compactMode: boolean
showStartupProgress: boolean
}>({ theme: 'system', compactMode: false, showStartupProgress: true })
const handleAppearanceChange = React.useCallback(
(settings: { theme: 'system' | 'light' | 'dark'; compactMode: boolean }) => {
setAppearanceSettings((current) => ({ ...current, ...settings }))
},
[]
)
const currentGroupSnapshotRef = React.useRef<GroupSnapshot | null>(null) const currentGroupSnapshotRef = React.useRef<GroupSnapshot | null>(null)
const syntheticGroupMessagesRef = React.useRef<Record<string, Message[]>>({}) const syntheticGroupMessagesRef = React.useRef<Record<string, Message[]>>({})
const groupMemberMetaRef = React.useRef<Record<string, Map<string, GroupMemberMeta>>>({}) const groupMemberMetaRef = React.useRef<Record<string, Map<string, GroupMemberMeta>>>({})
@@ -268,6 +279,15 @@ function App(): React.ReactElement {
const timer = window.setTimeout(() => setReportNotice(''), 3200) const timer = window.setTimeout(() => setReportNotice(''), 3200)
return () => window.clearTimeout(timer) return () => window.clearTimeout(timer)
}, [reportNotice]) }, [reportNotice])
React.useEffect(() => {
void window.api.getSettings().then((result) => {
setAppearanceSettings({
theme: result.settings.appearanceTheme,
compactMode: result.settings.compactMode,
showStartupProgress: result.settings.showStartupProgress
})
})
}, [])
React.useEffect(() => { React.useEffect(() => {
const loadAIConfig = async (): Promise<void> => { const loadAIConfig = async (): Promise<void> => {
try { try {
@@ -1493,6 +1513,7 @@ function App(): React.ReactElement {
onAIRuntimeChange={(config: AIRuntimeModelConfig) => setAiModelConfig(config)} onAIRuntimeChange={(config: AIRuntimeModelConfig) => setAiModelConfig(config)}
onNotice={setReportNotice} onNotice={setReportNotice}
onOpenSettings={openSettings} onOpenSettings={openSettings}
onAppearanceChange={handleAppearanceChange}
/> />
) )
case 'search': case 'search':
@@ -1579,7 +1600,7 @@ function App(): React.ReactElement {
: '使用上次安全保存的密钥' : '使用上次安全保存的密钥'
: 'WechatExplorer') : 'WechatExplorer')
return ( return (
<div className="boot-splash"> <div className={`boot-splash ${appearanceSettings.showStartupProgress ? '' : 'is-quiet'}`}>
<div className="boot-splash-spinner" aria-hidden /> <div className="boot-splash-spinner" aria-hidden />
<div className="boot-splash-title">{title}</div> <div className="boot-splash-title">{title}</div>
<div className="boot-splash-subtitle">{subtitle}</div> <div className="boot-splash-subtitle">{subtitle}</div>
@@ -1630,6 +1651,8 @@ function App(): React.ReactElement {
dbReady={isDatabaseConnected} dbReady={isDatabaseConnected}
onPageChange={handlePageChange} onPageChange={handlePageChange}
onOpenSettings={openSettings} onOpenSettings={openSettings}
appearanceTheme={appearanceSettings.theme}
compactMode={appearanceSettings.compactMode}
> >
{reportNotice && <div className="app-toast">{reportNotice}</div>} {reportNotice && <div className="app-toast">{reportNotice}</div>}
{renderCurrentWorkspace()} {renderCurrentWorkspace()}
@@ -17,6 +17,8 @@ interface AppShellProps {
dbReady: boolean dbReady: boolean
onPageChange: (page: AppPage) => void onPageChange: (page: AppPage) => void
onOpenSettings: () => void onOpenSettings: () => void
appearanceTheme?: 'system' | 'light' | 'dark'
compactMode?: boolean
children: React.ReactNode children: React.ReactNode
} }
@@ -34,12 +36,14 @@ export function AppShell({
dbReady, dbReady,
onPageChange, onPageChange,
onOpenSettings, onOpenSettings,
appearanceTheme = 'system',
compactMode = false,
children children
}: AppShellProps): React.ReactElement { }: AppShellProps): React.ReactElement {
const activeItem = PRIMARY_NAV_ITEMS.find((item) => item.id === activePage) const activeItem = PRIMARY_NAV_ITEMS.find((item) => item.id === activePage)
return ( return (
<div className="app-shell"> <div className={`app-shell theme-${appearanceTheme} ${compactMode ? 'is-compact' : ''}`}>
<aside className="app-primary-rail"> <aside className="app-primary-rail">
<BrandLogo /> <BrandLogo />
<PrimaryNavigation activePage={activePage} onPageChange={onPageChange} /> <PrimaryNavigation activePage={activePage} onPageChange={onPageChange} />
@@ -8,6 +8,9 @@ import { ImageDecryptionPage } from './pages/ImageDecryptionPage'
import { AIModelPage } from './pages/AIModelPage' import { AIModelPage } from './pages/AIModelPage'
import { RecallProtectionPage } from './pages/RecallProtectionPage' import { RecallProtectionPage } from './pages/RecallProtectionPage'
import { AdvancedPage } from './pages/AdvancedPage' import { AdvancedPage } from './pages/AdvancedPage'
import { CacheCleanupPage } from './pages/CacheCleanupPage'
import { AppearancePage } from './pages/AppearancePage'
import { AboutPage } from './pages/AboutPage'
import type { Contact } from '../../../../shared/types' import type { Contact } from '../../../../shared/types'
import type { AIRuntimeModelConfig } from '../../../../shared/ai-provider' import type { AIRuntimeModelConfig } from '../../../../shared/ai-provider'
@@ -25,7 +28,8 @@ export function SettingsWorkspace({
onReturnToLogin, onReturnToLogin,
onAIRuntimeChange, onAIRuntimeChange,
onNotice, onNotice,
onOpenSettings onOpenSettings,
onAppearanceChange
}: { }: {
selectedCategory: SettingsCategoryId selectedCategory: SettingsCategoryId
onCategoryChange: (id: SettingsCategoryId) => void onCategoryChange: (id: SettingsCategoryId) => void
@@ -41,6 +45,7 @@ export function SettingsWorkspace({
onAIRuntimeChange: (config: AIRuntimeModelConfig) => void onAIRuntimeChange: (config: AIRuntimeModelConfig) => void
onNotice: (message: string) => void onNotice: (message: string) => void
onOpenSettings: () => void onOpenSettings: () => void
onAppearanceChange: (settings: { theme: 'system' | 'light' | 'dark'; compactMode: boolean }) => void
}): React.ReactElement { }): React.ReactElement {
return ( return (
<div className="settings-workspace"> <div className="settings-workspace">
@@ -89,13 +94,25 @@ export function SettingsWorkspace({
<div className={`settings-page-panel ${selectedCategory === 'advanced' ? 'active' : ''}`}> <div className={`settings-page-panel ${selectedCategory === 'advanced' ? 'active' : ''}`}>
<AdvancedPage onNotice={onNotice} /> <AdvancedPage onNotice={onNotice} />
</div> </div>
<div className={`settings-page-panel ${selectedCategory === 'cache-cleanup' ? 'active' : ''}`}>
<CacheCleanupPage onNotice={onNotice} />
</div>
<div className={`settings-page-panel ${selectedCategory === 'appearance' ? 'active' : ''}`}>
<AppearancePage onNotice={onNotice} onAppearanceChange={onAppearanceChange} />
</div>
<div className={`settings-page-panel ${selectedCategory === 'about' ? 'active' : ''}`}>
<AboutPage onNotice={onNotice} />
</div>
{![ {![
'account-database', 'account-database',
'database-key', 'database-key',
'image-key', 'image-key',
'ai-model', 'ai-model',
'recall-protection', 'recall-protection',
'advanced' 'advanced',
'cache-cleanup',
'appearance',
'about'
].includes(selectedCategory) && ( ].includes(selectedCategory) && (
<div className="settings-page-panel active"> <div className="settings-page-panel active">
<SettingsEmptyState label={SETTINGS_CATEGORY_LABELS[selectedCategory]} /> <SettingsEmptyState label={SETTINGS_CATEGORY_LABELS[selectedCategory]} />
@@ -0,0 +1,91 @@
import { useEffect, useMemo, useState } from 'react'
import type { AppUpdateState } from '../../../../../shared/app-update'
const REPOSITORY_URL = 'https://github.com/Wxw-Gu/WechatExplorer'
const RELEASES_URL = `${REPOSITORY_URL}/releases`
function formatBytes(value?: number): string {
if (!value) return ''
if (value < 1024 * 1024) return `${Math.round(value / 1024)} KB/s`
return `${(value / 1024 / 1024).toFixed(1)} MB/s`
}
export function AboutPage({ onNotice }: { onNotice: (message: string) => void }): React.ReactElement {
const [update, setUpdate] = useState<AppUpdateState>({ status: 'idle', currentVersion: '读取中...' })
const [busy, setBusy] = useState(false)
useEffect(() => {
let active = true
void window.api.getAppUpdateState().then((state) => active && setUpdate(state))
const unsubscribe = window.api.onAppUpdateState((state) => {
if (active) setUpdate(state)
})
return () => {
active = false
unsubscribe()
}
}, [])
const action = useMemo(() => {
if (update.status === 'downloaded') return '重启并安装'
if (update.status === 'available') return '下载更新'
if (update.status === 'checking' || update.status === 'downloading') return '处理中...'
return '检查更新'
}, [update.status])
const runUpdate = async (): Promise<void> => {
setBusy(true)
try {
if (update.status === 'downloaded') {
const result = await window.api.installAppUpdate()
if (!result.success) onNotice(result.error || '更新安装失败')
} else if (update.status === 'available') {
await window.api.downloadAppUpdate()
} else {
await window.api.checkAppUpdate()
}
} finally {
setBusy(false)
}
}
return (
<div className="settings-page">
<header className="settings-page-header">
<div>
<h1></h1>
<p>WechatExplorer </p>
</div>
</header>
<div className="settings-page-scroll">
<div className="settings-page-content">
<section className="settings-card about-identity-card">
<div><span className="settings-card-kicker"></span><strong>WechatExplorer</strong><small>v{update.currentVersion}</small></div>
<a href={REPOSITORY_URL} target="_blank" rel="noreferrer">GitHub </a>
</section>
<h2 className="settings-section-heading"></h2>
<section className={`settings-card update-card status-${update.status}`}>
<div className="update-card-copy">
<strong>{update.status === 'available' || update.status === 'downloaded' ? `发现 v${update.version}` : update.message || '检查 GitHub Releases 获取最新版本'}</strong>
<span>
{update.status === 'downloading'
? `正在下载 ${Math.round(update.percent || 0)}% · ${formatBytes(update.bytesPerSecond)}`
: '会根据当前系统和 CPU 自动选择对应安装包,安装前会等待你的确认。'}
</span>
{update.status === 'downloading' && <div className="update-progress"><i style={{ width: `${update.percent || 0}%` }} /></div>}
</div>
<button type="button" className="settings-primary-button" disabled={busy || update.status === 'checking' || update.status === 'downloading'} onClick={() => void runUpdate()}>{action}</button>
</section>
<h2 className="settings-section-heading"></h2>
<section className="settings-card about-links-card">
<a href={RELEASES_URL} target="_blank" rel="noreferrer"></a>
<button type="button" onClick={() => void window.api.revealAppLog()}></button>
</section>
<p className="settings-footnote"> AI </p>
</div>
</div>
</div>
)
}
@@ -0,0 +1,84 @@
import { useEffect, useState } from 'react'
export type AppearanceTheme = 'system' | 'light' | 'dark'
export function AppearancePage({
onNotice,
onAppearanceChange
}: {
onNotice: (message: string) => void
onAppearanceChange: (settings: { theme: AppearanceTheme; compactMode: boolean }) => void
}): React.ReactElement {
const [theme, setTheme] = useState<AppearanceTheme>('system')
const [compactMode, setCompactMode] = useState(false)
const [showStartupProgress, setShowStartupProgress] = useState(true)
useEffect(() => {
let active = true
void window.api.getSettings().then((result) => {
if (!active) return
setTheme(result.settings.appearanceTheme)
setCompactMode(result.settings.compactMode)
setShowStartupProgress(result.settings.showStartupProgress)
onAppearanceChange({ theme: result.settings.appearanceTheme, compactMode: result.settings.compactMode })
})
return () => {
active = false
}
}, [onAppearanceChange])
const save = async (patch: {
appearanceTheme?: AppearanceTheme
compactMode?: boolean
showStartupProgress?: boolean
}): Promise<void> => {
const result = await window.api.setSettings(patch)
setTheme(result.settings.appearanceTheme)
setCompactMode(result.settings.compactMode)
setShowStartupProgress(result.settings.showStartupProgress)
onAppearanceChange({ theme: result.settings.appearanceTheme, compactMode: result.settings.compactMode })
onNotice('外观设置已保存')
}
return (
<div className="settings-page">
<header className="settings-page-header">
<div>
<h1></h1>
<p></p>
</div>
</header>
<div className="settings-page-scroll">
<div className="settings-page-content">
<h2 className="settings-section-heading"></h2>
<section className="settings-card settings-option-card">
<div className="settings-choice-grid">
{([
['system', '跟随系统', '根据 macOS 或 Windows 外观自动切换'],
['light', '浅色', '保持当前清爽的浅色工作区'],
['dark', '深色', '降低夜间浏览时的亮度']
] as const).map(([value, label, hint]) => (
<label className={`settings-choice ${theme === value ? 'active' : ''}`} key={value}>
<input type="radio" name="appearance-theme" checked={theme === value} onChange={() => void save({ appearanceTheme: value })} />
<span><b>{label}</b><small>{hint}</small></span>
</label>
))}
</div>
</section>
<h2 className="settings-section-heading"></h2>
<section className="settings-card settings-toggle-list">
<label className="settings-toggle-row">
<span><b></b><small></small></span>
<input type="checkbox" checked={compactMode} onChange={(event) => void save({ compactMode: event.target.checked })} />
</label>
<label className="settings-toggle-row">
<span><b></b><small></small></span>
<input type="checkbox" checked={showStartupProgress} onChange={(event) => void save({ showStartupProgress: event.target.checked })} />
</label>
</section>
</div>
</div>
</div>
)
}
@@ -0,0 +1,112 @@
import { useCallback, useEffect, useState } from 'react'
import type { CacheSummary } from '../../../../../shared/cache'
const SEARCH_CACHE_KEYS = ['wxe_ai_search_cache_v8', 'wxe_ai_search_history_v1', 'wxe_export_tasks']
function formatBytes(value: number): string {
if (value < 1024) return `${value} B`
if (value < 1024 * 1024) return `${(value / 1024).toFixed(1)} KB`
if (value < 1024 * 1024 * 1024) return `${(value / 1024 / 1024).toFixed(1)} MB`
return `${(value / 1024 / 1024 / 1024).toFixed(1)} GB`
}
export function CacheCleanupPage({ onNotice }: { onNotice: (message: string) => void }): React.ReactElement {
const [summary, setSummary] = useState<CacheSummary | null>(null)
const [busyScope, setBusyScope] = useState<'bootstrap' | 'electron' | 'all' | 'local' | null>(null)
const refresh = useCallback(async (): Promise<void> => {
setSummary(await window.api.getCacheSummary())
}, [])
useEffect(() => {
void refresh()
}, [refresh])
const clearLocal = (): void => {
setBusyScope('local')
for (const key of SEARCH_CACHE_KEYS) localStorage.removeItem(key)
setBusyScope(null)
onNotice('已清理检索和导出本地缓存')
}
const clear = async (scope: 'bootstrap' | 'electron' | 'all'): Promise<void> => {
setBusyScope(scope)
try {
if (scope === 'all') {
for (const key of SEARCH_CACHE_KEYS) localStorage.removeItem(key)
}
setSummary(await window.api.clearCache(scope))
onNotice(scope === 'all' ? '已清理全部可恢复缓存和检索记录' : '缓存已清理')
} finally {
setBusyScope(null)
}
}
return (
<div className="settings-page">
<header className="settings-page-header">
<div>
<h1></h1>
<p></p>
</div>
<button type="button" className="settings-header-action" onClick={() => void refresh()}>
</button>
</header>
<div className="settings-page-scroll">
<div className="settings-page-content">
<section className="settings-card cache-overview-card">
<div>
<span className="settings-card-kicker"></span>
<strong>{formatBytes(summary?.totalBytes || 0)}</strong>
<small></small>
</div>
<button
type="button"
className="settings-danger-button"
disabled={busyScope !== null}
onClick={() => void clear('all')}
>
{busyScope === 'all' ? '清理中...' : '清理全部'}
</button>
</section>
<h2 className="settings-section-heading"></h2>
<div className="settings-cache-list">
{summary?.items.map((item) => (
<section className="settings-card settings-cache-item" key={item.id}>
<div>
<h3>{item.label}</h3>
<p>{item.description}</p>
<small>{formatBytes(item.sizeBytes)} · {item.fileCount} </small>
</div>
<button
type="button"
disabled={busyScope !== null}
onClick={() => void clear(item.id)}
>
{busyScope === item.id ? '清理中...' : '清理'}
</button>
</section>
))}
<section className="settings-card settings-cache-item">
<div>
<h3></h3>
<p></p>
<small></small>
</div>
<button type="button" disabled={busyScope !== null} onClick={clearLocal}>
{busyScope === 'local' ? '清理中...' : '清理'}
</button>
</section>
</div>
<div className="settings-inline-note">
<strong></strong>
<span></span>
</div>
</div>
</div>
</div>
)
}
+2
View File
@@ -14,3 +14,5 @@
@use './search'; @use './search';
@use './archive'; @use './archive';
@use './settings-advanced'; @use './settings-advanced';
@use './settings-preferences';
@use './theme';
@@ -0,0 +1,334 @@
.settings-header-action,
.settings-primary-button,
.settings-danger-button,
.settings-cache-item > button,
.about-links-card button {
border: 1px solid var(--wxex-border);
border-radius: var(--wxex-radius-sm);
background: var(--wxex-bg-elevated);
color: var(--wxex-text-primary);
cursor: pointer;
font: 12px/18px var(--wxex-font);
padding: 8px 12px;
&:hover:not(:disabled) {
border-color: var(--wxex-brand);
color: var(--wxex-brand);
}
&:disabled {
cursor: not-allowed;
opacity: 0.55;
}
}
.settings-primary-button {
border-color: var(--wxex-brand);
background: var(--wxex-brand);
color: #fff;
font-weight: 600;
&:hover:not(:disabled) {
background: var(--wxex-brand-hover);
color: #fff;
}
}
.settings-danger-button {
color: var(--wxex-danger);
&:hover:not(:disabled) {
border-color: var(--wxex-danger);
color: var(--wxex-danger);
}
}
.settings-card-kicker {
display: block;
margin-bottom: 6px;
color: var(--wxex-text-muted);
font-size: 11px;
}
.cache-overview-card {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
strong {
display: block;
color: var(--wxex-text-primary);
font-size: 24px;
line-height: 30px;
}
small {
display: block;
margin-top: 4px;
color: var(--wxex-text-secondary);
font-size: 11px;
}
}
.settings-cache-list {
display: grid;
gap: 10px;
}
.settings-cache-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
h3 {
margin: 0;
color: var(--wxex-text-primary);
font-size: 14px;
}
p {
margin: 5px 0 4px;
color: var(--wxex-text-secondary);
font-size: 12px;
line-height: 18px;
}
small {
color: var(--wxex-text-muted);
font-size: 11px;
}
}
.settings-inline-note,
.settings-footnote {
color: var(--wxex-text-muted);
font-size: 11px;
line-height: 18px;
}
.settings-inline-note {
display: flex;
gap: 8px;
margin-top: 14px;
strong {
color: var(--wxex-text-secondary);
}
}
.settings-option-card {
padding: 12px;
}
.settings-choice-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
}
.settings-choice {
display: flex;
min-width: 0;
align-items: flex-start;
gap: 8px;
padding: 12px;
border: 1px solid var(--wxex-border);
border-radius: var(--wxex-radius-md);
background: var(--wxex-bg-main);
cursor: pointer;
input {
margin: 2px 0 0;
accent-color: var(--wxex-brand);
}
span {
display: grid;
gap: 4px;
min-width: 0;
}
b {
color: var(--wxex-text-primary);
font-size: 12px;
}
small {
color: var(--wxex-text-muted);
font-size: 10px;
line-height: 15px;
}
&.active {
border-color: var(--wxex-brand);
background: var(--wxex-brand-soft);
}
}
.settings-toggle-list {
display: grid;
gap: 0;
padding: 0 18px;
}
.settings-toggle-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
padding: 16px 0;
border-bottom: 1px solid var(--wxex-border);
&:last-child {
border-bottom: 0;
}
span {
display: grid;
gap: 4px;
}
b {
color: var(--wxex-text-primary);
font-size: 13px;
}
small {
color: var(--wxex-text-secondary);
font-size: 11px;
}
input {
width: 17px;
height: 17px;
flex: 0 0 auto;
accent-color: var(--wxex-brand);
}
}
.about-identity-card {
display: flex;
align-items: center;
gap: 14px;
> div {
display: grid;
flex: 1;
gap: 2px;
}
strong {
color: var(--wxex-text-primary);
font-size: 18px;
}
small {
color: var(--wxex-text-secondary);
font-size: 12px;
}
a {
color: var(--wxex-brand);
font-size: 12px;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
.update-card {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18px;
&.status-error {
border-color: rgba(200, 90, 90, 0.42);
}
&.status-downloaded {
border-color: rgba(46, 139, 104, 0.42);
}
}
.update-card-copy {
display: grid;
flex: 1;
gap: 5px;
min-width: 0;
strong {
color: var(--wxex-text-primary);
font-size: 13px;
}
span {
color: var(--wxex-text-secondary);
font-size: 11px;
line-height: 17px;
}
}
.update-progress {
height: 6px;
overflow: hidden;
border-radius: 999px;
background: var(--wxex-border);
i {
display: block;
height: 100%;
border-radius: inherit;
background: var(--wxex-brand);
transition: width 0.2s ease;
}
}
.about-links-card {
display: grid;
gap: 12px;
a {
color: var(--wxex-brand);
font-size: 12px;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
.app-shell {
&.is-compact {
--wxex-nav-width: 68px;
--wxex-shell-content-top: 8px;
}
}
.boot-splash.is-quiet {
.boot-splash-title,
.boot-splash-subtitle,
.boot-splash-detail,
.boot-splash-progress {
display: none;
}
}
@media (max-width: 720px) {
.settings-choice-grid {
grid-template-columns: 1fr;
}
.cache-overview-card,
.settings-cache-item,
.update-card {
align-items: flex-start;
flex-direction: column;
}
}
+259
View File
@@ -0,0 +1,259 @@
@mixin dark-theme {
--wxex-bg-app: #171b1a;
--wxex-bg-main: #1e2422;
--wxex-bg-sidebar: #202925;
--wxex-bg-elevated: #27302d;
--wxex-text-primary: #edf4f0;
--wxex-text-secondary: #b2c0b9;
--wxex-text-muted: #81918a;
--wxex-border: #394640;
--wxex-brand-soft: #26483c;
.conversation-section-header:hover,
.conversation-item:hover,
.report-source-item:hover,
.report-history-item:hover {
background: var(--wxex-brand-soft);
}
.chat-window,
.chat-archive-header,
.chat-status-bar,
.ai-report-workspace,
.ai-report-footer,
.report-viewer,
.settings-workspace,
.settings-page-header,
.api-center-layout,
.export-workspace,
.ai-search-workspace {
background: var(--wxex-bg-main);
color: var(--wxex-text-primary);
}
.data-trust-bar {
background: var(--wxex-bg-sidebar);
}
.wechat-message-list {
background: #161c19;
}
.message-bubble,
.wechat-message-row.other .quoted-message,
.message-loading-pill {
border-color: var(--wxex-border);
background: var(--wxex-bg-elevated);
color: var(--wxex-text-primary);
}
.wechat-system-message {
background: rgba(39, 48, 45, 0.9);
color: var(--wxex-text-secondary);
}
.wechat-system-message-meta,
.message-sender-name,
.message-hover-time,
.message-accessible-sender {
color: var(--wxex-text-muted);
}
.wechat-message-row.mine .message-bubble {
border-color: rgba(80, 190, 151, 0.3);
background: #24513f;
color: #f2faf6;
}
.wechat-message-row.mine .quoted-message {
background: rgba(12, 26, 21, 0.32);
color: #d7e7df;
}
.message-bubble a,
.message-bubble code,
.message-bubble pre {
color: inherit;
}
.settings-sidebar,
.settings-sidebar-account,
.report-source-sidebar,
.report-history-sidebar {
background: var(--wxex-bg-sidebar);
border-color: var(--wxex-border);
}
.settings-sidebar header,
.settings-page-header,
.report-source-header,
.report-history-header,
.report-settings-panel header,
.report-viewer-header {
border-color: var(--wxex-border);
}
.settings-sidebar header h1,
.settings-sidebar-list button,
.settings-sidebar-list button.active,
.settings-page-header h1,
.settings-section-heading,
.settings-card,
.settings-card strong,
.settings-cache-item h3,
.settings-toggle-row b,
.settings-choice b,
.settings-workspace h1,
.settings-workspace h2,
.settings-workspace h3,
.settings-workspace h4,
.settings-workspace strong,
.settings-workspace b,
.settings-workspace button,
.settings-workspace label,
.settings-workspace dt,
.settings-workspace dd,
.settings-workspace span,
.settings-workspace p,
.settings-workspace small,
.settings-workspace code,
.settings-workspace a {
color: var(--wxex-text-primary);
}
.settings-workspace p,
.settings-workspace small,
.settings-workspace span,
.settings-workspace code,
.settings-workspace .settings-inline-note,
.settings-workspace .settings-footnote {
color: var(--wxex-text-secondary);
}
.settings-workspace .settings-card,
.settings-workspace .settings-choice,
.settings-workspace .settings-search,
.settings-workspace input,
.settings-workspace textarea,
.settings-workspace select,
.settings-workspace .settings-sidebar-list button.active {
border-color: var(--wxex-border);
background: var(--wxex-bg-elevated);
color: var(--wxex-text-primary);
}
.settings-workspace input::placeholder,
.settings-workspace textarea::placeholder {
color: var(--wxex-text-muted);
}
.settings-workspace .settings-choice.active,
.settings-workspace .settings-status-badge,
.settings-workspace .settings-privacy-notice,
.settings-workspace .settings-inline-note {
background: var(--wxex-brand-soft);
}
.settings-workspace .settings-privacy-notice,
.settings-workspace .settings-privacy-notice strong,
.settings-workspace .settings-privacy-notice p,
.settings-workspace .settings-privacy-notice svg {
color: #c5eadb;
stroke: #72d0af;
}
.settings-workspace .settings-connection-text.success,
.settings-workspace [class*='success'],
.settings-workspace [class*='success'] * {
color: #72d0af !important;
}
.settings-workspace [class*='error'],
.settings-workspace [class*='error'] * {
color: #ff9b96 !important;
}
.report-settings-panel {
background: var(--wxex-bg-sidebar);
color: var(--wxex-text-primary);
}
.report-settings-section,
.report-settings-section h3,
.report-settings-section p,
.report-settings-section code,
.report-export-list div,
.report-generation-log li,
.report-generation-log b,
.report-generation-log small,
.report-info-panel {
color: var(--wxex-text-primary);
}
.report-settings-section p,
.report-settings-section code,
.report-export-list div,
.report-generation-log li,
.report-generation-log small {
color: var(--wxex-text-secondary);
}
.report-settings-section code,
.report-timeout-section input,
.report-check-row,
.report-readonly-modules span,
.report-result-preview {
border-color: var(--wxex-border);
background: var(--wxex-bg-elevated);
color: var(--wxex-text-primary);
}
.report-result-preview {
background: #161c19;
}
.report-history-item,
.report-source-item,
.report-history-text b,
.report-history-text small,
.report-history-text em {
color: var(--wxex-text-primary);
}
.report-history-text small,
.report-history-text em,
.report-history-list-title,
.report-history-group h3 {
color: var(--wxex-text-muted);
}
.search-workspace,
.ai-search-scope-panel,
.ai-search-main,
.ai-search-evidence-panel,
.export-config-panel,
.export-preview-panel,
.api-main,
.api-runtime-panel {
background: var(--wxex-bg-main);
color: var(--wxex-text-primary);
}
.ai-search-scope-panel,
.ai-search-evidence-panel,
.export-config-panel,
.export-preview-panel,
.api-runtime-panel {
border-color: var(--wxex-border);
}
}
.app-shell.theme-dark {
@include dark-theme;
}
@media (prefers-color-scheme: dark) {
.app-shell.theme-system {
@include dark-theme;
}
}
+25
View File
@@ -0,0 +1,25 @@
export type AppUpdateStatus =
| 'idle'
| 'checking'
| 'available'
| 'not-available'
| 'downloading'
| 'downloaded'
| 'error'
| 'unsupported'
export interface AppUpdateState {
status: AppUpdateStatus
currentVersion: string
version?: string
percent?: number
transferred?: number
total?: number
bytesPerSecond?: number
message?: string
}
export interface AppUpdateCheckResult {
success: boolean
state: AppUpdateState
}
+15
View File
@@ -0,0 +1,15 @@
export type CacheClearScope = 'bootstrap' | 'electron' | 'all'
export interface CacheSummaryItem {
id: 'bootstrap' | 'electron'
label: string
description: string
sizeBytes: number
fileCount: number
}
export interface CacheSummary {
items: CacheSummaryItem[]
totalBytes: number
updatedAt: number
}