feat: Emby support (#234)

* fix: support credential extraction from Emby

* fix: minor compatibility with emby for retrieving albums

* fix: rename credentials and save credentials type

* fix: weird issue when changing libraries

* fix: correctly map platform names in auth header

* chore: properly carry over old settings

* fix: only enable playlists on jellyfin

* fix: remove jellyfin mentions

* fix: incorporate jellyfin and emby as mentions
This commit is contained in:
Lei Nelissen
2024-07-25 23:37:00 +02:00
committed by GitHub
parent c15f8fe1fc
commit a6452f0a5e
35 changed files with 294 additions and 168 deletions

View File

@@ -64,6 +64,23 @@ const persistConfig: PersistConfig<Omit<AppState, '_persist'>> = {
}
};
},
// @ts-expect-error migrations are poorly typed
5: (state: AppState) => {
// @ts-expect-error
const credentials = state.settings.jellyfin && {
// @ts-expect-error
...(state.settings.jellyfin as AppState['settings']['credentials']),
type: 'jellyfin',
};
return {
...state,
settings: {
...state.settings,
credentials,
},
};
}
})
};

View File

@@ -1,7 +1,7 @@
import { createAction } from '@reduxjs/toolkit';
import { ColorScheme } from './types';
export const setJellyfinCredentials = createAction<{ access_token: string, user_id: string, uri: string, device_id: string; }>('SET_JELLYFIN_CREDENTIALS');
export const setJellyfinCredentials = createAction<{ access_token: string, user_id: string, uri: string, device_id: string; type: 'jellyfin' | 'emby' }>('SET_JELLYFIN_CREDENTIALS');
export const setBitrate = createAction<number>('SET_BITRATE');
export const setOnboardingStatus = createAction<boolean>('SET_ONBOARDING_STATUS');
export const setReceivedErrorReportingAlert = createAction<void>('SET_RECEIVED_ERROR_REPORTING_ALERT');

View File

@@ -3,11 +3,12 @@ import { setReceivedErrorReportingAlert, setBitrate, setJellyfinCredentials, set
import { ColorScheme } from './types';
interface State {
jellyfin?: {
credentials?: {
uri: string;
user_id: string;
access_token: string;
device_id: string;
type: 'jellyfin' | 'emby';
}
bitrate: number;
isOnboardingComplete: boolean;
@@ -27,7 +28,7 @@ const initialState: State = {
const settings = createReducer(initialState, builder => {
builder.addCase(setJellyfinCredentials, (state, action) => ({
...state,
jellyfin: action.payload,
credentials: action.payload,
}));
builder.addCase(setBitrate, (state, action) => ({
...state,