summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-22 09:13:51 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-22 09:13:51 +0000
commitd8939199f129ccb1abcf0150012bc23209facf12 (patch)
treecbf4194482e7996b4699f1c7435c8dbfd12f59b2
parent15a46b0e8d6fc9b986bce6b17b471c4a29cc950c (diff)
feat: color logo based on build version hash
Adds GET /api/version endpoint and uses the first 6 hex chars of the commit hash to derive an HSL hue for the header h1 logo color. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--internal/api/server.go6
-rw-r--r--web/app.js18
2 files changed, 24 insertions, 0 deletions
diff --git a/internal/api/server.go b/internal/api/server.go
index 9e3cde4..bb23f46 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -15,6 +15,7 @@ import (
"github.com/thepeterstone/claudomator/internal/notify"
"github.com/thepeterstone/claudomator/internal/storage"
"github.com/thepeterstone/claudomator/internal/task"
+ "github.com/thepeterstone/claudomator/internal/version"
webui "github.com/thepeterstone/claudomator/web"
"github.com/google/uuid"
)
@@ -147,6 +148,7 @@ func (s *Server) routes() {
s.mux.HandleFunc("POST /api/stories/{id}/tasks", s.handleAddTaskToStory)
s.mux.HandleFunc("PUT /api/stories/{id}/status", s.handleUpdateStoryStatus)
s.mux.HandleFunc("GET /api/health", s.handleHealth)
+ s.mux.HandleFunc("GET /api/version", s.handleVersion)
s.mux.HandleFunc("POST /api/webhooks/github", s.handleGitHubWebhook)
s.mux.HandleFunc("GET /api/push/vapid-key", s.handleGetVAPIDKey)
s.mux.HandleFunc("GET /api/push/sw.js", s.handleServiceWorker)
@@ -424,6 +426,10 @@ func (s *Server) handleHealth(w http.ResponseWriter, r *http.Request) {
})
}
+func (s *Server) handleVersion(w http.ResponseWriter, r *http.Request) {
+ writeJSON(w, http.StatusOK, map[string]string{"version": version.Version()})
+}
+
func (s *Server) handleCreateTask(w http.ResponseWriter, r *http.Request) {
var input struct {
Name string `json:"name"`
diff --git a/web/app.js b/web/app.js
index d26d051..1e10ad3 100644
--- a/web/app.js
+++ b/web/app.js
@@ -3097,6 +3097,23 @@ function switchTab(name) {
poll();
}
+// ── Version color ─────────────────────────────────────────────────────────────
+
+async function applyVersionColor() {
+ try {
+ const res = await fetch(`${BASE_PATH}/api/version`);
+ if (!res.ok) return;
+ const { version } = await res.json();
+ // Use first 6 hex chars of version as hue seed (works for commit hashes and "dev")
+ const hex = version.replace(/[^0-9a-f]/gi, '').slice(0, 6).padEnd(6, '0');
+ const hue = Math.round((parseInt(hex, 16) / 0xffffff) * 360);
+ const h1 = document.querySelector('header h1');
+ if (h1) h1.style.color = `hsl(${hue}, 70%, 55%)`;
+ } catch {
+ // non-fatal — logo stays default color
+ }
+}
+
// ── Boot ──────────────────────────────────────────────────────────────────────
if (typeof document !== 'undefined') {
@@ -3105,6 +3122,7 @@ if (typeof document !== 'undefined') {
handleStartNextTask(this);
});
+ applyVersionColor();
switchTab(getActiveMainTab());
startPolling();
connectWebSocket();