Add option to allow extra domains in the auth cookie other than the one in base url (#39)

* Add CONFIG_ALLOWED_COOKIE_DOMAINS option

* Apply suggestions from @BrunoBernardino

---------

Co-authored-by: Bruno Bernardino <me@brunobernardino.com>
This commit is contained in:
Sergio
2025-01-11 09:09:11 +02:00
committed by GitHub
parent aaeaac0285
commit 8929b6e7d2
2 changed files with 15 additions and 0 deletions

View File

@@ -20,6 +20,16 @@ export function isAppEnabled(app: 'news' | 'notes' | 'photos') {
return enabledApps.includes(app);
}
export function isCookieDomainAllowed(domain: string) {
const allowedDomains = (Deno.env.get('CONFIG_ALLOWED_COOKIE_DOMAINS') || '').split(',') as typeof domain[];
if (allowedDomains.length === 0) {
return true;
}
return allowedDomains.includes(domain);
}
export function isEmailEnabled() {
const areEmailsAllowed = Deno.env.get('CONFIG_ENABLE_EMAILS') === 'true';