fix: prevent double space prefix in dashboard links on subdomains
Dashboard card hrefs were /{space}/{moduleId}, causing double-prefix
(/demo/demo/rbooks) when accessed via demo.rspace.online subdomain
routing. Now renders /{moduleId} and resolves via __rspaceNavUrl on
the client for cross-context compatibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
db078d3152
commit
bf1d126ee5
|
|
@ -252,9 +252,8 @@ export function renderSpaceDashboard(space: string, modules: ModuleInfo[]): stri
|
|||
|
||||
const appCards = modules
|
||||
.map((m) => {
|
||||
const href = `/${escapeAttr(space)}/${escapeAttr(m.id)}`;
|
||||
return `
|
||||
<a href="${href}" class="sd-card">
|
||||
<a href="/${escapeAttr(m.id)}" class="sd-card" data-module="${escapeAttr(m.id)}">
|
||||
<div class="sd-card__icon">${m.icon}</div>
|
||||
<div class="sd-card__body">
|
||||
<h3 class="sd-card__name">${escapeHtml(m.name)}</h3>
|
||||
|
|
@ -310,6 +309,13 @@ export function renderSpaceDashboard(space: string, modules: ModuleInfo[]): stri
|
|||
<script type="module">
|
||||
import '/shell.js';
|
||||
document.querySelector('rstack-app-switcher')?.setModules(${moduleListJSON});
|
||||
|
||||
// Fix up dashboard links to be subdomain-aware
|
||||
if (window.__rspaceNavUrl) {
|
||||
document.querySelectorAll('.sd-card[data-module]').forEach(card => {
|
||||
card.href = window.__rspaceNavUrl('${escapeAttr(space)}', card.dataset.module);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue