mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 17:56:34 +00:00
fix(terminal): detect dev channel from build version string, not env var
This commit is contained in:
parent
76f725c149
commit
98723f21b8
2 changed files with 13 additions and 3 deletions
|
|
@ -84,6 +84,11 @@ BF_ENABLE_OS_OTA=1
|
||||||
# (motion, ANPR, analytics, line crossing, etc.) to the BF server +
|
# (motion, ANPR, analytics, line crossing, etc.) to the BF server +
|
||||||
# Node-RED. Set to 0 if no ONVIF cameras on the network.
|
# Node-RED. Set to 0 if no ONVIF cameras on the network.
|
||||||
BF_ENABLE_ONVIF_EVENTS=1
|
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
|
EOF
|
||||||
|
|
||||||
# Plymouth boot splash
|
# Plymouth boot splash
|
||||||
|
|
|
||||||
|
|
@ -164,9 +164,14 @@ pub fn check_terminal_access() -> Result<(), String> {
|
||||||
if is_locked() {
|
if is_locked() {
|
||||||
return Err("locked".to_string());
|
return Err("locked".to_string());
|
||||||
}
|
}
|
||||||
// Check firmware channel — only dev allowed.
|
// Check firmware channel — only dev allowed. The channel comes from
|
||||||
let channel = std::env::var("BF_FIRMWARE_CHANNEL").unwrap_or_else(|_| "stable".to_string());
|
// the server-side kiosk config, delivered via heartbeat. Read from the
|
||||||
if channel != "dev" {
|
// 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());
|
return Err("terminal access requires dev channel".to_string());
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue