fix(web): access token 移出 localStorage;401 刷新 single-flight 并跳登录页

- access token 只存内存:XSS 拿不到持久凭据;刷新页面由 bootstrap 用 HttpOnly refresh cookie 静默换新;bootstrap 并发去重
- 并发 401 共享一次刷新(refresh 已是轮换式,各自刷新会互相踩);会话失效自动回登录页
- 防主题闪烁内联脚本挪到外部 theme-init.js(配合 CSP script-src 'self')
- 修 console 用量页与管理用户搜索的查询参数未编码;极小金额不再显示科学计数法;渠道表单数字输入清空后省略字段而非提交 0(权重 0 的渠道永远选不中)
- 改密成功后主动清会话回登录页(后端已递增 token_version,当前会话已作废)
This commit is contained in:
Sakurasan committed 2026-10-29 02:56:52 +08:00
1 parent e3ff0d3329
commit 4df2506a74
9 files changed
+83 -42

No files matched your search

+3 -1
View File
@@ -15,6 +15,8 @@ export function fmtTime(s?: string | null): string {
export function fmtCost(v: number): string {
if (v === 0) return '$0'
if (v < 0.01) return '$' + v.toExponential(2)
// toLocaleString 对 <0.01 会出科学计数法($5e-3):定点 6 位并去尾零
if (v < 1e-6) return '<$0.000001'
if (v < 0.01) return '$' + v.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')
return fmtMoney(v)
}