mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-18 03:57:02 +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:
@@ -20,6 +20,7 @@ interface TokenReadResult {
|
||||
|
||||
export class ApiTokenStore {
|
||||
private cachedToken: string | null = null
|
||||
private automaticGenerationBlockedReason: string | null = null
|
||||
|
||||
constructor(private readonly filePathOverride?: string) {}
|
||||
|
||||
@@ -42,10 +43,18 @@ export class ApiTokenStore {
|
||||
available: true,
|
||||
hasToken: result.success && Boolean(result.token),
|
||||
maskedToken: MASKED_TOKEN,
|
||||
...(result.success ? {} : { error: result.error })
|
||||
...(result.success
|
||||
? result.token || !this.automaticGenerationBlockedReason
|
||||
? {}
|
||||
: { error: this.automaticGenerationBlockedReason }
|
||||
: { error: result.error })
|
||||
}
|
||||
}
|
||||
|
||||
setAutomaticGenerationBlocked(reason?: string): void {
|
||||
this.automaticGenerationBlockedReason = reason?.trim() || null
|
||||
}
|
||||
|
||||
ensureToken(): ApiTokenActionResult {
|
||||
if (!safeStorage.isEncryptionAvailable()) {
|
||||
return {
|
||||
@@ -59,6 +68,9 @@ export class ApiTokenStore {
|
||||
const current = this.read()
|
||||
if (!current.success) return this.actionError(current.error)
|
||||
if (current.token) return this.actionSuccess()
|
||||
if (this.automaticGenerationBlockedReason) {
|
||||
return this.actionError(this.automaticGenerationBlockedReason)
|
||||
}
|
||||
return this.persist(this.generateToken())
|
||||
}
|
||||
|
||||
@@ -70,7 +82,9 @@ export class ApiTokenStore {
|
||||
|
||||
rotateToken(): ApiTokenActionResult {
|
||||
if (!safeStorage.isEncryptionAvailable()) return this.ensureToken()
|
||||
return this.persist(this.generateToken())
|
||||
const result = this.persist(this.generateToken())
|
||||
if (result.success) this.automaticGenerationBlockedReason = null
|
||||
return result
|
||||
}
|
||||
|
||||
getTokenForAuthentication(): string | null {
|
||||
|
||||
Reference in New Issue
Block a user