chore: debug lms detection on client side
This commit is contained in:
@@ -172,15 +172,16 @@ function getBaseMetaTags(url: URL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getSubdomain(url: URL) {
|
function getSubdomain(url: URL) {
|
||||||
console.log('url.host', url);
|
const host = url.hostname.replace('www.', '');
|
||||||
const host = url.host.replace('www.', '');
|
const parts = host.split('.');
|
||||||
console.log('host', host);
|
const appHost = env.PRIVATE_APP_HOST;
|
||||||
const parts = host?.split('.');
|
|
||||||
console.log('parts', parts);
|
|
||||||
|
|
||||||
if (host?.endsWith(env.PRIVATE_APP_HOST)) {
|
const appHostParts = appHost.split('.');
|
||||||
console.log('is app host');
|
const isAppHost = parts.slice(-appHostParts.length).join('.') === appHost;
|
||||||
return parts?.length >= 3 ? parts[0] : null;
|
|
||||||
|
if (isAppHost) {
|
||||||
|
// Subdomain exists only if extra part(s) before main domain
|
||||||
|
return parts.length > appHostParts.length ? parts[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -52,7 +52,8 @@
|
|||||||
console.log(
|
console.log(
|
||||||
'Welcome to ClassroomIO, we are grateful you chose us.',
|
'Welcome to ClassroomIO, we are grateful you chose us.',
|
||||||
$page.url.host,
|
$page.url.host,
|
||||||
`\nIs student domain: ${data.isOrgSite}`
|
`\nIs student domain: ${data.isOrgSite}`,
|
||||||
|
data
|
||||||
);
|
);
|
||||||
|
|
||||||
if (browser) {
|
if (browser) {
|
||||||
@@ -100,7 +101,7 @@
|
|||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.isOrgSite && data.org && !$currentOrg.siteName) {
|
if (data.isOrgSite && data.org && $currentOrg.siteName !== data.org.siteName) {
|
||||||
$globalStore.orgSiteName = data.orgSiteName;
|
$globalStore.orgSiteName = data.orgSiteName;
|
||||||
$globalStore.isOrgSite = data.isOrgSite;
|
$globalStore.isOrgSite = data.isOrgSite;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user