feat(webui): report account storage update progress

Surface account storage preparation and background history progress through the existing live connection status channel. Clearly distinguish unavailable accounts from accounts that remain fully usable during maintenance.

Show processed totals, completion percentage, estimated remaining time, and retry states in both the global notice and account overview. Preserve existing connection update filtering to avoid unnecessary refreshes.
This commit is contained in:
DrSmoothl committed 2026-07-30 09:57:31 +08:00
1 parent 25e61ce5df
commit e5f256f4dc
7 files changed
+202 -27

No files matched your search

+2 -16
View File
@@ -49,6 +49,7 @@ import { sseResponse } from './sse-response';
import { bindStateStream } from './state-stream';
import type { StateBus, StateResource } from './state-bus';
import { startConnectionDiffLoop } from './connection-diff-loop';
import { comparableConnectionSnapshot } from './connection-snapshot';
import { describeTrustProxy, makeClientIpResolver, parseTrustProxy } from './client-ip';
import { findAvailablePort } from './port';
import {
@@ -467,22 +468,7 @@ export async function initWebUI(
startConnectionDiffLoop({
bus: listener.stateBus,
getSnapshot: () => oneBotManager.getConnectionStatuses(),
pickComparable: (snap) => {
if (!Array.isArray(snap)) return snap;
return (snap as Array<{ uin: string; nickname?: string; adapters?: unknown[] }>).map((acc) => ({
uin: acc.uin,
nickname: acc.nickname,
// Empty fallback when `adapters` is not an array — never the
// raw value, which could re-introduce volatile fields verbatim
// if the snapshot shape ever drifts.
adapters: Array.isArray(acc.adapters)
? acc.adapters.map((a: unknown) => {
const o = a as { name?: string; kind?: string; status?: string; lastErrorAt?: number };
return { name: o.name, kind: o.kind, status: o.status, lastErrorAt: o.lastErrorAt };
})
: [],
}));
},
pickComparable: comparableConnectionSnapshot,
intervalMs: 500,
});
}