Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Refresh portal favicon and preview asset route

rcourtman78ec9d2946d5
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index bed0be6955..2e7323c2a6 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -267,6 +267,10 @@ serving scenario-backed local portal APIs without requiring a live cloud deploy
for every iteration. Final verification still belongs on a real control-plane
instance, but local portal design work must not depend on redeploying
`cloud.pulserelay.pro` just to see each frontend change.
+That same preview/runtime boundary also owns shared browser chrome such as the
+portal favicon: the local preview must serve the same `/favicon.svg` asset as
+the real control-plane route so icon changes can be reviewed locally before
+deployment instead of appearing only after a live push.
That same frontend delivery boundary must keep the account portal visual language sharp and high-density, avoiding gradients, heavy shadows, and decorative SaaS styling in favor of a clean, restrained, Cloudflare/GCP-grade baseline with flat inline workspace action rows and text-driven unboxed metadata instead of pills and absolutely inline row actions.
That same portal delivery boundary also owns the checked-in embedded bundle in
`internal/cloudcp/portal/dist/`. Visual or interaction changes are not
diff --git a/internal/cloudcp/favicon.svg b/internal/cloudcp/favicon.svg
new file mode 100644
index 0000000000..af0b787e31
--- /dev/null
+++ b/internal/cloudcp/favicon.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
+ <rect width="64" height="64" rx="16" fill="#18181b"/>
+ <path fill="#f4f4f5" d="M22 14h15c10.493 0 19 8.507 19 19s-8.507 19-19 19h-7v12h-8V14zm8 8v22h7c6.075 0 11-4.925 11-11s-4.925-11-11-11h-7z"/>
+</svg>
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index ee11d29c87..179672e067 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "8b83790627c0212a6ef4ba62079f11e11236c4f806f391908614e1b17eb7fcba",
+ "source_hash": "60cfbc5a3ac053a63885f103222f7ffeecb7c99a1e533e184fab34208d4b4e28",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/frontend/dev.mjs b/internal/cloudcp/portal/frontend/dev.mjs
index 7dbfcd3b5e..f827776140 100644
--- a/internal/cloudcp/portal/frontend/dev.mjs
+++ b/internal/cloudcp/portal/frontend/dev.mjs
@@ -1,3 +1,4 @@
+import fs from 'node:fs';
import http from 'node:http';
import path from 'node:path';
import { context } from 'esbuild';
@@ -8,6 +9,7 @@ const scenarioCookieName = 'pulse_portal_preview_scenario';
const previewHost = process.env.PULSE_PORTAL_PREVIEW_HOST || '127.0.0.1';
const previewPort = Number(process.env.PULSE_PORTAL_PREVIEW_PORT || '8765');
const previewScenarios = ['managed', 'readonly', 'selfhosted', 'empty'];
+const previewFaviconSVG = fs.readFileSync(path.join(frontendRoot, '..', '..', 'favicon.svg'), 'utf8');
function iso(value) {
return new Date(value).toISOString();
@@ -251,6 +253,7 @@ function buildPreviewHTML(assets, bootstrap, previewToast) {
'<meta charset="utf-8">' +
'<meta name="viewport" content="width=device-width, initial-scale=1">' +
'<title>Pulse Account Preview</title>' +
+ '<link rel="icon" href="/favicon.svg" type="image/svg+xml">' +
'<style>' + assets.css + '</style>' +
'</head>' +
'<body>' +
@@ -546,6 +549,21 @@ const server = http.createServer(function(request, response) {
return;
}
+ if (url.pathname === '/favicon.svg') {
+ response.writeHead(200, {
+ 'Content-Type': 'image/svg+xml',
+ 'Cache-Control': 'no-store',
+ });
+ response.end(previewFaviconSVG);
+ return;
+ }
+
+ if (url.pathname === '/favicon.ico') {
+ response.writeHead(301, { Location: '/favicon.svg' });
+ response.end();
+ return;
+ }
+
if (url.pathname === '/__portal_preview/events') {
response.writeHead(200, {
'Content-Type': 'text/event-stream',
diff --git a/internal/cloudcp/routes_test.go b/internal/cloudcp/routes_test.go
index 104165fa07..bda54daffa 100644
--- a/internal/cloudcp/routes_test.go
+++ b/internal/cloudcp/routes_test.go
@@ -92,6 +92,57 @@ func TestRegisterRoutes_AccountAndTenantMethodDispatch(t *testing.T) {
}
}
+func TestRegisterRoutes_FaviconRouteParity(t *testing.T) {
+ dir := t.TempDir()
+ reg, err := registry.NewTenantRegistry(dir)
+ if err != nil {
+ t.Fatalf("NewTenantRegistry: %v", err)
+ }
+ t.Cleanup(func() { _ = reg.Close() })
+ trialStore, err := NewTrialSignupStore(dir)
+ if err != nil {
+ t.Fatalf("NewTrialSignupStore: %v", err)
+ }
+ t.Cleanup(func() { trialStore.Close() })
+
+ mux := http.NewServeMux()
+ RegisterRoutes(mux, &Deps{
+ Config: &CPConfig{
+ DataDir: dir,
+ AdminKey: "test-admin-key",
+ BaseURL: "https://cloud.example.com",
+ StripeWebhookSecret: "whsec_test",
+ },
+ Registry: reg,
+ TrialSignupStore: trialStore,
+ Version: "test",
+ })
+
+ svgReq := httptest.NewRequest(http.MethodGet, "/favicon.svg", nil)
+ svgRec := httptest.NewRecorder()
+ mux.ServeHTTP(svgRec, svgReq)
+ if svgRec.Code != http.StatusOK {
+ t.Fatalf("GET /favicon.svg status=%d, want %d", svgRec.Code, http.StatusOK)
+ }
+ if got := svgRec.Header().Get("Content-Type"); got != "image/svg+xml" {
+ t.Fatalf("GET /favicon.svg content-type=%q, want %q", got, "image/svg+xml")
+ }
+ body := svgRec.Body.String()
+ if !strings.Contains(body, "<svg") || !strings.Contains(body, "rx=\"16\"") {
+ t.Fatalf("expected current favicon svg payload")
+ }
+
+ icoReq := httptest.NewRequest(http.MethodGet, "/favicon.ico", nil)
+ icoRec := httptest.NewRecorder()
+ mux.ServeHTTP(icoRec, icoReq)
+ if icoRec.Code != http.StatusMovedPermanently {
+ t.Fatalf("GET /favicon.ico status=%d, want %d", icoRec.Code, http.StatusMovedPermanently)
+ }
+ if got := icoRec.Header().Get("Location"); got != "/favicon.svg" {
+ t.Fatalf("GET /favicon.ico location=%q, want %q", got, "/favicon.svg")
+ }
+}
+
func TestRegisterRoutes_TrialSignupRoutes(t *testing.T) {
dir := t.TempDir()
reg, err := registry.NewTenantRegistry(dir)
diff --git a/internal/cloudcp/static_assets.go b/internal/cloudcp/static_assets.go
index a12a09b020..8105e70443 100644
--- a/internal/cloudcp/static_assets.go
+++ b/internal/cloudcp/static_assets.go
@@ -1,14 +1,12 @@
package cloudcp
-import "net/http"
+import (
+ _ "embed"
+ "net/http"
+)
-const controlPlaneFaviconSVG = `<?xml version="1.0" encoding="UTF-8"?>
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
- <rect width="64" height="64" rx="14" fill="#0f172a"/>
- <path d="M18 18h13c9.941 0 18 8.059 18 18s-8.059 18-18 18H18V18zm11 10h-3v16h3c4.418 0 8-3.582 8-8s-3.582-8-8-8z" fill="#38bdf8"/>
- <circle cx="47" cy="18" r="5" fill="#1d4ed8"/>
-</svg>
-`
+//go:embed favicon.svg
+var controlPlaneFaviconSVG []byte
func handleControlPlaneFaviconSVG(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet && r.Method != http.MethodHead {
@@ -21,7 +19,7 @@ func handleControlPlaneFaviconSVG(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodHead {
return
}
- _, _ = w.Write([]byte(controlPlaneFaviconSVG))
+ _, _ = w.Write(controlPlaneFaviconSVG)
}
func handleControlPlaneFaviconICO(w http.ResponseWriter, r *http.Request) {