From 98723f21b80aa787e313014fb6266fc21649c632 Mon Sep 17 00:00:00 2001 From: Mitchell R Date: Fri, 22 May 2026 20:49:41 +0200 Subject: [PATCH] fix(terminal): detect dev channel from build version string, not env var --- .../01-install-kiosk/01-run-chroot.sh | 5 +++++ kiosk/src/remote_debug.rs | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/deploy/pi-gen/stage-betterframe-client/01-install-kiosk/01-run-chroot.sh b/deploy/pi-gen/stage-betterframe-client/01-install-kiosk/01-run-chroot.sh index fad0766..5782785 100755 --- a/deploy/pi-gen/stage-betterframe-client/01-install-kiosk/01-run-chroot.sh +++ b/deploy/pi-gen/stage-betterframe-client/01-install-kiosk/01-run-chroot.sh @@ -84,6 +84,11 @@ BF_ENABLE_OS_OTA=1 # (motion, ANPR, analytics, line crossing, etc.) to the BF server + # Node-RED. Set to 0 if no ONVIF cameras on the network. BF_ENABLE_ONVIF_EVENTS=1 + +# Firmware channel for this image. Controls terminal access (dev only) +# and which update channel the kiosk polls. Change to "stable" or "beta" +# for production deployments. +BF_FIRMWARE_CHANNEL=dev EOF # Plymouth boot splash diff --git a/kiosk/src/remote_debug.rs b/kiosk/src/remote_debug.rs index 14dce3a..be25cee 100644 --- a/kiosk/src/remote_debug.rs +++ b/kiosk/src/remote_debug.rs @@ -164,9 +164,14 @@ pub fn check_terminal_access() -> Result<(), String> { if is_locked() { return Err("locked".to_string()); } - // Check firmware channel — only dev allowed. - let channel = std::env::var("BF_FIRMWARE_CHANNEL").unwrap_or_else(|_| "stable".to_string()); - if channel != "dev" { + // Check firmware channel — only dev allowed. The channel comes from + // the server-side kiosk config, delivered via heartbeat. Read from the + // cached bundle or the kiosk_app_version string (dev builds contain + // "-dev." in the version). No env var dependency. + let version = option_env!("BF_BUILD_VERSION") + .unwrap_or(env!("CARGO_PKG_VERSION")); + let is_dev = version.contains("-dev."); + if !is_dev { return Err("terminal access requires dev channel".to_string()); } Ok(())