fix(auth): preserve active tab through login on bare domain
The identity component's inline _getCurrentModule() assumed path-based
routing (/{space}/{moduleId}) for non-subdomain URLs, returning "rspace"
instead of the actual module. On bare domain (rspace.online/rnotes),
this caused login to redirect to the canvas instead of rnotes.
Add _isBareDomain() check so _getCurrentSpace() returns "demo" and
_getCurrentModule() reads parts[0] (the module) on the bare domain.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
22b5c00a13
commit
423d2612af
|
|
@ -323,13 +323,19 @@ function _isSubdomain(): boolean {
|
||||||
const p = window.location.host.split(":")[0].split(".");
|
const p = window.location.host.split(":")[0].split(".");
|
||||||
return p.length >= 3 && p.slice(-2).join(".") === "rspace.online" && !_RESERVED.includes(p[0]);
|
return p.length >= 3 && p.slice(-2).join(".") === "rspace.online" && !_RESERVED.includes(p[0]);
|
||||||
}
|
}
|
||||||
|
function _isBareDomain(): boolean {
|
||||||
|
const h = window.location.host.split(":")[0];
|
||||||
|
return h === "rspace.online" || h === "www.rspace.online";
|
||||||
|
}
|
||||||
function _getCurrentSpace(): string {
|
function _getCurrentSpace(): string {
|
||||||
if (_isSubdomain()) return window.location.host.split(":")[0].split(".")[0];
|
if (_isSubdomain()) return window.location.host.split(":")[0].split(".")[0];
|
||||||
|
if (_isBareDomain()) return "demo";
|
||||||
return window.location.pathname.split("/").filter(Boolean)[0] || "demo";
|
return window.location.pathname.split("/").filter(Boolean)[0] || "demo";
|
||||||
}
|
}
|
||||||
function _getCurrentModule(): string {
|
function _getCurrentModule(): string {
|
||||||
const parts = window.location.pathname.split("/").filter(Boolean);
|
const parts = window.location.pathname.split("/").filter(Boolean);
|
||||||
return _isSubdomain() ? (parts[0] || "rspace") : (parts[1] || "rspace");
|
if (_isSubdomain() || _isBareDomain()) return parts[0] || "rspace";
|
||||||
|
return parts[1] || "rspace";
|
||||||
}
|
}
|
||||||
function _navUrl(space: string, moduleId: string): string {
|
function _navUrl(space: string, moduleId: string): string {
|
||||||
const h = window.location.host.split(":")[0].split(".");
|
const h = window.location.host.split(":")[0].split(".");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue