mirror of
https://github.com/WonderAliceUwU/OmniArr.git
synced 2026-11-25 19:35:56 +00:00
♻️ refactor: take the jellyfin user from the signed-in profile
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.
This commit is contained in:
1 parent
50bdbce1bd
commit
0e44cfb63f
2 files changed
+5
-24
No files matched your search
+5
-2
@@ -256,7 +256,8 @@ async function routeRequest(request: IncomingMessage, response: ServerResponse):
|
||||
|
||||
if (url.pathname === '/api/settings' && method === 'PUT') {
|
||||
const body = await readJson<AppConfig>(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<AppConfig> {
|
||||
...(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<Buffer> {
|
||||
|
||||
Reference in new issue
Block a user