2026-06-07 18:43:05 +01:00
|
|
|
const {
|
|
|
|
|
DASHBOARD_ORIGIN,
|
|
|
|
|
PUBLIC_IS_SELFHOSTED,
|
|
|
|
|
PUBLIC_SERVER_URL,
|
|
|
|
|
TRUSTED_ORIGINS: TRUSTED_ORIGINS_STRING
|
|
|
|
|
} = process.env;
|
|
|
|
|
|
|
|
|
|
const dashboardOrigin = DASHBOARD_ORIGIN?.trim().replace(/\/$/, '');
|
2026-03-09 11:18:22 +01:00
|
|
|
|
|
|
|
|
const DEFAULT_TRUSTED_ORIGINS = [
|
|
|
|
|
'http://localhost:5173',
|
2026-05-19 09:59:56 +01:00
|
|
|
'https://*.classroomio.com',
|
2026-05-21 11:29:47 +01:00
|
|
|
'https://*.myclassroomio.com',
|
2026-03-09 11:18:22 +01:00
|
|
|
// Common OIDC IdP discovery origins (SSO registration fetches .well-known/openid-configuration)
|
|
|
|
|
'https://accounts.google.com',
|
|
|
|
|
'https://account.google.com', // common typo for Google
|
|
|
|
|
'https://oauth2.googleapis.com', // Google token endpoint (from discovery)
|
|
|
|
|
'https://openidconnect.googleapis.com', // Google userinfo endpoint (from discovery)
|
|
|
|
|
'https://www.googleapis.com', // Google jwks_uri (from discovery)
|
|
|
|
|
'https://login.microsoftonline.com',
|
|
|
|
|
'https://login.live.com',
|
|
|
|
|
'https://auth0.com',
|
|
|
|
|
'https://login.okta.com'
|
|
|
|
|
];
|
2025-11-24 01:00:50 +01:00
|
|
|
|
2026-06-07 18:43:05 +01:00
|
|
|
export const TRUSTED_ORIGINS = [
|
|
|
|
|
...DEFAULT_TRUSTED_ORIGINS,
|
|
|
|
|
...(TRUSTED_ORIGINS_STRING
|
|
|
|
|
? TRUSTED_ORIGINS_STRING.split(',')
|
|
|
|
|
.map((origin) => origin.trim())
|
2026-03-09 11:18:22 +01:00
|
|
|
.filter(Boolean)
|
2026-06-07 18:43:05 +01:00
|
|
|
: []),
|
|
|
|
|
...(dashboardOrigin ? [dashboardOrigin] : [])
|
|
|
|
|
];
|
2025-11-24 01:00:50 +01:00
|
|
|
|
2026-06-07 18:43:05 +01:00
|
|
|
export const BASE_URL =
|
|
|
|
|
PUBLIC_IS_SELFHOSTED === 'true' && dashboardOrigin ? dashboardOrigin : PUBLIC_SERVER_URL || 'http://localhost:3002';
|