Merge branch 'dev' — resolve getApiBase conflicts (take dev version)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-02 21:02:31 -08:00
commit a01c5fc267
16 changed files with 55 additions and 68 deletions

View File

@ -354,8 +354,8 @@ class FolkCalendarView extends HTMLElement {
private getApiBase(): string { private getApiBase(): string {
// When on the rcal page directly, extract from URL // When on the rcal page directly, extract from URL
const match = window.location.pathname.match(/^\/([^/]+)\/rcal/); const match = window.location.pathname.match(/^(\/[^/]+)?\/rcal/);
if (match) return `/${match[1]}/rcal`; if (match) return match[0];
// When embedded as a canvas shape, use the space attribute // When embedded as a canvas shape, use the space attribute
if (this.space) return `/${this.space}/rcal`; if (this.space) return `/${this.space}/rcal`;
return ""; return "";

View File

@ -183,10 +183,9 @@ class FolkCartShop extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rcart/); const path = window.location.pathname;
if (match) return `/${match[1]}/rcart`; const match = path.match(/^(\/[^/]+)?\/rcart/);
if (this.space) return `/${this.space}/rcart`; return match ? match[0] : "/rcart";
return "/demo/rcart";
} }
private async loadData() { private async loadData() {

View File

@ -42,10 +42,9 @@ class FolkChoicesDashboard extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rchoices/); const path = window.location.pathname;
if (match) return `/${match[1]}/rchoices`; const match = path.match(/^(\/[^/]+)?\/rchoices/);
if (this.space) return `/${this.space}/rchoices`; return match ? match[0] : "/rchoices";
return "/demo/rchoices";
} }
private async loadChoices() { private async loadChoices() {

View File

@ -160,10 +160,9 @@ class FolkFileBrowser extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rfiles/); const path = window.location.pathname;
if (match) return `/${match[1]}/rfiles`; const match = path.match(/^(\/[^/]+)?\/rfiles/);
if (this.space) return `/${this.space}/rfiles`; return match ? match[0] : "";
return "";
} }
private formatSize(bytes: number): string { private formatSize(bytes: number): string {

View File

@ -42,10 +42,9 @@ class FolkForumDashboard extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rforum/); const path = window.location.pathname;
if (match) return `/${match[1]}/rforum`; const match = path.match(/^(\/[^/]+)?\/rforum/);
if (this.space) return `/${this.space}/rforum`; return match ? match[0] : "";
return "";
} }
private getAuthHeaders(): Record<string, string> { private getAuthHeaders(): Record<string, string> {

View File

@ -131,10 +131,10 @@ class FolkFundsApp extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rfunds/); const path = window.location.pathname;
if (match) return `/${match[1]}/rfunds`; // Subdomain: /rfunds/... or Direct: /{space}/rfunds/...
if (this.space) return `/${this.space}/rfunds`; const match = path.match(/^(\/[^/]+)?\/rfunds/);
return ""; return match ? `${match[0]}` : "";
} }
private async loadFlows() { private async loadFlows() {
@ -222,7 +222,7 @@ class FolkFundsApp extends HTMLElement {
// ─── Landing page ────────────────────────────────────── // ─── Landing page ──────────────────────────────────────
private renderLanding(): string { private renderLanding(): string {
const demoUrl = this.getApiBase() ? `${this.getApiBase().replace(/\/funds$/, "")}/funds/demo` : "/demo"; const demoUrl = this.getApiBase() ? `${this.getApiBase()}/demo` : "/rfunds/demo";
const authed = isAuthenticated(); const authed = isAuthenticated();
const username = getUsername(); const username = getUsername();
@ -326,8 +326,8 @@ class FolkFundsApp extends HTMLElement {
private renderFlowCard(f: FlowSummary): string { private renderFlowCard(f: FlowSummary): string {
const detailUrl = this.getApiBase() const detailUrl = this.getApiBase()
? `${this.getApiBase().replace(/\/funds$/, "")}/funds/flow/${encodeURIComponent(f.id)}` ? `${this.getApiBase()}/flow/${encodeURIComponent(f.id)}`
: `/flow/${encodeURIComponent(f.id)}`; : `/rfunds/flow/${encodeURIComponent(f.id)}`;
const value = f.totalValue != null ? `$${Math.floor(f.totalValue).toLocaleString()}` : ""; const value = f.totalValue != null ? `$${Math.floor(f.totalValue).toLocaleString()}` : "";
return ` return `
@ -346,8 +346,8 @@ class FolkFundsApp extends HTMLElement {
private renderDetail(): string { private renderDetail(): string {
const backUrl = this.getApiBase() const backUrl = this.getApiBase()
? `${this.getApiBase().replace(/\/funds$/, "")}/funds/` ? `${this.getApiBase()}/`
: "/"; : "/rfunds/";
return ` return `
<div class="funds-detail"> <div class="funds-detail">
@ -2269,8 +2269,8 @@ class FolkFundsApp extends HTMLElement {
// Navigate to the new flow // Navigate to the new flow
if (flowId) { if (flowId) {
const detailUrl = this.getApiBase() const detailUrl = this.getApiBase()
? `${this.getApiBase().replace(/\/funds$/, "")}/funds/flow/${encodeURIComponent(flowId)}` ? `${this.getApiBase()}/flow/${encodeURIComponent(flowId)}`
: `/flow/${encodeURIComponent(flowId)}`; : `/rfunds/flow/${encodeURIComponent(flowId)}`;
window.location.href = detailUrl; window.location.href = detailUrl;
return; return;
} }

View File

@ -773,10 +773,9 @@ class FolkMapViewer extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rmaps/); const path = window.location.pathname;
if (match) return `/${match[1]}/rmaps`; const match = path.match(/^(\/[^/]+)?\/rmaps/);
if (this.space) return `/${this.space}/rmaps`; return match ? match[0] : "";
return "";
} }
private async checkSyncHealth() { private async checkSyncHealth() {

View File

@ -106,10 +106,9 @@ class FolkGraphViewer extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rnetwork/); const path = window.location.pathname;
if (match) return `/${match[1]}/rnetwork`; const match = path.match(/^(\/[^/]+)?\/rnetwork/);
if (this.space) return `/${this.space}/rnetwork`; return match ? match[0] : "";
return "";
} }
private async loadData() { private async loadData() {

View File

@ -632,10 +632,9 @@ Gear: EUR 400 (10%)</code></pre><p><em>Maya is tracking expenses in rF
// ── REST (notebook list + search) ── // ── REST (notebook list + search) ──
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rnotes/); const path = window.location.pathname;
if (match) return `/${match[1]}/rnotes`; const match = path.match(/^(\/[^/]+)?\/rnotes/);
if (this.space) return `/${this.space}/rnotes`; return match ? match[0] : "";
return "";
} }
private async loadNotebooks() { private async loadNotebooks() {

View File

@ -113,12 +113,12 @@ class FolkPhotoGallery extends HTMLElement {
private getApiBase(): string { private getApiBase(): string {
const path = window.location.pathname; const path = window.location.pathname;
const match = path.match(/^\/([^/]+)\/rphotos/); const match = path.match(/^(\/[^/]+)?\/rphotos/);
return match ? `/${match[1]}/rphotos` : ""; return match ? match[0] : "";
} }
private getImmichUrl(): string { private getImmichUrl(): string {
return `/${this.space}/rphotos/album`; return `${this.getApiBase()}/album`;
} }
private async loadGallery() { private async loadGallery() {

View File

@ -183,10 +183,9 @@ class FolkSwagDesigner extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rswag/); const path = window.location.pathname;
if (match) return `/${match[1]}/rswag`; const match = path.match(/^(\/[^/]+)?\/rswag/);
if (this.space) return `/${this.space}/rswag`; return match ? match[0] : "/rswag";
return "/demo/rswag";
} }
private getDemoProduct(): DemoProduct { private getDemoProduct(): DemoProduct {

View File

@ -41,10 +41,9 @@ class FolkRoutePlanner extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rtrips/); const path = window.location.pathname;
if (match) return `/${match[1]}/rtrips`; const match = path.match(/^(\/[^/]+)?\/rtrips/);
if (this.space) return `/${this.space}/rtrips`; return match ? match[0] : "/rtrips";
return "/demo/rtrips";
} }
private async fetchRoute(input: RouteInput): Promise<FittedRoute> { private async fetchRoute(input: RouteInput): Promise<FittedRoute> {

View File

@ -291,10 +291,9 @@ class FolkTripsPlanner extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rtrips/); const path = window.location.pathname;
if (match) return `/${match[1]}/rtrips`; const match = path.match(/^(\/[^/]+)?\/rtrips/);
if (this.space) return `/${this.space}/rtrips`; return match ? match[0] : "";
return "";
} }
private async loadTrips() { private async loadTrips() {

View File

@ -132,10 +132,9 @@ class FolkVoteDashboard extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rvote/); const path = window.location.pathname;
if (match) return `/${match[1]}/rvote`; const match = path.match(/^(\/[^/]+)?\/rvote/);
if (this.space) return `/${this.space}/rvote`; return match ? match[0] : "";
return "";
} }
private async loadSpaces() { private async loadSpaces() {

View File

@ -85,10 +85,9 @@ class FolkWalletViewer extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rwallet/); const path = window.location.pathname;
if (match) return `/${match[1]}/rwallet`; const match = path.match(/^(\/[^/]+)?\/rwallet/);
if (this.space) return `/${this.space}/rwallet`; return match ? match[0] : "";
return "";
} }
private async detectChains() { private async detectChains() {

View File

@ -55,10 +55,9 @@ class FolkWorkBoard extends HTMLElement {
} }
private getApiBase(): string { private getApiBase(): string {
const match = window.location.pathname.match(/^\/([^/]+)\/rwork/); const path = window.location.pathname;
if (match) return `/${match[1]}/rwork`; const match = path.match(/^(\/[^/]+)?\/rwork/);
if (this.space) return `/${this.space}/rwork`; return match ? match[0] : "";
return "";
} }
private async loadWorkspaces() { private async loadWorkspaces() {