From d32c5aeff940d38529fff1af85bf1966c905e188 Mon Sep 17 00:00:00 2001
From: Claude
Date: Sat, 13 Jun 2026 09:04:56 +0000
Subject: [PATCH 1/2] Demo: make the homepage work on a multi-tenant server
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The homepage demo used Zero() with no key, so on a multi-tenant server every
data/file call 401s. Data failures were silent (lists just render empty) while
the upload form surfaced the error — hence "upload is failing", though the whole
demo was unauthenticated.
- The demo now reads an optional project key from the URL (?key=pk_…) and passes
it to the SDK, so an operator can point the showcase at a project.
- On a multi-tenant server with no key it shows a clear notice (create a project
in /admin, open as ?key=…) instead of failing silently.
- loadEntries/loadFiles and the post/upload handlers now catch errors and show a
friendly inline message rather than throwing uncaught.
Server behavior is unchanged (authed upload already works — verified 201 with a
project key). Added a test that / serves the demo and carries the key handling.
65/65 SQLite.
---
public/index.html | 81 +++++++++++++++++++++++++++++++++--------------
test/api.test.ts | 10 ++++++
2 files changed, 67 insertions(+), 24 deletions(-)
diff --git a/public/index.html b/public/index.html
index 80a76f3..0a9cfc7 100644
--- a/public/index.html
+++ b/public/index.html
@@ -59,6 +59,7 @@ This page is talking to its own backend
Everything below is served by the same instance, through /sdk.js. Open a second tab —
new entries appear in both without a refresh (that's the realtime layer).
+
💬 Guestbook data + live sync
@@ -108,7 +109,16 @@ Everything a generated app needs