blob: b23b0460fd0367b1680fb40f92f0d864ba377e62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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;
}
|