From 347c7193d0b993b543fd119459282b6ac1b481c7 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 2 Mar 2026 13:27:49 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20rcal=20API=20base=20URL=20=E2=80=94=20ma?= =?UTF-8?q?tch=20/rcal=20path=20and=20fall=20back=20to=20space=20attribute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The regex matched /cal instead of /rcal, so getApiBase() always returned empty string, causing 404s on api/events, api/lunar, and api/sources. Co-Authored-By: Claude Opus 4.6 --- modules/rcal/components/folk-calendar-view.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/rcal/components/folk-calendar-view.ts b/modules/rcal/components/folk-calendar-view.ts index fa1eed2..bcaddd0 100644 --- a/modules/rcal/components/folk-calendar-view.ts +++ b/modules/rcal/components/folk-calendar-view.ts @@ -348,8 +348,12 @@ class FolkCalendarView extends HTMLElement { // ── API ── private getApiBase(): string { - const match = window.location.pathname.match(/^\/([^/]+)\/cal/); - return match ? `/${match[1]}/cal` : ""; + // When on the rcal page directly, extract from URL + const match = window.location.pathname.match(/^\/([^/]+)\/rcal/); + if (match) return `/${match[1]}/rcal`; + // When embedded as a canvas shape, use the space attribute + if (this.space) return `/${this.space}/rcal`; + return ""; } private async loadMonth() {