From 8a10eef2f53d39f0095b645844e2f3d9f73e9038 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 24 Jan 2026 21:42:35 +0800 Subject: [PATCH] Add custom logo URL configuration option Bug: https://github.com/happyDomain/happydeliver/issues/6 --- internal/config/cli.go | 1 + internal/config/config.go | 1 + web/routes.go | 4 ++++ web/src/lib/stores/config.ts | 1 + web/src/routes/+layout.svelte | 9 +++++++-- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/config/cli.go b/internal/config/cli.go index 2a61bad..3accc99 100644 --- a/internal/config/cli.go +++ b/internal/config/cli.go @@ -41,6 +41,7 @@ func declareFlags(o *Config) { flag.DurationVar(&o.ReportRetention, "report-retention", o.ReportRetention, "How long to keep reports (e.g., 720h, 30d). 0 = keep forever") flag.UintVar(&o.RateLimit, "rate-limit", o.RateLimit, "API rate limit (requests per second per IP)") flag.Var(&URL{&o.SurveyURL}, "survey-url", "URL for user feedback survey") + flag.StringVar(&o.CustomLogoURL, "custom-logo-url", o.CustomLogoURL, "URL for custom logo image in the web UI") // Others flags are declared in some other files likes sources, storages, ... when they need specials configurations } diff --git a/internal/config/config.go b/internal/config/config.go index be5e63a..4a335c9 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -44,6 +44,7 @@ type Config struct { ReportRetention time.Duration // How long to keep reports. 0 = keep forever RateLimit uint // API rate limit (requests per second per IP) SurveyURL url.URL // URL for user feedback survey + CustomLogoURL string // URL for custom logo image in the web UI } // DatabaseConfig contains database connection settings diff --git a/web/routes.go b/web/routes.go index ea9929d..876954c 100644 --- a/web/routes.go +++ b/web/routes.go @@ -66,6 +66,10 @@ func DeclareRoutes(cfg *config.Config, router *gin.Engine) { appConfig["rbls"] = cfg.Analysis.RBLs } + if cfg.CustomLogoURL != "" { + appConfig["custom_logo_url"] = cfg.CustomLogoURL + } + if appcfg, err := json.MarshalIndent(appConfig, "", " "); err != nil { log.Println("Unable to generate JSON config to inject in web application") } else { diff --git a/web/src/lib/stores/config.ts b/web/src/lib/stores/config.ts index 8a978e0..87662ba 100644 --- a/web/src/lib/stores/config.ts +++ b/web/src/lib/stores/config.ts @@ -24,6 +24,7 @@ import { writable } from "svelte/store"; interface AppConfig { report_retention?: number; survey_url?: string; + custom_logo_url?: string; } const defaultConfig: AppConfig = { diff --git a/web/src/routes/+layout.svelte b/web/src/routes/+layout.svelte index 0d3fb23..077f340 100644 --- a/web/src/routes/+layout.svelte +++ b/web/src/routes/+layout.svelte @@ -6,6 +6,7 @@ import favicon from "$lib/assets/favicon.svg"; import Logo from "$lib/components/Logo.svelte"; + import { appConfig } from "$lib/stores/config"; import { theme } from "$lib/stores/theme"; import { onMount } from "svelte"; @@ -32,8 +33,12 @@