feat(jellyfin): store access token in encrypted local store

This commit is contained in:
2026-02-20 03:26:37 -08:00
parent a4532a5fa0
commit 46a2ac5dc7
22 changed files with 306 additions and 13 deletions

View File

@@ -6,6 +6,8 @@ test('jellyfin auth handler processes logout', async () => {
const calls: string[] = [];
const handleAuth = createHandleJellyfinAuthCommands({
patchRawConfig: () => calls.push('patch'),
saveStoredToken: () => calls.push('save'),
clearStoredToken: () => calls.push('clear'),
authenticateWithPassword: async () => {
throw new Error('should not authenticate');
},
@@ -34,13 +36,15 @@ test('jellyfin auth handler processes logout', async () => {
});
assert.equal(handled, true);
assert.equal(calls[0], 'patch');
assert.deepEqual(calls.slice(0, 2), ['clear', 'patch']);
});
test('jellyfin auth handler processes login', async () => {
const calls: string[] = [];
const handleAuth = createHandleJellyfinAuthCommands({
patchRawConfig: () => calls.push('patch'),
saveStoredToken: () => calls.push('save'),
clearStoredToken: () => calls.push('clear'),
authenticateWithPassword: async () => ({
serverUrl: 'http://localhost',
username: 'user',
@@ -72,6 +76,7 @@ test('jellyfin auth handler processes login', async () => {
});
assert.equal(handled, true);
assert.ok(calls.includes('save'));
assert.ok(calls.includes('patch'));
assert.ok(calls.some((entry) => entry.includes('Jellyfin login succeeded')));
});
@@ -79,6 +84,8 @@ test('jellyfin auth handler processes login', async () => {
test('jellyfin auth handler no-ops when no auth command', async () => {
const handleAuth = createHandleJellyfinAuthCommands({
patchRawConfig: () => {},
saveStoredToken: () => {},
clearStoredToken: () => {},
authenticateWithPassword: async () => ({
serverUrl: '',
username: '',