High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: show placeholder when dashboard not built (#156)
Data24053668b989
diff --git a/.gitignore b/.gitignoreindex 21481994..6a8cf3b8 100644--- a/.gitignore+++ b/.gitignore@@ -15,9 +15,9 @@ dist/!dashboard/vite.config.ts!npm/bin/pinchtab# React dashboard build output (generated by scripts/build-dashboard.sh)-# The placeholder dashboard.html IS tracked (shows "not built" message).-# The built version and assets are ignored — build-dashboard.sh overwrites them.+# Go code serves a built-in fallback when these files are absent.internal/dashboard/dashboard/assets/+internal/dashboard/dashboard/dashboard.html# npm packagenpm/node_modules/diff --git a/internal/dashboard/dashboard.go b/internal/dashboard/dashboard.goindex cf9f7059..8ce84e76 100644--- a/internal/dashboard/dashboard.go+++ b/internal/dashboard/dashboard.go@@ -191,12 +191,25 @@ func (d *Dashboard) handleSSE(w http.ResponseWriter, r *http.Request) {}}+const fallbackHTML = `<!DOCTYPE html>+<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/>+<title>PinchTab Dashboard</title>+<style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;display:flex;justify-content:center;align-items:center;min-height:100vh;margin:0;background:#0a0a0a;color:#e0e0e0}.c{text-align:center;max-width:480px;padding:2rem}h1{font-size:1.5rem;margin-bottom:.5rem}p{color:#888;line-height:1.6}code{background:#1a1a2e;padding:2px 8px;border-radius:4px;font-size:.9em}</style>+</head><body><div class="c"><h1>🦀 Dashboard not built</h1>+<p>The React dashboard needs to be compiled before use.<br/>+Run <code>./pdev build</code> or <code>./scripts/build-dashboard.sh</code> then rebuild the Go binary.</p>+</div></body></html>`+func (d *Dashboard) handleDashboardUI(w http.ResponseWriter, r *http.Request) {w.Header().Set("Content-Type", "text/html")w.Header().Set("Cache-Control", "no-store")w.Header().Set("Pragma", "no-cache")w.Header().Set("Expires", "0")- data, _ := dashboardFS.ReadFile("dashboard/dashboard.html")+ data, err := dashboardFS.ReadFile("dashboard/dashboard.html")+ if err != nil {+ _, _ = w.Write([]byte(fallbackHTML))+ return+ }_, _ = w.Write(data)}diff --git a/scripts/build-dashboard.sh b/scripts/build-dashboard.shindex b0d00a2a..7ce28654 100755--- a/scripts/build-dashboard.sh+++ b/scripts/build-dashboard.sh@@ -20,6 +20,13 @@ elseecho "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"fi+# Normalize tygo output with prettier so generation doesn't dirty git+if [ -f "dashboard/src/generated/types.ts" ]; then+ cd dashboard+ npx prettier --write src/generated/types.ts 2>/dev/null || true+ cd ..+fi+echo "📦 Building React dashboard..."cd dashboard