Files
WeChatDataAnalysis/frontend/lib/wechat-install-path.js
T
2977094657 0987167c4a fix(key): 支持手动指定微信安装目录并校验 db key 来源
- /api/get_keys 支持传入 wechat_install_path,兼容安装目录与 Weixin.exe / WeChat.exe

- 解密完成后保存 db key 的来源路径与别名,避免历史密钥被错误账号复用

- 解密页按 account + db_storage_path 回填已保存密钥,并补充相关测试覆盖
2026-04-23 21:32:02 +08:00

25 lines
811 B
JavaScript

export const WECHAT_INSTALL_PATH_STORAGE_KEY = 'decrypt.wechatInstallPath'
export const normalizeWechatInstallPath = (value) => String(value || '').trim()
export const readStoredWechatInstallPath = () => {
if (!process.client || typeof window === 'undefined') return ''
try {
return normalizeWechatInstallPath(window.localStorage.getItem(WECHAT_INSTALL_PATH_STORAGE_KEY) || '')
} catch {
return ''
}
}
export const writeStoredWechatInstallPath = (value) => {
if (!process.client || typeof window === 'undefined') return
try {
const normalized = normalizeWechatInstallPath(value)
if (normalized) {
window.localStorage.setItem(WECHAT_INSTALL_PATH_STORAGE_KEY, normalized)
} else {
window.localStorage.removeItem(WECHAT_INSTALL_PATH_STORAGE_KEY)
}
} catch {}
}