From d0ca22d42db3496809c7566003a7825c3d4e3a27 Mon Sep 17 00:00:00 2001 From: Knutwurst <36196269+knutwurst@users.noreply.github.com> Date: Wed, 24 Jun 2026 21:19:38 +0200 Subject: [PATCH] UI: pull version from /api/status instead of hardcoding it The sidebar tag was a literal "v0.0.3" string in index.html, so a release bump left the running UI lying about which build it was. Server now publishes PATCHDL_VERSION via /api/status; renderStatus() drops it into a #brandVersion span. No more chasing a hardcoded version on every release. --- src/patchdl_websrv.c | 6 ++++-- web/app.js | 3 +++ web/index.html | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/patchdl_websrv.c b/src/patchdl_websrv.c index c37beae..18b6855 100644 --- a/src/patchdl_websrv.c +++ b/src/patchdl_websrv.c @@ -6,6 +6,7 @@ #include "patchdl_net.h" #include "patchdl_resolve.h" #include "patchdl_verxml.h" +#include "patchdl_version.h" #include #include @@ -585,8 +586,9 @@ build_status_json(void) { "\"dns_guard\":\"Active\"," "\"resolver\":\"Internal allowlist\"," "\"free_space_mb\":%lld," - "\"download_dir\":\"/data/patchdl (internal)\"}", - g_fw.str, g_fw.bin, data_free_mb()); + "\"download_dir\":\"/data/patchdl (internal)\"," + "\"version\":\"%s\"}", + g_fw.str, g_fw.bin, data_free_mb(), PATCHDL_VERSION); return out; } diff --git a/web/app.js b/web/app.js index c60d975..40bc39e 100644 --- a/web/app.js +++ b/web/app.js @@ -127,6 +127,7 @@ function bindElements() { connPlus: document.getElementById("connPlus"), refreshBtn: document.getElementById("refreshBtn"), updateAllBtn: document.getElementById("updateAllBtn"), + brandVersion: document.getElementById("brandVersion"), saveBtn: document.getElementById("saveBtn"), clearLogBtn: document.getElementById("clearLogBtn"), toast: document.getElementById("toast"), @@ -240,6 +241,8 @@ function renderStatus() { els.downloadDirValue.textContent = state.status.download_dir || state.config.download_dir || "Download target"; if (els.railFw) els.railFw.textContent = `FW ${state.status.firmware || "--"}`; if (els.railSpace) els.railSpace.textContent = `${space} free`; + if (els.brandVersion) + els.brandVersion.textContent = state.status.version ? `v${state.status.version}` : "v--"; } const CONN_MIN = 1, CONN_MAX = 16; diff --git a/web/index.html b/web/index.html index d4f864a..b9c0926 100644 --- a/web/index.html +++ b/web/index.html @@ -39,7 +39,7 @@
PD
PatchDL - by Knutwurst · v0.0.3 + by Knutwurst · --