diff --git a/server/index.ts b/server/index.ts index 5378efb..26de77a 100644 --- a/server/index.ts +++ b/server/index.ts @@ -256,7 +256,8 @@ async function routeRequest(request: IncomingMessage, response: ServerResponse): if (url.pathname === '/api/settings' && method === 'PUT') { const body = await readJson(request); - const config = sanitizeConfig(body); + const sanitized = sanitizeConfig(body); + const config = { ...sanitized, jellyfin: { ...sanitized.jellyfin, userId: '' } }; await updateEncryptedConfig(encryptJson(config, await getConfigEncryptionKey())); const connections = await getConnectionStatuses(config); sendJson(response, 200, { @@ -603,8 +604,10 @@ async function readConfig(legacyEncryptionKey?: Buffer): Promise { ...(stored.tvdb || {}) } }); + // The Jellyfin user always comes from the profile the session signed in + // with; admin sessions have none, so a userId saved by older versions is ignored. const userId = legacyEncryptionKey ? sessionUsers.get(legacyEncryptionKey) : undefined; - return userId ? { ...config, jellyfin: { ...config.jellyfin, userId } } : config; + return { ...config, jellyfin: { ...config.jellyfin, userId: userId || '' } }; } async function getConfigEncryptionKey(): Promise { diff --git a/src/App.tsx b/src/App.tsx index 17ec7dc..d2bb019 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -475,9 +475,7 @@ function App() { busy={busy} config={config} connections={connections} - jellyfinUsersBusy={jellyfinUsersBusy} onExit={() => setAuthState('profiles')} - onLoadJellyfinUsers={handleLoadJellyfinUsers} onSave={handleSaveSettings} options={options} updateConfig={updateConfig} @@ -567,8 +565,6 @@ function App() { busy={busy} config={config} connections={connections} - jellyfinUsersBusy={jellyfinUsersBusy} - onLoadJellyfinUsers={handleLoadJellyfinUsers} onSave={handleSaveSettings} options={options} updateConfig={updateConfig} @@ -3789,9 +3785,7 @@ function GlobeGlyph() { function AdministrationScreen(props: { config: AppConfig connections: ConnectionStatus[] - jellyfinUsersBusy: boolean onExit: () => void - onLoadJellyfinUsers: () => Promise updateConfig: (key: K, value: AppConfig[K]) => void options: ServiceOptionsResponse onSave: (event: FormEvent) => Promise @@ -3815,8 +3809,6 @@ function AdministrationScreen(props: { busy={props.busy} config={props.config} connections={props.connections} - jellyfinUsersBusy={props.jellyfinUsersBusy} - onLoadJellyfinUsers={props.onLoadJellyfinUsers} onSave={props.onSave} options={props.options} formId="administration-settings" @@ -3830,8 +3822,6 @@ function AdministrationScreen(props: { function SettingsView(props: { config: AppConfig connections: ConnectionStatus[] - jellyfinUsersBusy: boolean - onLoadJellyfinUsers: () => Promise updateConfig: (key: K, value: AppConfig[K]) => void options: ServiceOptionsResponse onSave: (event: FormEvent) => Promise @@ -3873,18 +3863,6 @@ function SettingsView(props: { onApiKeyChange={(apiKey) => props.updateConfig('jellyfin', { ...props.config.jellyfin, apiKey })} onBaseUrlChange={(baseUrl) => props.updateConfig('jellyfin', { ...props.config.jellyfin, baseUrl })} /> -
- -
-