mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 20:40:15 +02:00
add isAdmin to auth state
This commit is contained in:
@@ -91,6 +91,7 @@ export const JellyfinController: InternalControllerEndpoint = {
|
||||
|
||||
return {
|
||||
credential: res.body.AccessToken,
|
||||
isAdmin: Boolean(res.body.User.Policy.IsAdministrator),
|
||||
userId: res.body.User.Id,
|
||||
username: res.body.User.Name,
|
||||
};
|
||||
|
||||
@@ -131,6 +131,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
|
||||
return {
|
||||
credential: `u=${body.username}&s=${res.body.data.subsonicSalt}&t=${res.body.data.subsonicToken}`,
|
||||
isAdmin: Boolean(res.body.data.isAdmin),
|
||||
ndCredential: res.body.data.token,
|
||||
userId: res.body.data.id,
|
||||
username: res.body.data.username,
|
||||
|
||||
@@ -16,7 +16,7 @@ const c = initContract();
|
||||
export const contract = c.router({
|
||||
authenticate: {
|
||||
method: 'GET',
|
||||
path: 'ping.view',
|
||||
path: 'getUser.view',
|
||||
query: ssType._parameters.authenticate,
|
||||
responses: {
|
||||
200: ssType._response.authenticate,
|
||||
|
||||
@@ -132,6 +132,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
query: {
|
||||
c: 'Feishin',
|
||||
f: 'json',
|
||||
username: body.username,
|
||||
v: '1.13.0',
|
||||
...credentialParams,
|
||||
},
|
||||
@@ -143,7 +144,8 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
|
||||
return {
|
||||
credential,
|
||||
userId: null,
|
||||
isAdmin: resp.body.user.adminRoles,
|
||||
userId: resp.body.user.username,
|
||||
username: body.username,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user