From 0e44cfb63f27acfbfac4904a781a15b7769cc41f Mon Sep 17 00:00:00 2001 From: WonderAliceUwU Date: Wed, 21 Oct 2026 20:10:14 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20take=20the=20j?= =?UTF-8?q?ellyfin=20user=20from=20the=20signed-in=20profile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the Load users button and user selector from Settings, which only set the user an admin session browsed as. The Jellyfin user now always comes from the profile the session signed in with, and a value saved by older versions is ignored. --- server/index.ts | 7 +++++-- src/App.tsx | 22 ---------------------- 2 files changed, 5 insertions(+), 24 deletions(-) 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 })} /> -
- -
-