mirror of
https://github.com/knutwurst/patchdl.git
synced 2026-10-06 10:00:22 +02:00
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.
This commit is contained in:
1 parent
fb47730d70
commit
d0ca22d42d
3 files changed
+8
-3
No files matched your search
@@ -6,6 +6,7 @@
|
||||
#include "patchdl_net.h"
|
||||
#include "patchdl_resolve.h"
|
||||
#include "patchdl_verxml.h"
|
||||
#include "patchdl_version.h"
|
||||
|
||||
#include <microhttpd.h>
|
||||
#include <pthread.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@
|
||||
<div class="brand-mark">PD</div>
|
||||
<div>
|
||||
<strong>PatchDL</strong>
|
||||
<span>by Knutwurst · v0.0.3</span>
|
||||
<span>by Knutwurst · <span id="brandVersion">--</span></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user