From b92e71fa0e254b34d850d19c63471f0ed499e732 Mon Sep 17 00:00:00 2001
From: Kpa-clawbot <259247574+Kpa-clawbot@users.noreply.github.com>
Date: Fri, 27 Mar 2026 09:54:53 -0700
Subject: [PATCH] refine version badge: clickable links, version only on prod
- Commit hash is now an linking to GitHub commit (full hash in URL, 7-char display)
- Version tag only shown on prod (port 80/443 or no port), linked to GitHub release
- Staging (non-standard port) shows commit + engine only, no version noise
- Detect prod vs staging via location.port
- Updated tests: 16 cases covering prod/staging/links/edge cases
- Bumped cache busters
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
public/app.js | 13 +++++-
public/index.html | 54 ++++++++++++------------
test-frontend-helpers.js | 91 ++++++++++++++++++++++++++++++++--------
3 files changed, 111 insertions(+), 47 deletions(-)
diff --git a/public/app.js b/public/app.js
index dad7bfd6..d0845008 100644
--- a/public/app.js
+++ b/public/app.js
@@ -107,9 +107,18 @@ function formatEngineBadge(engine) {
function formatVersionBadge(version, commit, engine) {
if (!version && !commit && !engine) return '';
+ var port = (typeof location !== 'undefined' && location.port) || '';
+ var isProd = !port || port === '80' || port === '443';
+ var GH = 'https://github.com/Kpa-clawbot/meshcore-analyzer';
var parts = [];
- if (version) parts.push(version.charAt(0) === 'v' ? version : 'v' + version);
- if (commit && commit !== 'unknown') parts.push(commit.length > 7 ? commit.slice(0, 7) : commit);
+ if (version && isProd) {
+ var vTag = version.charAt(0) === 'v' ? version : 'v' + version;
+ parts.push('' + vTag + '');
+ }
+ if (commit && commit !== 'unknown') {
+ var short = commit.length > 7 ? commit.slice(0, 7) : commit;
+ parts.push('' + short + '');
+ }
if (engine) parts.push('[' + engine + ']');
if (parts.length === 0) return '';
return ' ' + parts.join(' · ') + '';
diff --git a/public/index.html b/public/index.html
index da96d3d5..15f20a9e 100644
--- a/public/index.html
+++ b/public/index.html
@@ -22,9 +22,9 @@
-
-
-
+
+
+
@@ -81,29 +81,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+