fix(qbzd): posture voice on the TUI network screen and pinned boot note

cc
This commit is contained in:
vicrodh committed 2026-07-15 11:41:29 -06:00
1 parent e6cc082669
commit e6cb5114a9
3 files changed
+30 -4

No files matched your search

+26
View File
@@ -228,3 +228,29 @@ pub fn bundle_token_rejected() -> String {
"error: the Qobuz token in this bundle was rejected — re-export with a fresh desktop login, or run: qbzd login"
.to_string()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn lan_posture_note_renders_the_verbatim_copy() {
// FB6 (successor to the old LAN-exposure warning) — one INFO line logged
// by the daemon at boot when the control API is NOT loopback-only. This
// test pins the exact wording so it cannot drift from the spec.
let rendered = lan_posture_note("0.0.0.0:6789");
assert!(
rendered.contains("control plane listening on 0.0.0.0:6789"),
"{rendered}"
);
assert!(
rendered.contains("anyone on your network can control playback"),
"{rendered}"
);
assert!(rendered.contains("bind = \"127.0.0.1\""), "{rendered}");
assert!(
rendered.contains("token in qbzd.toml to restrict"),
"{rendered}"
);
}
}
+2 -2
View File
@@ -181,8 +181,8 @@ impl NetworkState {
lines.push(widgets::err_line(s::N_BAD_IP));
} else if self.bind_is_lan() {
lines.push(widgets::blank());
for l in s::NETWORK_LAN_WARNING.lines() {
lines.push(widgets::warn_line(l));
for l in s::NETWORK_LAN_POSTURE.lines() {
lines.push(widgets::note_line(l));
}
}
if self.port_invalid() {
+2 -2
View File
@@ -233,8 +233,8 @@ pub const N_PORT: &str = "Port";
pub const N_TOKEN: &str = "Access token";
pub const N_TOKEN_HINT: &str = "(empty = open)";
/// LAN-exposure warning shown when bind is non-loopback (§3.5, copy normative).
pub const NETWORK_LAN_WARNING: &str = "! bound beyond localhost: anyone on your network can control playback\n (Sonos/Chromecast posture). Plain HTTP — never expose it past your LAN.";
/// LAN-first posture note shown when bind is non-loopback (§3.5, copy normative).
pub const NETWORK_LAN_POSTURE: &str = "open LAN control (Sonos/Chromecast posture) — anyone on your network can control playback\n restrict: bind = \"127.0.0.1\" or set [server] token in qbzd.toml";
/// Restart-required copy on a bind/port/token save (§3.5).
pub const NETWORK_RESTART: &str =