mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
Make client param on SS/ND queries consistent
This commit is contained in:
parent
be0ebac362
commit
ca58551b94
3 changed files with 20 additions and 23 deletions
|
|
@ -73,6 +73,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
} else {
|
||||
const salt = randomString(12);
|
||||
const hash = md5(body.password + salt);
|
||||
|
||||
credential = `u=${encodeURIComponent(body.username)}&s=${encodeURIComponent(salt)}&t=${encodeURIComponent(hash)}`;
|
||||
credentialParams = {
|
||||
s: salt,
|
||||
|
|
@ -522,7 +523,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
`?id=${query.id}` +
|
||||
`&${apiClientProps.server?.credential}` +
|
||||
'&v=1.13.0' +
|
||||
'&c=feishin'
|
||||
'&c=Feishin'
|
||||
);
|
||||
},
|
||||
getGenreList: async ({ query, apiClientProps }) => {
|
||||
|
|
@ -672,9 +673,8 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
}
|
||||
|
||||
let results =
|
||||
res.body.playlist.entry?.map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
) || [];
|
||||
res.body.playlist.entry?.map((song) => ssNormalize.song(song, apiClientProps.server)) ||
|
||||
[];
|
||||
|
||||
if (query.sortBy && query.sortOrder) {
|
||||
results = sortSongList(results, query.sortBy, query.sortOrder);
|
||||
|
|
@ -706,7 +706,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
const results = res.body.randomSongs?.song || [];
|
||||
|
||||
return {
|
||||
items: results.map((song) => ssNormalize.song(song, apiClientProps.server, '')),
|
||||
items: results.map((song) => ssNormalize.song(song, apiClientProps.server)),
|
||||
startIndex: 0,
|
||||
totalRecordCount: res.body.randomSongs?.song?.length || 0,
|
||||
};
|
||||
|
|
@ -765,7 +765,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
|
||||
return res.body.similarSongs.song.reduce<Song[]>((acc, song) => {
|
||||
if (song.id !== query.songId) {
|
||||
acc.push(ssNormalize.song(song, apiClientProps.server, ''));
|
||||
acc.push(ssNormalize.song(song, apiClientProps.server));
|
||||
}
|
||||
|
||||
return acc;
|
||||
|
|
@ -784,7 +784,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
throw new Error('Failed to get song detail');
|
||||
}
|
||||
|
||||
return ssNormalize.song(res.body.song, apiClientProps.server, '');
|
||||
return ssNormalize.song(res.body.song, apiClientProps.server);
|
||||
},
|
||||
getSongList: async ({ query, apiClientProps }) => {
|
||||
const fromAlbumPromises = [];
|
||||
|
|
@ -811,7 +811,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
return {
|
||||
items:
|
||||
res.body.searchResult3?.song?.map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
ssNormalize.song(song, apiClientProps.server),
|
||||
) || [],
|
||||
startIndex: query.startIndex,
|
||||
totalRecordCount: null,
|
||||
|
|
@ -835,8 +835,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
const results = res.body.songsByGenre?.song || [];
|
||||
|
||||
return {
|
||||
items:
|
||||
results.map((song) => ssNormalize.song(song, apiClientProps.server, '')) || [],
|
||||
items: results.map((song) => ssNormalize.song(song, apiClientProps.server)) || [],
|
||||
startIndex: 0,
|
||||
totalRecordCount: null,
|
||||
};
|
||||
|
|
@ -855,7 +854,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
|
||||
const results =
|
||||
(res.body.starred?.song || []).map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
ssNormalize.song(song, apiClientProps.server),
|
||||
) || [];
|
||||
|
||||
return {
|
||||
|
|
@ -925,7 +924,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
}
|
||||
|
||||
return {
|
||||
items: results.map((song) => ssNormalize.song(song, apiClientProps.server, '')),
|
||||
items: results.map((song) => ssNormalize.song(song, apiClientProps.server)),
|
||||
startIndex: 0,
|
||||
totalRecordCount: results.length,
|
||||
};
|
||||
|
|
@ -950,7 +949,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
return {
|
||||
items:
|
||||
res.body.searchResult3?.song?.map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
ssNormalize.song(song, apiClientProps.server),
|
||||
) || [],
|
||||
startIndex: 0,
|
||||
totalRecordCount: null,
|
||||
|
|
@ -1183,7 +1182,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
return {
|
||||
items:
|
||||
res.body.topSongs?.song?.map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
ssNormalize.song(song, apiClientProps.server),
|
||||
) || [],
|
||||
startIndex: 0,
|
||||
totalRecordCount: res.body.topSongs?.song?.length || 0,
|
||||
|
|
@ -1258,7 +1257,7 @@ export const SubsonicController: ControllerEndpoint = {
|
|||
ssNormalize.album(album, apiClientProps.server),
|
||||
),
|
||||
songs: (res.body.searchResult3?.song || []).map((song) =>
|
||||
ssNormalize.song(song, apiClientProps.server, ''),
|
||||
ssNormalize.song(song, apiClientProps.server),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue