fix(spotify): refresh Web API search provider creds on Settings save (no restart) [corner-case R2-4]

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.8 committed 2026-07-03 12:25:45 +08:00
1 parent 2413a9a3a1
commit 9a32f3c602
3 files changed
+106

No files matched your search

+6
View File
@@ -21,6 +21,7 @@ import { createAuditRouter } from "./api/audit.js";
import { createFavoritesRouter } from "./api/favorites.js";
import { createSpotifyRouter } from "./api/spotify.js";
import type { SpotifyOAuth } from "../music/spotify/spotify-oauth.js";
import type { SpotifyProvider } from "../music/spotify/provider.js";
import { resolveSpotifyBackendKind } from "../music/spotify/backend-select.js";
import {
isGoLibrespotPresent,
@@ -135,6 +136,11 @@ export function createWebServer(options: WebServerOptions): WebServer {
// I2: so saving a Client ID in Settings re-configures the live OAuth
// (no restart needed for the UI-entered-creds -> Connect flow).
options.spotifyOAuth,
// R2-4: so saving Spotify creds in Settings also refreshes the live Web API
// search provider (search + getAuthStatus) without a process restart. The
// runtime object is a SpotifyProvider (see index.ts); WebServerOptions types
// it as the wider MusicProvider, so narrow it here for the setCreds contract.
options.spotifyProvider as SpotifyProvider,
)
);
app.use(