import { Env_is_development } from './env'; import type { UserAuth } from './auth_types'; export function Auth_user_can_upload(user: UserAuth): boolean { if (!user.isLoggedIn) return false; if (Env_is_development()) return true; return user.oauth && user.email.endsWith("@campus.fct.unl.pt"); } export function Auth_tinyauth_endpoint(): string { const endpoint = process.env.TINYAUTH_ENDPOINT; if (endpoint == undefined) throw new Error(`env var TINYAUTH_ENDPOINT not defined`); return endpoint; } export function Auth_tinyauth_public_endpoint(): string { const endpoint = process.env.TINYAUTH_PUBLIC_ENDPOINT; if (endpoint == undefined) throw new Error(`env var TINYAUTH_PUBLIC_ENDPOINT not defined`); return endpoint; }