EDUrocks's picture
Add files using upload-large-folder tool
77bd40d verified
Raw History Blame Contribute Delete
935 Bytes
/**
* EDUrocks 3.0 - Domain Utilities
* Handles domain detection and proxy URL generation
*/
export function getCurrentDomain() {
let domain = window.location.hostname;
// Remove specific subdomains (www, devbuild) to get root domain
if (domain.startsWith('www.')) {
domain = domain.substring(4);
} else if (domain.startsWith('devbuild.')) {
domain = domain.substring(9);
}
return domain;
}
export function getProxyURL() {
// If AWS detection has set eduBackendRoot to rockedu.site, use that for proxy too
if (window.eduBackendRoot && window.eduBackendRoot.includes('rockedu.site')) {
return 'https://vedap.rockedu.site';
}
// Otherwise use the current domain
const domain = getCurrentDomain();
return `https://vedap.${domain}`;
}
// Make available globally for compatibility
window.getCurrentDomain = getCurrentDomain;
window.getProxyURL = getProxyURL;