Browse Source

Change Subsonic API version for server support

- 1.15.0 -> 1.13.0
master
jeffvli 3 years ago
committed by Jeff
parent
commit
868c878b99
  1. 18
      src/api/api.ts
  2. 4
      src/components/settings/Login.tsx

18
src/api/api.ts

@ -36,7 +36,7 @@ const authParams = legacyAuth
? { ? {
u: auth.username, u: auth.username,
p: auth.password, p: auth.password,
v: '1.15.0', v: '1.13.0',
c: 'sonixd', c: 'sonixd',
f: 'json', f: 'json',
} }
@ -44,7 +44,7 @@ const authParams = legacyAuth
u: auth.username, u: auth.username,
s: auth.salt, s: auth.salt,
t: auth.hash, t: auth.hash,
v: '1.15.0', v: '1.13.0',
c: 'sonixd', c: 'sonixd',
f: 'json', f: 'json',
}; };
@ -59,7 +59,7 @@ api.interceptors.request.use((config) => {
config.params.s = legacyAuth ? null : auth.salt; config.params.s = legacyAuth ? null : auth.salt;
config.params.t = legacyAuth ? null : auth.hash; config.params.t = legacyAuth ? null : auth.hash;
config.params.p = legacyAuth ? auth.password : null; config.params.p = legacyAuth ? auth.password : null;
config.params.v = '1.15.0'; config.params.v = '1.13.0';
config.params.c = 'sonixd'; config.params.c = 'sonixd';
config.params.f = 'json'; config.params.f = 'json';
return config; return config;
@ -102,7 +102,7 @@ const getCoverArtUrl = (item: any, useLegacyAuth: boolean, size?: number) => {
`?id=${item.coverArt}` + `?id=${item.coverArt}` +
`&u=${auth.username}` + `&u=${auth.username}` +
`&p=${auth.password}` + `&p=${auth.password}` +
`&v=1.15.0` + `&v=1.13.0` +
`&c=sonixd` + `&c=sonixd` +
`${size ? `&size=${size}` : ''}` `${size ? `&size=${size}` : ''}`
); );
@ -114,7 +114,7 @@ const getCoverArtUrl = (item: any, useLegacyAuth: boolean, size?: number) => {
`&u=${auth.username}` + `&u=${auth.username}` +
`&s=${auth.salt}` + `&s=${auth.salt}` +
`&t=${auth.hash}` + `&t=${auth.hash}` +
`&v=1.15.0` + `&v=1.13.0` +
`&c=sonixd` + `&c=sonixd` +
`${size ? `&size=${size}` : ''}` `${size ? `&size=${size}` : ''}`
); );
@ -127,7 +127,7 @@ export const getDownloadUrl = (options: { id: string }, useLegacyAuth = legacyAu
`?id=${options.id}` + `?id=${options.id}` +
`&u=${auth.username}` + `&u=${auth.username}` +
`&p=${auth.password}` + `&p=${auth.password}` +
`&v=1.15.0` + `&v=1.13.0` +
`&c=sonixd` `&c=sonixd`
); );
} }
@ -138,7 +138,7 @@ export const getDownloadUrl = (options: { id: string }, useLegacyAuth = legacyAu
`&u=${auth.username}` + `&u=${auth.username}` +
`&s=${auth.salt}` + `&s=${auth.salt}` +
`&t=${auth.hash}` + `&t=${auth.hash}` +
`&v=1.15.0` + `&v=1.13.0` +
`&c=sonixd` `&c=sonixd`
); );
}; };
@ -150,7 +150,7 @@ const getStreamUrl = (id: string, useLegacyAuth: boolean) => {
`?id=${id}` + `?id=${id}` +
`&u=${auth.username}` + `&u=${auth.username}` +
`&p=${auth.password}` + `&p=${auth.password}` +
`&v=1.15.0` + `&v=1.13.0` +
`&c=sonixd` `&c=sonixd`
); );
} }
@ -161,7 +161,7 @@ const getStreamUrl = (id: string, useLegacyAuth: boolean) => {
`&u=${auth.username}` + `&u=${auth.username}` +
`&s=${auth.salt}` + `&s=${auth.salt}` +
`&t=${auth.hash}` + `&t=${auth.hash}` +
`&v=1.15.0` + `&v=1.13.0` +
`&c=sonixd` `&c=sonixd`
); );
}; };

4
src/components/settings/Login.tsx

@ -37,10 +37,10 @@ const Login = () => {
try { try {
const testConnection = legacyAuth const testConnection = legacyAuth
? await axios.get( ? await axios.get(
`${cleanServerName}/rest/ping?v=1.15.0&c=sonixd&f=json&u=${userName}&p=${password}` `${cleanServerName}/rest/ping?v=1.13.0&c=sonixd&f=json&u=${userName}&p=${password}`
) )
: await axios.get( : await axios.get(
`${cleanServerName}/rest/ping?v=1.15.0&c=sonixd&f=json&u=${userName}&s=${salt}&t=${hash}` `${cleanServerName}/rest/ping?v=1.13.0&c=sonixd&f=json&u=${userName}&s=${salt}&t=${hash}`
); );
// Since a valid request will return a 200 response, we need to check that there // Since a valid request will return a 200 response, we need to check that there

Loading…
Cancel
Save