Add custom logo URL configuration option
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/tag Build is failing

Bug: https://github.com/happyDomain/happydeliver/issues/6
This commit is contained in:
nemunaire 2026-01-24 21:42:35 +08:00
commit 8a10eef2f5
5 changed files with 14 additions and 2 deletions

View file

@ -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
}

View file

@ -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

View file

@ -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 {

View file

@ -24,6 +24,7 @@ import { writable } from "svelte/store";
interface AppConfig {
report_retention?: number;
survey_url?: string;
custom_logo_url?: string;
}
const defaultConfig: AppConfig = {

View file

@ -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 @@
<nav class="navbar navbar-expand-lg navbar-light shadow-sm">
<div class="container">
<a class="navbar-brand fw-bold" href="/">
<i class="bi bi-envelope-check me-2"></i>
<Logo color={$theme === "light" ? "black" : "white"} />
{#if $appConfig.custom_logo_url}
<img src={$appConfig.custom_logo_url} alt="Logo" style="height: 25px;" />
{:else}
<i class="bi bi-envelope-check me-2"></i>
<Logo color={$theme === "light" ? "black" : "white"} />
{/if}
</a>
<div>
<span class="d-none d-md-inline navbar-text text-primary small">