feat(webconfig): print the full firmware version and name the channel
The console showed "v1.16.0" — the version was there but buried in the header
line beside role and board, and on the build under test it genuinely had no more
to show: `pio run` never goes through build.sh, so no build number, no commit,
no OTA config.
The banner now prints FIRMWARE_VERSION whole and on its own line. Nothing was
truncating it; build.sh composes base[.build][-observer][-channel]-hash, so a CI
build already carries the published build number as a 4th component and the
commit as the trailing token — the two things that actually identify a build.
It also names the channel, which the version string encodes but does not spell
out (OTA_CHANNEL_TAG=beta-dev -> "-observer-beta-dev-"):
v1.16.0.5-observer-beta-dev-a1b2c3d (dev channel)
v1.16.0.5-observer-beta-a1b2c3d (beta channel)
v1.16.0.5-observer-a1b2c3d (release channel)
v1.16.0 (local build — not from CI, OTA not
configured)
That last one earns its wording: build.sh deliberately leaves OTA_MANIFEST_BASE
undefined on local builds so such a node cannot update itself, and nothing about
a bare version number says so.
The mock reports a build.sh-shaped version now (--fw-version switches channel),
and `ver` answers from the same string /api/status does, as both do on-device.
This commit is contained in:
1 parent
c831e599ec
commit
cac91c91d8
2 files changed
+33
-4
No files matched your search
@@ -48,6 +48,11 @@ sys.path.insert(0, HERE)
|
||||
from webconfig_minify import strip_source # noqa: E402
|
||||
|
||||
MINIFY = False
|
||||
# Overridable with --fw-version to exercise the console's channel labelling:
|
||||
# v1.16.0.5-observer-a1b2c3d release
|
||||
# v1.16.0.5-observer-beta-dev-a1b2c3d dev
|
||||
# v1.16.0 local build, no OTA
|
||||
FW_VERSION = "v1.16.0.5-observer-a1b2c3d"
|
||||
|
||||
SENTINEL = "********"
|
||||
ADMIN_PASSWORD = "password" # matches the default ADMIN_PASSWORD build flag
|
||||
@@ -179,7 +184,10 @@ class State:
|
||||
"auth": authed,
|
||||
"needs_setup": self.cfg["wifi"]["ssid"] == "",
|
||||
"name": self.cfg["radio"]["name"], "node_id": "a1b2c3d4e5f60718",
|
||||
"fw": "v1.7.1-mock", "role": "Repeater", "board": "Heltec V3 (mock)",
|
||||
# Shaped like build.sh's EMBEDDED_VERSION_STRING
|
||||
# (base[.build][-observer][-channel]-hash) so the console's channel
|
||||
# labelling is exercised against a real version, not "v1.x-mock".
|
||||
"fw": FW_VERSION, "role": "Repeater", "board": "Heltec V3 (mock)",
|
||||
"uptime_s": int(time.time() - self.start),
|
||||
"runtime_slots": 6, "max_slots": 6, "active_slots": self.active_slots,
|
||||
"max_cmds": CLI_MAX_CMDS,
|
||||
@@ -560,7 +568,9 @@ def run_cli(cfg, line):
|
||||
if cmd == "":
|
||||
return True, ""
|
||||
if cmd == "ver":
|
||||
return True, "v1.7.1-mock (observer)"
|
||||
# Same source as /api/status's fw on the device: both are
|
||||
# FIRMWARE_VERSION, so they must not disagree here either.
|
||||
return True, "%s (Build: 6 Jun 2026)" % FW_VERSION
|
||||
if cmd == "board":
|
||||
return True, "Heltec V3 (mock)"
|
||||
if cmd == "clock":
|
||||
@@ -1005,15 +1015,18 @@ class Handler(BaseHTTPRequestHandler):
|
||||
|
||||
|
||||
def main():
|
||||
global ST, PORT, MINIFY
|
||||
global ST, PORT, MINIFY, FW_VERSION
|
||||
ap = argparse.ArgumentParser(description="Mock WebConfig portal backend")
|
||||
ap.add_argument("--port", type=int, default=8080)
|
||||
ap.add_argument("--setup", action="store_true", help="first-boot setup wizard mode")
|
||||
ap.add_argument("--active-slots", type=int, default=5, help="server slots to expose (2 or 5)")
|
||||
ap.add_argument("--fw-version", default=FW_VERSION,
|
||||
help="version string to report, shaped like build.sh's embedded one")
|
||||
ap.add_argument("--minify", action="store_true",
|
||||
help="serve the comment-stripped page the device ships, not the source")
|
||||
args = ap.parse_args()
|
||||
ST, PORT, MINIFY = State(args), args.port, args.minify
|
||||
FW_VERSION = args.fw_version
|
||||
|
||||
srv = ThreadingHTTPServer(("127.0.0.1", args.port), Handler)
|
||||
mode = "SETUP (wizard)" if args.setup else "LAN (login: %s)" % ADMIN_PASSWORD
|
||||
|
||||
+17
-1
@@ -629,6 +629,7 @@ function boot(){
|
||||
// size for older firmware that doesn't report it.
|
||||
st.mode=s.mode;st.authed=s.auth;st.needsSetup=!!s.needs_setup;st.nslots=s.active_slots||s.runtime_slots||6;
|
||||
if(s.max_cmds>0)CLI_MAX=s.max_cmds;
|
||||
st.fw=s.fw||"";st.role=s.role||"";st.board=s.board||"";
|
||||
$("#h-name").textContent=s.name||"MeshCore";
|
||||
$("#h-sub").textContent=s.role+" · "+s.fw+" · "+s.board;
|
||||
var b=$("#h-badge");b.classList.remove("hide");
|
||||
@@ -1636,8 +1637,23 @@ function cliEcho(cls,text){
|
||||
}
|
||||
function cliGap(){var d=cliEcho("gap","");return d}
|
||||
function cliClear(){$("#term-out").innerHTML="";cliBanner();$("#term-in").focus()}
|
||||
// build.sh composes FIRMWARE_VERSION as base[.build][-observer][-channel]-hash,
|
||||
// e.g. v1.16.0.5-observer-beta-dev-a1b2c3d. A plain `pio run` never goes through
|
||||
// build.sh, so it keeps the header default (v1.16.0) with no build number, no
|
||||
// hash, and — deliberately — no OTA_MANIFEST_BASE, so such a node cannot update
|
||||
// itself. Worth saying out loud: the version alone does not make that obvious.
|
||||
function cliChannel(fw){
|
||||
if(/-dev(-|$)/.test(fw))return"dev channel"; // OTA_CHANNEL_TAG=beta-dev
|
||||
if(/-beta(-|$)/.test(fw))return"beta channel";
|
||||
if(/^v?\d+\.\d+\.\d+$/.test(fw))return"local build — not from CI, OTA not configured";
|
||||
return"release channel";
|
||||
}
|
||||
function cliBanner(){
|
||||
cliEcho("sys","MeshCore · "+($("#h-sub").textContent||""));
|
||||
// Full string, unabbreviated: the 4th component is the published build number
|
||||
// and the trailing token is the commit, which is what identifies a build.
|
||||
var ch=cliChannel(st.fw||"");
|
||||
cliEcho("sys","MeshCore "+(st.fw||"unknown version")+(ch?" ("+ch+")":""));
|
||||
cliEcho("sys",(st.role||"")+" · "+(st.board||""));
|
||||
if(st.mode==="setup"){
|
||||
// The wizard refuses to finish without an admin password; nothing stops a
|
||||
// console-driven setup from rebooting on the factory one, so say so here
|
||||
|
||||
Reference in new issue
Block a user