fix(secrets): 换号期间的旧账号代理与快照不得落到新账号

登出清理涉及两次异步桥调用(读/写 app.json),期间可能已经换号。
给锁定代理回填、代理补报和继承快照消费都加上当前 uid 复核:
旧账号的代理不写进新账号的本地 proxy_users,也不带新账号令牌补报;
继承在读到快照后再确认一次 uid,变了就放弃本次继承。
This commit is contained in:
2026-10-25 22:42:17 +08:00
parent 8323245567
commit 688910f738
2 changed files with 18 additions and 6 deletions
@@ -132,6 +132,8 @@ export async function inheritSecretsFromDevice(
console.warn('[api-secret] 读取本机继承快照失败(下次加载重试):', error)
return null
})
// 等配置期间可能已经登出/换号:旧账号的快照不能写进新账号的服务端
if (host.currentUid() !== uid) return { count: 0, notice: null }
const stash = readInheritedSecretStash(config, host.moduleKeys())
if (!stash || stash.fromUid === uid) return { count: 0, notice: null }
const serverHas = new Set(serverItems.filter((item) => item?.exists).map((item) => item.moduleKey))