feat: 支持图片密钥配置与内存扫描

This commit is contained in:
电摇小子
2026-07-14 10:20:23 +08:00
committed by 电摇小子
parent 8d82fabf57
commit 71e970c55c
11 changed files with 490 additions and 67 deletions
+13 -2
View File
@@ -8,6 +8,9 @@ export interface AppSettings {
apiEnabled: boolean
apiHost: string
apiPort: number
imageKeyRoot: string
imageXorKey: string
imageAesKey: string
}
function getDefaultDbRoot(): string {
@@ -102,11 +105,16 @@ function isUsableDbRoot(candidate?: string): boolean {
}
}
const defaultDbRoot = getDefaultDbRoot()
const DEFAULT_SETTINGS: AppSettings = {
dbRoot: getDefaultDbRoot(),
dbRoot: defaultDbRoot,
apiEnabled: true,
apiHost: '127.0.0.1',
apiPort: 6131
apiPort: 6131,
imageKeyRoot: defaultDbRoot,
imageXorKey: process.env.VITE_IMAGE_XOR_KEY || '',
imageAesKey: process.env.VITE_IMAGE_AES_KEY || ''
}
const SETTINGS_FILE = path.join(
@@ -129,6 +137,9 @@ export function loadSettings(): AppSettings {
if (process.platform === 'win32' && !isUsableDbRoot(cache.dbRoot)) {
cache.dbRoot = getDefaultDbRoot()
}
if (!cache.imageKeyRoot) {
cache.imageKeyRoot = cache.dbRoot
}
return cache
}
} catch (error) {