ci: cypres test setup(#274)
* fix: font size broken * add first cypress test * save onboarding language * load language * get first test to work * update command * install pnpm * update workflow * install * update * test * increase timeout * another update * update 2 * update 3 * upsdada 4 * sfgsfgf 5 * add def supabase url * fix supabase issue * add ci * fix ci * update .env.example * update port * tired * prepare * preview * this is it * ????? * 99999900 * fix log issue * ci * nkkh * ===== * 200000
This commit is contained in:
@@ -5,6 +5,7 @@ import { getCurrentOrg } from '$lib/utils/services/org';
|
||||
import { getSupabase, supabase } from '$lib/utils/functions/supabase';
|
||||
import { loadTranslations } from '$lib/utils/functions/translations';
|
||||
import type { CurrentOrg } from '$lib/utils/types/org';
|
||||
import { PRIVATE_APP_SUBDOMAINS } from '$env/static/private';
|
||||
|
||||
if (!supabase) {
|
||||
getSupabase();
|
||||
@@ -32,6 +33,8 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
|
||||
const matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/);
|
||||
const subdomain = matches?.[1] ?? '';
|
||||
|
||||
const isDev = dev || url.host.includes('localhost');
|
||||
|
||||
if (!url.host.includes('.classroomio.com') && !url.host.includes('localhost')) {
|
||||
// TODO: We can verify if custom domain here
|
||||
return response;
|
||||
@@ -43,14 +46,13 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
|
||||
response.isOrgSite = debugMode || answer;
|
||||
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
|
||||
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
|
||||
|
||||
|
||||
if (!response.org && !dev) {
|
||||
if (!response.org && !isDev) {
|
||||
throw redirect(307, 'https://app.classroomio.com/404?type=org');
|
||||
}
|
||||
} else if (subdomain === 'play' || debugPlay === 'true') {
|
||||
response.skipAuth = true;
|
||||
} else if (subdomain !== 'app' && !dev) {
|
||||
} else if (PRIVATE_APP_SUBDOMAINS.split(',').includes(subdomain) && !isDev) {
|
||||
throw redirect(307, 'https://app.classroomio.com');
|
||||
}
|
||||
|
||||
@@ -67,7 +69,7 @@ function getInitialLocale(): string {
|
||||
if (browser) {
|
||||
try {
|
||||
return window.navigator.language.split('-')[0];
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
return 'en';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user