diff --git a/modules/rsocials/components/folk-campaign-manager.ts b/modules/rsocials/components/folk-campaign-manager.ts index 8b9c0f6..c03a9c6 100644 --- a/modules/rsocials/components/folk-campaign-manager.ts +++ b/modules/rsocials/components/folk-campaign-manager.ts @@ -72,6 +72,14 @@ export class FolkCampaignManager extends HTMLElement { }); } + private get basePath() { + const host = window.location.hostname; + if (host.endsWith('.rspace.online') || host.endsWith('.rsocials.online')) { + return '/rsocials/'; + } + return `/${this._space}/rsocials/`; + } + private esc(s: string): string { return s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } @@ -131,7 +139,7 @@ export class FolkCampaignManager extends HTMLElement {
${phaseHTML} diff --git a/modules/rsocials/components/folk-campaign-planner.ts b/modules/rsocials/components/folk-campaign-planner.ts index 34787b9..b610e47 100644 --- a/modules/rsocials/components/folk-campaign-planner.ts +++ b/modules/rsocials/components/folk-campaign-planner.ts @@ -121,6 +121,14 @@ class FolkCampaignPlanner extends HTMLElement { private shadow: ShadowRoot; private space = ''; + private get basePath() { + const host = window.location.hostname; + if (host.endsWith('.rspace.online') || host.endsWith('.rsocials.online')) { + return '/rsocials/'; + } + return `/${this.space}/rsocials/`; + } + // Data private nodes: CampaignPlannerNode[] = []; private edges: CampaignEdge[] = []; @@ -820,7 +828,7 @@ class FolkCampaignPlanner extends HTMLElement { } else if (action === 'open-thread') { const d = node.data as ThreadNodeData; if (d.threadId) { - window.location.href = `/rsocials/thread-editor/${d.threadId}/edit`; + window.location.href = `${this.basePath}thread-editor/${d.threadId}/edit`; } } }); @@ -1457,7 +1465,7 @@ class FolkCampaignPlanner extends HTMLElement { if (node?.type === 'thread') { const d = node.data as ThreadNodeData; if (d.threadId) { - window.location.href = `/rsocials/thread-editor/${d.threadId}/edit`; + window.location.href = `${this.basePath}thread-editor/${d.threadId}/edit`; } } }); diff --git a/modules/rsocials/components/folk-thread-builder.ts b/modules/rsocials/components/folk-thread-builder.ts index 89f1386..37ba06f 100644 --- a/modules/rsocials/components/folk-thread-builder.ts +++ b/modules/rsocials/components/folk-thread-builder.ts @@ -274,7 +274,7 @@ export class FolkThreadBuilder extends HTMLElement {