From 451264106a61cea96702e3a218c6c74bb4753ae7 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Wed, 3 Jun 2026 16:46:20 -0700 Subject: [PATCH] Make logo customizable --- Dockerfile | 3 ++- README.md | 1 + entrypoint.sh | 2 ++ frontend/.env.template | 3 +++ frontend/src/global.d.ts | 1 + frontend/src/lib/state.ts | 1 + frontend/src/pages/Home.tsx | 16 ++++++++-------- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index a836615..43e69ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,8 @@ COPY frontend ./ ENV VITE_API_URL=__VITE_API_URL__ \ VITE_RELAY_DOMAIN=__VITE_RELAY_DOMAIN__ \ - VITE_PLATFORM_NAME=__VITE_PLATFORM_NAME__ + VITE_PLATFORM_NAME=__VITE_PLATFORM_NAME__ \ + VITE_PLATFORM_LOGO=__VITE_PLATFORM_LOGO__ RUN bun run build # ---------- Runtime ---------- diff --git a/README.md b/README.md index 59fcd57..3b12913 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ docker run -d \ -p 3000:3000 \ -v my-caravel-data:/app/data \ -e PLATFORM_NAME=Caravel \ + -e PLATFORM_LOGO=/caravel.png \ -e RELAY_DOMAIN=example.com \ -e APP_URL=https://example.com \ -e ZOOID_API_URL=http://zooid:3334 \ diff --git a/entrypoint.sh b/entrypoint.sh index 44f3b49..cb6819f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,6 +8,7 @@ set -euo pipefail VITE_API_URL="${SERVER_URL:-}" VITE_RELAY_DOMAIN="${RELAY_DOMAIN:-}" VITE_PLATFORM_NAME="${PLATFORM_NAME:-}" +VITE_PLATFORM_LOGO="${PLATFORM_LOGO:-/caravel.png}" # Escape characters that are special in a sed replacement. esc() { printf '%s' "$1" | sed -e 's/[&|\\]/\\&/g'; } @@ -18,6 +19,7 @@ while IFS= read -r -d '' f; do -e "s|__VITE_API_URL__|$(esc "$VITE_API_URL")|g" \ -e "s|__VITE_RELAY_DOMAIN__|$(esc "$VITE_RELAY_DOMAIN")|g" \ -e "s|__VITE_PLATFORM_NAME__|$(esc "$VITE_PLATFORM_NAME")|g" \ + -e "s|__VITE_PLATFORM_LOGO__|$(esc "$VITE_PLATFORM_LOGO")|g" \ "$f" done < <(find /app/dist -type f \( -name '*.js' -o -name '*.html' \) -print0) diff --git a/frontend/.env.template b/frontend/.env.template index bde3cf9..c2fa0cc 100644 --- a/frontend/.env.template +++ b/frontend/.env.template @@ -6,3 +6,6 @@ VITE_RELAY_DOMAIN=spaces.coracle.social # Platform display name shown in UI VITE_PLATFORM_NAME=Caravel + +# Platform logo shown in UI (path under public/, or an absolute URL) +VITE_PLATFORM_LOGO=/caravel.png diff --git a/frontend/src/global.d.ts b/frontend/src/global.d.ts index 9f5be64..9110c42 100644 --- a/frontend/src/global.d.ts +++ b/frontend/src/global.d.ts @@ -24,6 +24,7 @@ interface ImportMetaEnv { readonly VITE_API_URL: string readonly VITE_RELAY_DOMAIN: string readonly VITE_PLATFORM_NAME?: string + readonly VITE_PLATFORM_LOGO?: string } interface ImportMeta { diff --git a/frontend/src/lib/state.ts b/frontend/src/lib/state.ts index 255a274..c309ac9 100644 --- a/frontend/src/lib/state.ts +++ b/frontend/src/lib/state.ts @@ -27,6 +27,7 @@ export type EventSigner = { } export const PLATFORM_NAME = import.meta.env.VITE_PLATFORM_NAME +export const PLATFORM_LOGO = import.meta.env.VITE_PLATFORM_LOGO export const eventStore = new EventStore() export const pool = new RelayPool() diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx index f041224..0f207f5 100644 --- a/frontend/src/pages/Home.tsx +++ b/frontend/src/pages/Home.tsx @@ -10,7 +10,7 @@ import PaymentSetup from "@/components/PaymentSetup" import Login from "@/views/Login" import { createRelayForActiveTenant, resolvePostPaidFlow } from "@/lib/hooks" import type { Invoice } from "@/lib/api" -import { account, refetchBilling, setToastMessage } from "@/lib/state" +import { account, PLATFORM_LOGO, PLATFORM_NAME, refetchBilling, setToastMessage } from "@/lib/state" import FlotillaLogo from "@/assets/flotilla-logo.svg" import NostordLogo from "@/assets/nostord-logo.svg" @@ -100,8 +100,8 @@ export default function Home() {