mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-12-01 01:05:30 +08:00
feat: 完成 TraceMemo v2.2.0 品牌身份与数据迁移升级
- 将 WechatExplorer 产品身份升级为 TraceMemo - 更新 appId、Runtime Identity、Reader Skill 和 API 环境变量 - 增加旧用户数据、Knowledge、Token 与 AI Provider 安全迁移 - 保留 Windows WeFlow 和旧版配置兼容 - 完善首次启动迁移测试及 v2.2.0 发布文档 - 移除 macOS Intel x64 构建与发布支持
This commit is contained in:
1 parent
b490dc4098
commit
3f019faa38
39 files changed
+1837
-545
No files matched your search
@@ -1,19 +1,36 @@
|
||||
import { app } from 'electron'
|
||||
import path from 'path'
|
||||
import { getUserDataRoots, LEGACY_USER_DATA_NAME, selectUserDataRoot } from './app-data-paths'
|
||||
import { getUserDataRoots, LEGACY_USER_DATA_NAME, TRACE_MEMO_RUNTIME_NAME } from './app-data-paths'
|
||||
|
||||
export const LEGACY_MIGRATION_HELPER_ENV = 'TRACEMEMO_LEGACY_MIGRATION_HELPER'
|
||||
export const LEGACY_MIGRATION_SOURCE_ENV = 'TRACEMEMO_LEGACY_MIGRATION_SOURCE'
|
||||
export const LEGACY_MIGRATION_USER_DATA_ENV = 'TRACEMEMO_LEGACY_MIGRATION_USER_DATA'
|
||||
export const LEGACY_MIGRATION_RESULT_FD_ENV = 'TRACEMEMO_LEGACY_MIGRATION_RESULT_FD'
|
||||
|
||||
// This module must remain the first main-process import. Static imports in
|
||||
// settings/cache services can otherwise resolve Electron paths before the
|
||||
// legacy runtime identity and selected userData are installed.
|
||||
app.setName(process.platform === 'win32' ? 'WeFlow' : LEGACY_USER_DATA_NAME)
|
||||
// TraceMemo userData is installed before any consumers. macOS uses the old
|
||||
// safeStorage identity only inside the helper; Windows keeps in both
|
||||
// processes because WCDB requires that technical runtime name.
|
||||
const isLegacyMigrationHelper = process.env[LEGACY_MIGRATION_HELPER_ENV] === '1'
|
||||
const legacyRuntimeName = process.platform === 'win32' ? 'WeFlow' : LEGACY_USER_DATA_NAME
|
||||
const runtimeName =
|
||||
process.platform === 'win32'
|
||||
? 'WeFlow'
|
||||
: isLegacyMigrationHelper
|
||||
? legacyRuntimeName
|
||||
: TRACE_MEMO_RUNTIME_NAME
|
||||
app.setName(runtimeName)
|
||||
|
||||
const isolatedUserData = process.env['WXE_USER_DATA']
|
||||
const isUserDataIsolated = !isLegacyMigrationHelper && Boolean(isolatedUserData?.trim())
|
||||
const roots = getUserDataRoots(app.getPath('appData'))
|
||||
const userDataSelection = selectUserDataRoot({
|
||||
...roots,
|
||||
isolated: isolatedUserData
|
||||
})
|
||||
const selectedUserData = userDataSelection.selected
|
||||
const helperUserData = process.env[LEGACY_MIGRATION_USER_DATA_ENV]
|
||||
const selectedUserData = isLegacyMigrationHelper
|
||||
? path.resolve(helperUserData?.trim() || path.join(roots.current, '.legacy-migration-helper'))
|
||||
: isolatedUserData?.trim()
|
||||
? path.resolve(isolatedUserData)
|
||||
: roots.current
|
||||
|
||||
app.setPath('userData', selectedUserData)
|
||||
app.setPath('sessionData', selectedUserData)
|
||||
@@ -21,8 +38,19 @@ app.setPath('sessionData', selectedUserData)
|
||||
// Logs are intentionally independent from userData. New TraceMemo logs go to
|
||||
// the new visible directory while historical WechatExplorer logs remain in
|
||||
// place and are never moved or renamed.
|
||||
if (process.platform === 'darwin') {
|
||||
if (isLegacyMigrationHelper) {
|
||||
app.setPath('logs', path.join(selectedUserData, 'logs'))
|
||||
} else if (process.platform === 'darwin') {
|
||||
app.setPath('logs', path.join(app.getPath('home'), 'Library', 'Logs', 'TraceMemo'))
|
||||
} else if (process.platform === 'win32') {
|
||||
app.setPath('logs', path.join(selectedUserData, 'logs'))
|
||||
}
|
||||
|
||||
export { roots, selectedUserData, userDataSelection }
|
||||
export {
|
||||
isLegacyMigrationHelper,
|
||||
isUserDataIsolated,
|
||||
legacyRuntimeName,
|
||||
runtimeName,
|
||||
roots,
|
||||
selectedUserData
|
||||
}
|
||||
Reference in new issue
Block a user