From 411bc9b3179100d7faadf82748232bee44e63b24 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Wed, 17 Jun 2026 17:29:50 +0200 Subject: [PATCH] feat(web): make footer legal links configurable Add a "main.footer-links" config option so the footer Imprint and Privacy Policy links can point at internal pages (default) or external URLs. External http(s) targets open in a new tab; empty/unset values fall back to the built-in /imprint and /privacy routes, keeping the existing ./var/*.tmpl override mechanism intact. Closes #517 Co-Authored-By: Claude Opus 4.8 (1M context) Entire-Checkpoint: c5dca72c848f --- configs/config.json | 4 ++++ init/README.md | 7 +++++++ internal/config/config.go | 16 ++++++++++++++++ internal/config/schema.go | 14 ++++++++++++++ web/templates/base.tmpl | 4 ++-- web/web.go | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 2 deletions(-) diff --git a/configs/config.json b/configs/config.json index 13e1a7bc..a0e6ebf6 100644 --- a/configs/config.json +++ b/configs/config.json @@ -18,6 +18,10 @@ "trigger": 180, "resolutions": [240, 60] }, + "footer-links": { + "imprint": "/imprint", + "privacy": "/privacy" + }, "api-subjects": { "subject-job-event": "cc.job.event", "subject-node-state": "cc.node.state" diff --git a/init/README.md b/init/README.md index a4c0a7a9..ecc02b03 100644 --- a/init/README.md +++ b/init/README.md @@ -37,6 +37,13 @@ cp privacy.tmpl /opt/monitoring/cc-backend/var/ # Ensure your logo, and any images you use in your login template has a suitable size. cp -R img /opt/monitoring/cc-backend/img +# 4b. (Optional) Instead of overriding imprint.tmpl/privacy.tmpl, you can point the +# footer links to external pages via "main.footer-links" in config.json: +# "footer-links": { "imprint": "https://example.com/imprint", "privacy": "https://example.com/privacy" } +# Values may be internal paths (default "/imprint", "/privacy") or external URLs; +# external URLs (http/https) open in a new browser tab. An empty value falls back +# to the internal page. + # 5. Copy the systemd service unit file. You may adopt it to your needs. sudo cp ./init/clustercockpit.service /etc/systemd/system/clustercockpit.service diff --git a/internal/config/config.go b/internal/config/config.go index 0850b167..45c01b57 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -80,6 +80,18 @@ type ProgramConfig struct { // Database tuning configuration DbConfig *DbConfig `json:"db-config"` + + // Optional external/legal links shown in the footer. + FooterLinks FooterLinksConfig `json:"footer-links"` +} + +// FooterLinksConfig configures the legal/footer links rendered in the UI. +// Each value may be an internal path (e.g. "/imprint") or an external URL. +type FooterLinksConfig struct { + // Target URL/path for the "Imprint" footer entry. + Imprint string `json:"imprint"` + // Target URL/path for the "Privacy Policy" footer entry. + Privacy string `json:"privacy"` } type DbConfig struct { @@ -145,6 +157,10 @@ var Keys ProgramConfig = ProgramConfig{ SessionMaxAge: "168h", StopJobsExceedingWalltime: 0, ShortRunningJobsDuration: 5 * 60, + FooterLinks: FooterLinksConfig{ + Imprint: "/imprint", + Privacy: "/privacy", + }, } func Init(mainConfig json.RawMessage) { diff --git a/internal/config/schema.go b/internal/config/schema.go index d5bffda9..d447db1f 100644 --- a/internal/config/schema.go +++ b/internal/config/schema.go @@ -133,6 +133,20 @@ var configSchema = ` }, "required": ["subject-job-event", "subject-node-state"] }, + "footer-links": { + "description": "Optional footer links for legal pages (imprint/privacy). Each value may be an internal path or an external URL.", + "type": "object", + "properties": { + "imprint": { + "description": "Target URL/path for the footer imprint link.", + "type": "string" + }, + "privacy": { + "description": "Target URL/path for the footer privacy link.", + "type": "string" + } + } + }, "nodestate-retention": { "description": "Node state retention configuration for cleaning up old node_state rows.", "type": "object", diff --git a/web/templates/base.tmpl b/web/templates/base.tmpl index fd94668c..95ccf266 100644 --- a/web/templates/base.tmpl +++ b/web/templates/base.tmpl @@ -52,8 +52,8 @@ {{block "footer" .}}