mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 04:50:12 +02:00
check authentication for all servers on initialization and update permission roles
This commit is contained in:
@@ -204,6 +204,14 @@ export const contract = c.router({
|
||||
200: ssType._response.topSongsList,
|
||||
},
|
||||
},
|
||||
getUser: {
|
||||
method: 'GET',
|
||||
path: 'getUser.view',
|
||||
query: ssType._parameters.user,
|
||||
responses: {
|
||||
200: ssType._response.user,
|
||||
},
|
||||
},
|
||||
ping: {
|
||||
method: 'GET',
|
||||
path: 'ping.view',
|
||||
|
||||
@@ -144,7 +144,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
|
||||
return {
|
||||
credential,
|
||||
isAdmin: resp.body.user.adminRoles,
|
||||
isAdmin: Boolean(resp.body.user.adminRole),
|
||||
userId: resp.body.user.username,
|
||||
username: body.username,
|
||||
};
|
||||
@@ -1472,6 +1472,25 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
totalRecordCount: res.body.topSongs?.song?.length || 0,
|
||||
};
|
||||
},
|
||||
getUserInfo: async (args) => {
|
||||
const { apiClientProps, query } = args;
|
||||
|
||||
const res = await ssApiClient(apiClientProps).getUser({
|
||||
query: {
|
||||
id: query.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error('Failed to get user info');
|
||||
}
|
||||
|
||||
return {
|
||||
id: res.body.user.username,
|
||||
isAdmin: Boolean(res.body.user.adminRole),
|
||||
name: res.body.user.username,
|
||||
};
|
||||
},
|
||||
removeFromPlaylist: async ({ apiClientProps, query }) => {
|
||||
const res = await ssApiClient(apiClientProps).updatePlaylist({
|
||||
query: {
|
||||
@@ -1583,7 +1602,6 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
search: async (args) => {
|
||||
const { apiClientProps, query } = args;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user