Merge branch 'main' of https://github.com/classroomio/classroomio into feat/release-v2

This commit is contained in:
Rotimi Best
2025-11-08 20:22:53 +01:00
9 changed files with 84 additions and 74 deletions
+10 -7
View File
@@ -100,11 +100,9 @@ export const load = async ({ url, cookies, request }): Promise<LoadOutput> => {
return response;
}
const answer = !!subdomain;
console.log('subdomain', subdomain);
response.isOrgSite = debugMode || answer;
response.isOrgSite = debugMode || !!subdomain;
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
@@ -172,11 +170,16 @@ function getBaseMetaTags(url: URL) {
}
function getSubdomain(url: URL) {
const host = url.host.replace('www.', '');
const parts = host?.split('.');
const host = url.hostname.replace('www.', '');
const parts = host.split('.');
const appHost = env.PRIVATE_APP_HOST;
if (host?.endsWith(env.PRIVATE_APP_HOST)) {
return parts?.length >= 3 ? parts[0] : null;
const appHostParts = appHost.split('.');
const isAppHost = parts.slice(-appHostParts.length).join('.') === appHost;
if (isAppHost) {
// Subdomain exists only if extra part(s) before main domain
return parts.length > appHostParts.length ? parts[0] : null;
}
return null;