mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Add guest permissions to server info
This commit is contained in:
parent
df6f9ea71d
commit
158058b720
@ -31,6 +31,11 @@ public class ServerInfo
|
||||
/// True if guest accounts are allowed on this instance.
|
||||
/// </summary>
|
||||
public bool AllowGuests { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of permissions available for the guest account.
|
||||
/// </summary>
|
||||
public List<string> GuestPermissions { get; set; }
|
||||
}
|
||||
|
||||
public class OidcInfo
|
||||
|
@ -39,6 +39,7 @@ public class InfoApi(PermissionOption options) : ControllerBase
|
||||
new ServerInfo()
|
||||
{
|
||||
AllowGuests = options.Default.Any(),
|
||||
GuestPermissions = options.Default.ToList(),
|
||||
Oidc = options
|
||||
.OIDC.Select(x => new KeyValuePair<string, OidcInfo>(
|
||||
x.Key,
|
||||
|
@ -37,22 +37,24 @@ export const ServerInfoP = z.object({
|
||||
* True if guest accounts are allowed on this instance.
|
||||
*/
|
||||
allowGuests: z.boolean(),
|
||||
/*
|
||||
* The list of permissions available for the guest account.
|
||||
*/
|
||||
guestPermissions: z.array(z.string()),
|
||||
/*
|
||||
* The list of oidc providers configured for this instance of kyoo.
|
||||
*/
|
||||
oidc: z
|
||||
.record(z.string(), OidcInfoP)
|
||||
.transform((x) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(x).map(([provider, info]) => [
|
||||
provider,
|
||||
{
|
||||
...info,
|
||||
link: imageFn(`/auth/login/${provider}?redirectUrl=${baseAppUrl()}/login/callback`),
|
||||
},
|
||||
]),
|
||||
),
|
||||
oidc: z.record(z.string(), OidcInfoP).transform((x) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(x).map(([provider, info]) => [
|
||||
provider,
|
||||
{
|
||||
...info,
|
||||
link: imageFn(`/auth/login/${provider}?redirectUrl=${baseAppUrl()}/login/callback`),
|
||||
},
|
||||
]),
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user