diff --git a/back/src/Kyoo.Authentication/Models/DTO/ServerInfo.cs b/back/src/Kyoo.Authentication/Models/DTO/ServerInfo.cs index 6e9a6b29..50ff3a71 100644 --- a/back/src/Kyoo.Authentication/Models/DTO/ServerInfo.cs +++ b/back/src/Kyoo.Authentication/Models/DTO/ServerInfo.cs @@ -26,6 +26,11 @@ public class ServerInfo /// The list of oidc providers configured for this instance of kyoo. /// public Dictionary Oidc { get; set; } + + /// + /// True if guest accounts are allowed on this instance. + /// + public bool AllowGuests { get; set; } } public class OidcInfo diff --git a/back/src/Kyoo.Authentication/Views/InfoApi.cs b/back/src/Kyoo.Authentication/Views/InfoApi.cs index 3972ac99..fd951935 100644 --- a/back/src/Kyoo.Authentication/Views/InfoApi.cs +++ b/back/src/Kyoo.Authentication/Views/InfoApi.cs @@ -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( x.Key, diff --git a/front/packages/models/src/resources/server-info.ts b/front/packages/models/src/resources/server-info.ts index b2749e51..25faf913 100644 --- a/front/packages/models/src/resources/server-info.ts +++ b/front/packages/models/src/resources/server-info.ts @@ -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`), + }, ]), ), ),