fix: 应用 xhigh 代码评审的跨端修复
ci / server (push) Failing after 13s
ci / design-tokens (push) Failing after 11s

来自 xhigh code review 的正确性/健壮性修复,覆盖全部五端:
- server:鉴权 fail-closed、计量交叉校验与配额扣穿处理、WS 网关并发与关闭顺序、
  billing 行锁、redis Lua 过期与设备槽刷新、config 解析
- desktop:会话 epoch 防串话、WS 重连与 401 处理、api 客户端复用、统一 usePoll 轮询
- android:握手时序、请求头封装、账户状态派生、按需重组
- ios:finalize 宽限、串行采集、错误文案服务端优先、删除死代码 CommitController

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-13 11:50:08 +08:00
parent 50b49f3cbe
commit b5ab92a57e
42 changed files with 2125 additions and 469 deletions
+12 -1
View File
@@ -38,11 +38,22 @@ export function SettingsApp() {
invoke('fetch_me').then((m) => m && setMe(m));
}, []);
// 仅这些字段属于「用户可改的设置」,回写时只动这几项,
// 其余字段(token / device_id / onboarding_done / server_url)保持后端最新值。
const USER_FIELDS = ['hotkey', 'mic', 'sound', 'autostart', 'theme'];
const update = (patch) => {
const next = { ...settings, ...patch };
setSettings(next);
invoke('set_settings', { settings: next });
if (patch.theme) setThemePref(patch.theme);
// 保存前重新读最新 settings 再合并,避免用陈旧(可能空)token 覆盖登录流程写入的 token,
// 导致先开设置窗再扫码登录、回设置页改开关时静默登出(丢失更新)。
invoke('get_settings').then((latest) => {
const base = latest || settings;
const merged = { ...base };
for (const k of USER_FIELDS) merged[k] = next[k];
invoke('set_settings', { settings: merged });
});
};
const minutes = me ? Math.floor(me.balance_seconds / 60) : 0;