Add allow guests to the server-info struct

This commit is contained in:
Zoe Roux 2024-03-04 23:44:26 +01:00
parent c48ee975c6
commit f4464578c0
3 changed files with 14 additions and 1 deletions

View File

@ -26,6 +26,11 @@ public class ServerInfo
/// The list of oidc providers configured for this instance of kyoo.
/// </summary>
public Dictionary<string, OidcInfo> Oidc { get; set; }
/// <summary>
/// True if guest accounts are allowed on this instance.
/// </summary>
public bool AllowGuests { get; set; }
}
public class OidcInfo

View File

@ -38,6 +38,7 @@ public class InfoApi(PermissionOption options) : ControllerBase
return Ok(
new ServerInfo()
{
AllowGuests = options.Default.Any(),
Oidc = options
.OIDC.Select(x => new KeyValuePair<string, OidcInfo>(
x.Key,

View File

@ -33,6 +33,10 @@ export const OidcInfoP = z.object({
});
export const ServerInfoP = z.object({
/*
* True if guest accounts are allowed on this instance.
*/
allowGuests: z.boolean(),
/*
* The list of oidc providers configured for this instance of kyoo.
*/
@ -42,7 +46,10 @@ export const ServerInfoP = z.object({
Object.fromEntries(
Object.entries(x).map(([provider, info]) => [
provider,
{ ...info, link: imageFn(`/auth/login/${provider}?redirectUrl=${baseAppUrl()}/login/callback`) },
{
...info,
link: imageFn(`/auth/login/${provider}?redirectUrl=${baseAppUrl()}/login/callback`),
},
]),
),
),