feat(webui): global-config settings tab + /api/global-config
Adds a '全局配置' Settings tab that edits config/snowluma.json — the rkey fallback-server list and the deployment-wide musicSignUrl — backed by a new bearer-gated GET/POST /api/global-config (load/saveGlobalSettings, then oneBotManager.reloadGlobalSettings to hot-apply to live instances). The panel reuses the established settings-panel idiom (Input/Button/Label, debounced auto-save, flash); rkey servers are an inline add/remove list with client-side http(s) validation hints. It deliberately does not reconcile inputs from the server's normalized response (would erase a half-typed URL); a load-failure shows an error+retry, and the save toast says '无效项已忽略' when the server would drop an entry. Removes the now-dead per-UIN musicSignUrl form (moved to global in Phase 2). Phase 3 of the global-settings split (nav grouping is Phase 4).
This commit is contained in:
9 files changed
+283
-22
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { AccountConnections, BackupBundle, BackupImportResult, DebugActionDoc, DebugInvokeResult, DebugStreamMessage, HookProcessInfo, LogEntry, LogLevel, NotificationDeliveryRecord, NotificationsConfig, QQInfo, SystemInfo, SystemSettingsPatch, SystemSettingsResponse, UiAppearance, UiConfig, UpdateInfo } from '@/types';
|
||||
import type { AccountConnections, BackupBundle, BackupImportResult, DebugActionDoc, DebugInvokeResult, DebugStreamMessage, GlobalSettings, HookProcessInfo, LogEntry, LogLevel, NotificationDeliveryRecord, NotificationsConfig, QQInfo, SystemInfo, SystemSettingsPatch, SystemSettingsResponse, UiAppearance, UiConfig, UpdateInfo } from '@/types';
|
||||
import type { PasswordRule } from '@/components/pages/change-password-page';
|
||||
import { normalizeOneBotConfig } from '@/lib/onebot-config';
|
||||
import {
|
||||
@@ -48,6 +48,7 @@ class HttpApiClient implements ApiClient {
|
||||
readonly update: ApiClient['update'];
|
||||
readonly ui: ApiClient['ui'];
|
||||
readonly notifications: ApiClient['notifications'];
|
||||
readonly globalConfig: ApiClient['globalConfig'];
|
||||
readonly systemSettings: ApiClient['systemSettings'];
|
||||
readonly debug: ApiClient['debug'];
|
||||
readonly agreements: ApiClient['agreements'];
|
||||
@@ -190,6 +191,18 @@ class HttpApiClient implements ApiClient {
|
||||
}),
|
||||
};
|
||||
|
||||
this.globalConfig = {
|
||||
get: () =>
|
||||
this.getJson<{ config: GlobalSettings }>('/api/global-config').then((d) => d.config),
|
||||
save: async (config) => {
|
||||
const data = await this.postJson<{ success: boolean; config: GlobalSettings }>(
|
||||
'/api/global-config',
|
||||
config,
|
||||
);
|
||||
return data.config;
|
||||
},
|
||||
};
|
||||
|
||||
this.agreements = {
|
||||
get: () => this.getJson<AgreementsPayload>('/api/agreements'),
|
||||
recordConsent: async (version) => {
|
||||
|
||||
Reference in new issue
Block a user