feat(onebot): migrate musicSignUrl from per-UIN to global config

musicSignUrl is a deployment-wide signing-service endpoint (same for every
account), so it belongs in the global config/snowluma.json next to rkey, not in
per-UIN onebot_<uin>.json.

- GlobalSettings gains musicSignUrl (http(s)-validated, '' = built-in default);
  consumption switches to globalSettings.musicSignUrl and hot-reloads via
  applyGlobalSettings.
- One-shot copy-up at boot (migrateGlobalSettings, called first in main()):
  lifts the first VALID legacy value from any config/onebot*.json into the
  global store. Idempotent via a key-PRESENCE guard, so an intentional
  clear-to-'' is never reverted by a stale legacy value.
- Remove musicSignUrl from per-UIN OneBotConfig (type + parse/serialize).

Phase 2 of the global-settings split. (WebUI form follows in Phase 3.)
This commit is contained in:
DrSmoothl committed 2026-06-28 21:38:32 +08:00
1 parent 659970077a
commit ea1c5ff9eb
8 files changed
+185 -23

No files matched your search

+2 -1
View File
@@ -108,7 +108,7 @@ export class OneBotInstance {
reactionStore: this.reactionStore,
converterCtx: this.converterCtx,
config,
musicSignUrl: config.musicSignUrl,
musicSignUrl: globalSettings.musicSignUrl,
cacheMessageMeta: (messageId, meta) => this.cacheMessageMeta(messageId, meta),
dispatchEvent: (event) => this.dispatchEvent(event),
};
@@ -139,6 +139,7 @@ export class OneBotInstance {
* the manager when config/snowluma.json is saved from the WebUI. */
applyGlobalSettings(globalSettings: GlobalSettings): void {
this.rkeyCache.setFallbackServers(globalSettings.rkey.fallbackServers);
this.ctx.musicSignUrl = globalSettings.musicSignUrl;
}
dispose(): void {