diff --git a/src/api/controller.ts b/src/api/controller.ts index 3f6c5e4..f063f4b 100644 --- a/src/api/controller.ts +++ b/src/api/controller.ts @@ -63,7 +63,7 @@ import { updatePlaylist as jfUpdatePlaylist, getSongs as jfGetSongs, } from './jellyfinApi'; -import { APIEndpoints, Server, ServerType } from '../types'; +import { APIEndpoints, ServerType } from '../types'; // prettier-ignore const endpoints = [ @@ -110,11 +110,7 @@ export const apiController = async (options: { args?: any; }) => { const selectedEndpoint = endpoints.find((e) => e.id === options.endpoint); - // If the serverType is funkwhale call the subsonic endpoint - const selectedEndpointFn = - options.serverType === Server.Funkwhale - ? selectedEndpoint!.endpoint[Server.Subsonic] - : selectedEndpoint!.endpoint[options.serverType]; + const selectedEndpointFn = selectedEndpoint!.endpoint[options.serverType]; if (!selectedEndpointFn || !selectedEndpoint) { return notifyToast('warning', `[${options.endpoint}] not available`); diff --git a/src/components/settings/Config.tsx b/src/components/settings/Config.tsx index fa276ca..a1423dc 100644 --- a/src/components/settings/Config.tsx +++ b/src/components/settings/Config.tsx @@ -40,9 +40,6 @@ const Config = () => { }, []); useEffect(() => { - // skip scan status if server type is funkwhale - if (config.serverType === 'funkwhale') return setScanProgress(0); - // Check scan status on render apiController({ serverType: config.serverType, endpoint: 'getScanStatus' }) .then((status) => { @@ -56,9 +53,6 @@ const Config = () => { }, [config.serverType]); useEffect(() => { - // skip scan status if server type is funkwhale - if (config.serverType === 'funkwhale') return setScanProgress(0); - // Reload scan status on interval during scan if (isScanning) { const interval = setInterval(() => { @@ -131,24 +125,22 @@ const Config = () => { sidetitle={} subsidetitle={ - {useAppSelector((state) => state.config).serverType !== 'funkwhale' && ( - <> - { - apiController({ - serverType: config.serverType, - endpoint: 'startScan', - args: { musicFolderId: folder.musicFolder }, - }); - setIsScanning(true); - }} - disabled={isScanning} - > - {isScanning ? `${scanProgress}` : 'Scan'} - - - )} + <> + { + apiController({ + serverType: config.serverType, + endpoint: 'startScan', + args: { musicFolderId: folder.musicFolder }, + }); + setIsScanning(true); + }} + disabled={isScanning} + > + {isScanning ? `${scanProgress}` : 'Scan'} + + { const [serverType, setServerType] = useState('subsonic'); @@ -34,16 +36,8 @@ const Login = () => { try { const testConnection = legacyAuth - ? serverType === 'subsonic' - ? await axios.get( - `${cleanServerName}/rest/getScanStatus?v=1.15.0&c=sonixd&f=json&u=${userName}&p=${password}` - ) - : await axios.get( - `${cleanServerName}/rest/ping?v=1.15.0&c=sonixd&f=json&u=${userName}&p=${password}` - ) - : serverType === 'subsonic' ? await axios.get( - `${cleanServerName}/rest/getScanStatus?v=1.15.0&c=sonixd&f=json&u=${userName}&s=${salt}&t=${hash}` + `${cleanServerName}/rest/ping?v=1.15.0&c=sonixd&f=json&u=${userName}&p=${password}` ) : await axios.get( `${cleanServerName}/rest/ping?v=1.15.0&c=sonixd&f=json&u=${userName}&s=${salt}&t=${hash}` @@ -66,7 +60,7 @@ const Login = () => { localStorage.setItem('server', cleanServerName); localStorage.setItem('serverBase64', btoa(cleanServerName)); - localStorage.setItem('serverType', serverType); + localStorage.setItem('serverType', 'subsonic'); localStorage.setItem('username', userName); localStorage.setItem('password', password); localStorage.setItem('salt', salt); @@ -74,7 +68,7 @@ const Login = () => { settings.setSync('server', cleanServerName); settings.setSync('serverBase64', btoa(cleanServerName)); - settings.setSync('serverType', serverType); + settings.setSync('serverType', 'subsonic'); settings.setSync('username', userName); settings.setSync('password', password); settings.setSync('salt', salt); @@ -143,19 +137,15 @@ const Login = () => {
Server type - serverTypePickerRef.current} - cleanable={false} - data={[ - { label: 'Subsonic', value: 'subsonic' }, - { label: 'Jellyfin', value: 'jellyfin' }, - { label: 'Funkwhale', value: 'funkwhale' }, - ]} + setServerType(e)} - /> + value={serverType} + onChange={(e: Server) => setServerType(e)} + > + Subsonic + Jellyfin +
Server @@ -164,6 +154,7 @@ const Login = () => { name="servername" value={serverName} onChange={(e: string) => setServerName(e)} + placeholder="Requires http(s)://" />
Username @@ -172,6 +163,7 @@ const Login = () => { name="name" value={userName} onChange={(e: string) => setUserName(e)} + placeholder="Enter username" />
Password @@ -181,6 +173,7 @@ const Login = () => { type="password" value={password} onChange={(e: string) => setPassword(e)} + placeholder="Enter password" />
{serverType !== 'jellyfin' && ( @@ -202,16 +195,15 @@ const Login = () => {
)} - +
diff --git a/src/types.ts b/src/types.ts index b7ef424..2b8373f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,6 @@ export enum Server { Subsonic = 'subsonic', Jellyfin = 'jellyfin', - Funkwhale = 'funkwhale', } export enum Item { @@ -13,7 +12,7 @@ export enum Item { Playlist = 'playlist', } -export type ServerType = Server.Subsonic | Server.Jellyfin | Server.Funkwhale; +export type ServerType = Server.Subsonic | Server.Jellyfin; export type APIEndpoints = | 'getPlaylist'