mirror of
https://github.com/LifeArchiveProject/WeChatDataAnalysis.git
synced 2026-06-18 15:54:08 +08:00
0987167c4a
- /api/get_keys 支持传入 wechat_install_path,兼容安装目录与 Weixin.exe / WeChat.exe - 解密完成后保存 db key 的来源路径与别名,避免历史密钥被错误账号复用 - 解密页按 account + db_storage_path 回填已保存密钥,并补充相关测试覆盖
25 lines
811 B
JavaScript
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 {}
|
|
}
|