From 3a473897eced1f44568b5dae90575e3cf3eb48a0 Mon Sep 17 00:00:00 2001 From: Till JS Date: Tue, 7 Apr 2026 22:30:24 +0200 Subject: [PATCH] =?UTF-8?q?chore(mana/web):=20pre-launch=20cleanup=20?= =?UTF-8?q?=E2=80=94=20remove=20ghost=20backend=20API=20clients?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Twelve `*-api.mana.how` Cloudflare hostnames (todo, calendar, contacts, chat, storage, cards, music, picture, presi, zitare, clock, context) plus their matching `lib/api/services/*.ts` clients still existed in the unified web app even though the per-app HTTP backends had been gone since the local-first migration. Their tunnel routes pointed at ports nothing listened on, so every consumer call returned 502 — and the corresponding `__PUBLIC_*_API_URL__` runtime variables were silently injected into every page render. The only live consumer was `qrExportService` (committed separately as part of the rewrite to read directly from Dexie). Two admin / data- management pages also imported the types but were already migrated to the unified `adminService` / `myDataService` clients. Removed: - Twenty-four files deleted: the twelve `lib/api/services/*.ts` clients plus their `*.test.ts` siblings. - `services/index.ts` collapsed from a thirteen-symbol re-export to just the four genuinely server-bound services (`adminService`, `landing`, `myDataService`, `qrExportService`). - `hooks.server.ts` no longer reads or injects any of the twelve `__PUBLIC_*_API_URL__` runtime variables, and the CSP `connect-src` list shrank by the same amount. Memoro server URL also removed since the unified `memoro` module is fully local-first and never hit the standalone server (the docker-compose service stays defined for the mobile app). - `routes/status/+page.server.ts` stops probing the dead per-app health endpoints — only `auth`, `sync`, `uload-server`, `media` and `llm` remain in the public status page. The cloudflared tunnel ingress entries for these hostnames were also removed in `~/.cloudflared/config.yml` on the Mac Mini (not in this repo) so the formerly-502 responses now return 404 from the edge. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/mana/apps/web/src/hooks.server.ts | 69 ++---- .../web/src/lib/api/services/calendar.test.ts | 141 ------------ .../apps/web/src/lib/api/services/calendar.ts | 142 ------------ .../apps/web/src/lib/api/services/cards.ts | 110 --------- .../web/src/lib/api/services/chat.test.ts | 145 ------------ .../apps/web/src/lib/api/services/chat.ts | 110 --------- .../apps/web/src/lib/api/services/clock.ts | 199 ----------------- .../web/src/lib/api/services/contacts.test.ts | 148 ------------- .../apps/web/src/lib/api/services/contacts.ts | 174 --------------- .../web/src/lib/api/services/context.test.ts | 127 ----------- .../apps/web/src/lib/api/services/context.ts | 113 ---------- .../apps/web/src/lib/api/services/index.ts | 35 ++- .../web/src/lib/api/services/music.test.ts | 92 -------- .../apps/web/src/lib/api/services/music.ts | 98 --------- .../apps/web/src/lib/api/services/picture.ts | 81 ------- .../web/src/lib/api/services/presi.test.ts | 100 --------- .../apps/web/src/lib/api/services/presi.ts | 101 --------- .../web/src/lib/api/services/storage.test.ts | 125 ----------- .../apps/web/src/lib/api/services/storage.ts | 102 --------- .../web/src/lib/api/services/todo.test.ts | 142 ------------ .../apps/web/src/lib/api/services/todo.ts | 208 ------------------ .../web/src/lib/api/services/zitare.test.ts | 132 ----------- .../apps/web/src/lib/api/services/zitare.ts | 92 -------- .../web/src/routes/status/+page.server.ts | 14 +- 24 files changed, 42 insertions(+), 2758 deletions(-) delete mode 100644 apps/mana/apps/web/src/lib/api/services/calendar.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/calendar.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/cards.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/chat.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/chat.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/clock.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/contacts.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/contacts.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/context.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/context.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/music.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/music.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/picture.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/presi.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/presi.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/storage.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/storage.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/todo.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/todo.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/zitare.test.ts delete mode 100644 apps/mana/apps/web/src/lib/api/services/zitare.ts diff --git a/apps/mana/apps/web/src/hooks.server.ts b/apps/mana/apps/web/src/hooks.server.ts index bcbb42100..ae1c86f50 100644 --- a/apps/mana/apps/web/src/hooks.server.ts +++ b/apps/mana/apps/web/src/hooks.server.ts @@ -6,44 +6,37 @@ import { setSecurityHeaders } from '@mana/shared-utils/security-headers'; * Server hooks for Mana web app * * Injects runtime environment variables into the HTML for client-side access. - * This is necessary because SvelteKit's $env/static/public bakes values at build time, - * but Docker containers need runtime configuration. + * This is necessary because SvelteKit's $env/static/public bakes values at + * build time, but Docker containers need runtime configuration. + * + * The set of injected URLs is intentionally short: + * - Auth → mana-auth (login, sessions, GDPR endpoints) + * - Sync → mana-sync (local-first push/pull/WS for every module) + * - Media → mana-media (CAS / thumbnails) + * - LLM → mana-llm (server-side LLM proxy) + * - Events → mana-events (public RSVP flow) + * - Uload server → standalone short-link redirect/click tracking + * - Memoro server → standalone voice memo processing + * - Glitchtip DSN → client-side error reporting + * + * Per-app HTTP backends (todo-api, calendar-api, contacts-api, chat-api, + * storage-api, cards-api, mukke-api, nutriphi-api, picture-api, presi-api, + * zitare-api, clock-api, context-api) were removed in the pre-launch + * ghost-API cleanup — every product module now talks to mana-sync directly. */ -// Auth URL const PUBLIC_MANA_AUTH_URL_CLIENT = process.env.PUBLIC_MANA_AUTH_URL_CLIENT || process.env.PUBLIC_MANA_AUTH_URL || ''; - -// Backend URLs for dashboard widgets -const PUBLIC_TODO_API_URL_CLIENT = - process.env.PUBLIC_TODO_API_URL_CLIENT || process.env.PUBLIC_TODO_API_URL || ''; -const PUBLIC_CALENDAR_API_URL_CLIENT = - process.env.PUBLIC_CALENDAR_API_URL_CLIENT || process.env.PUBLIC_CALENDAR_API_URL || ''; -const PUBLIC_CLOCK_API_URL_CLIENT = - process.env.PUBLIC_CLOCK_API_URL_CLIENT || process.env.PUBLIC_CLOCK_API_URL || ''; -const PUBLIC_CONTACTS_API_URL_CLIENT = - process.env.PUBLIC_CONTACTS_API_URL_CLIENT || process.env.PUBLIC_CONTACTS_API_URL || ''; const PUBLIC_GLITCHTIP_DSN = process.env.PUBLIC_GLITCHTIP_DSN || ''; -// Sync server URL (WebSocket) const PUBLIC_SYNC_SERVER_URL_CLIENT = process.env.PUBLIC_SYNC_SERVER_URL_CLIENT || process.env.PUBLIC_SYNC_SERVER_URL || ''; - -// Additional backend URLs -const PUBLIC_CHAT_API_URL_CLIENT = - process.env.PUBLIC_CHAT_API_URL_CLIENT || process.env.PUBLIC_CHAT_API_URL || ''; -const PUBLIC_STORAGE_API_URL_CLIENT = - process.env.PUBLIC_STORAGE_API_URL_CLIENT || process.env.PUBLIC_STORAGE_API_URL || ''; -const PUBLIC_CARDS_API_URL_CLIENT = - process.env.PUBLIC_CARDS_API_URL_CLIENT || process.env.PUBLIC_CARDS_API_URL || ''; -const PUBLIC_MUSIC_API_URL_CLIENT = - process.env.PUBLIC_MUSIC_API_URL_CLIENT || process.env.PUBLIC_MUSIC_API_URL || ''; -const PUBLIC_NUTRIPHI_API_URL_CLIENT = - process.env.PUBLIC_NUTRIPHI_API_URL_CLIENT || process.env.PUBLIC_NUTRIPHI_API_URL || ''; const PUBLIC_ULOAD_SERVER_URL_CLIENT = process.env.PUBLIC_ULOAD_SERVER_URL_CLIENT || process.env.PUBLIC_ULOAD_SERVER_URL || ''; -const PUBLIC_MEMORO_SERVER_URL_CLIENT = - process.env.PUBLIC_MEMORO_SERVER_URL_CLIENT || process.env.PUBLIC_MEMORO_SERVER_URL || ''; +// memoro-server is intentionally not injected — the unified web app's memoro +// module is fully local-first (recorder + Dexie + sync) and never calls the +// standalone server. The memoro-server compose service still exists for the +// mobile app, but mana.how does not depend on it. const PUBLIC_MANA_MEDIA_URL_CLIENT = process.env.PUBLIC_MANA_MEDIA_URL_CLIENT || process.env.PUBLIC_MANA_MEDIA_URL || ''; const PUBLIC_MANA_LLM_URL_CLIENT = @@ -94,18 +87,8 @@ export const handle: Handle = async ({ event, resolve }) => { transformPageChunk: ({ html }) => { const envScript = `