feat(webui): add live connection status for OneBot adapters in dashboard

This commit is contained in:
DrSmoothl committed 2026-05-30 18:02:01 +08:00
1 parent 90f26ca4f4
commit 0e4b881f76
18 files changed
+351 -13

No files matched your search

@@ -1,7 +1,7 @@
import { createLogger } from '@snowluma/common/logger';
import { buildDispatchPayload } from '../event-filter';
import type { JsonObject, NetworkBase } from '../types';
import { IOneBotNetworkAdapter } from './adapter';
import { IOneBotNetworkAdapter, type AdapterStatus } from './adapter';
const log = createLogger('OneBot.Network');
@@ -30,6 +30,11 @@ export class OneBotNetworkManager {
list(): AnyAdapter[] { return [...this.adapters.values()]; }
/** Live status of every registered adapter, for the WebUI dashboard. */
describeStatuses(): AdapterStatus[] {
return this.list().map((a) => a.describeStatus());
}
hasActiveAdapters(): boolean {
for (const a of this.adapters.values()) if (a.isActive) return true;
return false;