2 * Replaces the origin to match the current origin, if running using `local-sso`.
5 export const replaceLocalURL = (href: string) => {
6 // Ignore if not in local-sso
7 if (!window.location.hostname.endsWith('proton.local')) {
11 const url = new URL(href);
12 const newSubdomain = url.hostname.split('.')[0];
13 const subdomain = window.location.hostname.split('.')[0];
15 // Replace host to preserve the port for local-sso
16 return href.replace(url.host, window.location.host.replace(subdomain, newSubdomain));