check authentication for all servers on initialization and update permission roles

This commit is contained in:
jeffvli
2025-12-07 17:53:26 -08:00
parent 4ddada1fe3
commit c82762a3fc
10 changed files with 283 additions and 44 deletions
@@ -247,6 +247,14 @@ export const contract = c.router({
400: jfType._response.error,
},
},
getUser: {
method: 'GET',
path: 'users/:id',
responses: {
200: jfType._response.user,
400: jfType._response.error,
},
},
movePlaylistItem: {
body: null,
method: 'POST',
@@ -1127,6 +1127,25 @@ export const JellyfinController: InternalControllerEndpoint = {
totalRecordCount: res.body.TotalRecordCount,
};
},
getUserInfo: async (args) => {
const { apiClientProps, query } = args;
const res = await jfApiClient(apiClientProps).getUser({
params: {
id: query.id,
},
});
if (res.status !== 200) {
throw new Error('Failed to get user info');
}
return {
id: res.body.Id,
isAdmin: Boolean(res.body.Policy.IsAdministrator),
name: res.body.Name,
};
},
movePlaylistItem: async (args) => {
const { apiClientProps, query } = args;