events 3.9.0, website 1.9.0, accounts 1.10.0: the church's details from Accounts everywhere

- Events: the Accounts profile's name, logo, icon, colours and contact details win over
  Events' own settings while Accounts is connected (pages, emails, WhatsApp, PDFs); Settings
  shows them read-only with a link to Accounts. The Accounts logo is copied for PDFs (PNG
  and JPEG). Fixes Events keeping its old church after a demo scenario load.
- Website: a background per homepage section in the church's colours; "More info" instead
  of "Register" for events without registration; the shared colour field.
- Accounts: the shared colour field in Church profile.
- @crosscode/ui 0.4.0: ColourField and isHexColour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 00:46:39 +02:00
co-authored by Claude Opus 5.5
parent 799c193fe1
commit 8055e1ec62
41 changed files with 843 additions and 120 deletions
+6 -3
View File
@@ -52,15 +52,18 @@ function computeApiBase(): string {
export const API_BASE = computeApiBase();
// Resolve a URL or path to use the API origin. If it's a relative path, prefix with API_BASE.
// If it's an absolute URL but points to localhost/127.0.0.1/::1, rewrite its origin to API_BASE.
// If it's an absolute URL to this site's own uploads on localhost/127.0.0.1/::1, rewrite its
// origin to API_BASE. Another localhost address (the church's Accounts in development, whose logo
// the site now shows) is left as it is.
export function resolveToApiOrigin(urlOrPath: string | null | undefined): string | null {
const raw = (urlOrPath || "").trim();
if (!raw) return null;
try {
if (raw.startsWith("http")) {
const u = new URL(raw);
const isLocal = ["localhost", "127.0.0.1", "::1"].includes(u.hostname);
if (isLocal && API_BASE) {
const isLocal = ["localhost", "127.0.0.1", "::1", "[::1]"].includes(u.hostname);
const ownUpload = /^\/(api\/)?uploads\//.test(u.pathname);
if (isLocal && ownUpload && API_BASE) {
const api = new URL(API_BASE);
u.protocol = api.protocol;
u.hostname = api.hostname;