style: cargo fmt across today's touched modules
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5227406341
commit
0cd2164d24
@ -202,7 +202,9 @@ impl ApiHandler {
|
||||
return Ok(build_response(
|
||||
StatusCode::BAD_REQUEST,
|
||||
"application/json",
|
||||
hyper::Body::from(r#"{"error":"The seller does not accept Lightning for this item"}"#),
|
||||
hyper::Body::from(
|
||||
r#"{"error":"The seller does not accept Lightning for this item"}"#,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -443,8 +443,7 @@ impl RpcHandler {
|
||||
&& (o.content_id == content_id
|
||||
|| filename.is_some_and(|f| {
|
||||
!f.is_empty()
|
||||
&& o.filename.trim_start_matches('/')
|
||||
== f.trim_start_matches('/')
|
||||
&& o.filename.trim_start_matches('/') == f.trim_start_matches('/')
|
||||
}))
|
||||
});
|
||||
if let Some(o) = already {
|
||||
@ -454,12 +453,9 @@ impl RpcHandler {
|
||||
owned_as = %o.content_id,
|
||||
"paid download: already owned — serving cached copy, NOT paying again"
|
||||
);
|
||||
if let Some((mime, bytes)) = crate::content_owned::read_owned(
|
||||
&self.config.data_dir,
|
||||
&o.onion,
|
||||
&o.content_id,
|
||||
)
|
||||
.await
|
||||
if let Some((mime, bytes)) =
|
||||
crate::content_owned::read_owned(&self.config.data_dir, &o.onion, &o.content_id)
|
||||
.await
|
||||
{
|
||||
use base64::Engine;
|
||||
return Ok(serde_json::json!({
|
||||
@ -692,10 +688,7 @@ impl RpcHandler {
|
||||
n += 1;
|
||||
}
|
||||
match tokio::fs::write(&target, &bytes).await {
|
||||
Ok(()) => tracing::info!(
|
||||
"paid download: filed into {}",
|
||||
target.display()
|
||||
),
|
||||
Ok(()) => tracing::info!("paid download: filed into {}", target.display()),
|
||||
Err(e) => tracing::warn!(
|
||||
"paid download: filing into {} failed (non-fatal): {e}",
|
||||
target.display()
|
||||
|
||||
@ -23,9 +23,11 @@ impl RpcHandler {
|
||||
/// host/IP itself — it knows which origin the browser reached the node on.
|
||||
pub(super) async fn handle_fips_pair_info(&self) -> Result<serde_json::Value> {
|
||||
let identity_dir = fips::identity_dir_from(&self.config.data_dir);
|
||||
let npub = crate::identity::fips_npub(&identity_dir).await?.ok_or_else(|| {
|
||||
anyhow::anyhow!("FIPS identity not provisioned yet — complete onboarding first")
|
||||
})?;
|
||||
let npub = crate::identity::fips_npub(&identity_dir)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
anyhow::anyhow!("FIPS identity not provisioned yet — complete onboarding first")
|
||||
})?;
|
||||
let ula = fips::iface::fips0_ula().map(|ip| ip.to_string());
|
||||
// The node's seed anchors ride along so the phone can rendezvous
|
||||
// through the same public mesh points when the node's LAN endpoint
|
||||
|
||||
@ -556,8 +556,8 @@ impl RpcHandler {
|
||||
.is_some(),
|
||||
None => false,
|
||||
};
|
||||
let totp_enabled = !is_token_login
|
||||
&& self.auth_manager.is_totp_enabled().await.unwrap_or(false);
|
||||
let totp_enabled =
|
||||
!is_token_login && self.auth_manager.is_totp_enabled().await.unwrap_or(false);
|
||||
if totp_enabled {
|
||||
let password = login_params
|
||||
.as_ref()
|
||||
|
||||
@ -766,7 +766,11 @@ async fn find_satellite(port: u16) -> Option<String> {
|
||||
if self_ips.contains(&ip) {
|
||||
continue;
|
||||
}
|
||||
set.spawn(async move { tcp_alive(&ip.to_string(), port, 500).await.then(|| ip.to_string()) });
|
||||
set.spawn(async move {
|
||||
tcp_alive(&ip.to_string(), port, 500)
|
||||
.await
|
||||
.then(|| ip.to_string())
|
||||
});
|
||||
}
|
||||
while let Some(res) = set.join_next().await {
|
||||
if let Ok(Some(ip)) = res {
|
||||
|
||||
@ -848,11 +848,17 @@ pub async fn ensure_audio_stack() {
|
||||
{
|
||||
Ok(s) if s.success() => info!("audio: PipeWire stack installed"),
|
||||
Ok(s) => {
|
||||
warn!("audio: package install exited with {} — will retry next start", s);
|
||||
warn!(
|
||||
"audio: package install exited with {} — will retry next start",
|
||||
s
|
||||
);
|
||||
return;
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("audio: package install failed: {:#} — will retry next start", e);
|
||||
warn!(
|
||||
"audio: package install failed: {:#} — will retry next start",
|
||||
e
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -878,12 +884,23 @@ pub async fn ensure_audio_stack() {
|
||||
}
|
||||
if unit_was_missing {
|
||||
// First install on this node — bring it up now and on every boot.
|
||||
let _ = host_sudo(&["systemctl", "enable", "--now", "archipelago-audio-router.service"]).await;
|
||||
let _ = host_sudo(&[
|
||||
"systemctl",
|
||||
"enable",
|
||||
"--now",
|
||||
"archipelago-audio-router.service",
|
||||
])
|
||||
.await;
|
||||
info!("audio: router installed and enabled (HDMI routing + ELD heal)");
|
||||
} else if script_changed || unit_changed {
|
||||
// Content update: restart only if it's running — never re-enable a
|
||||
// unit an operator deliberately disabled.
|
||||
let _ = host_sudo(&["systemctl", "try-restart", "archipelago-audio-router.service"]).await;
|
||||
let _ = host_sudo(&[
|
||||
"systemctl",
|
||||
"try-restart",
|
||||
"archipelago-audio-router.service",
|
||||
])
|
||||
.await;
|
||||
info!("audio: router updated");
|
||||
}
|
||||
}
|
||||
@ -911,10 +928,21 @@ pub async fn ensure_gamepad_keys() {
|
||||
}
|
||||
}
|
||||
if unit_was_missing {
|
||||
let _ = host_sudo(&["systemctl", "enable", "--now", "archipelago-gamepad-keys.service"]).await;
|
||||
let _ = host_sudo(&[
|
||||
"systemctl",
|
||||
"enable",
|
||||
"--now",
|
||||
"archipelago-gamepad-keys.service",
|
||||
])
|
||||
.await;
|
||||
info!("gamepad: bridge installed and enabled (TV controller input)");
|
||||
} else if script_changed || unit_changed {
|
||||
let _ = host_sudo(&["systemctl", "try-restart", "archipelago-gamepad-keys.service"]).await;
|
||||
let _ = host_sudo(&[
|
||||
"systemctl",
|
||||
"try-restart",
|
||||
"archipelago-gamepad-keys.service",
|
||||
])
|
||||
.await;
|
||||
info!("gamepad: bridge updated");
|
||||
}
|
||||
}
|
||||
@ -994,10 +1022,10 @@ async fn patch_nginx_conf(path: &str) -> Result<bool> {
|
||||
// Companion mesh access: phones reach this node over FIPS at its fips0
|
||||
// ULA (http://[fdxx:…]). Configs shipped before 2026-07-23 listened on
|
||||
// IPv4 only, so the ULA could never connect — nothing answered [::]:80.
|
||||
let missing_v6_http = content.contains("listen 80 default_server;")
|
||||
&& !content.contains("listen [::]:80");
|
||||
let missing_v6_https = content.contains("listen 443 ssl default_server;")
|
||||
&& !content.contains("listen [::]:443");
|
||||
let missing_v6_http =
|
||||
content.contains("listen 80 default_server;") && !content.contains("listen [::]:80");
|
||||
let missing_v6_https =
|
||||
content.contains("listen 443 ssl default_server;") && !content.contains("listen [::]:443");
|
||||
if !missing_app_catalog
|
||||
&& !missing_bitcoin_status
|
||||
&& !missing_lnd_proxy
|
||||
|
||||
@ -111,8 +111,7 @@ impl BootReconciler {
|
||||
let mut failure_rounds: u32 = 0;
|
||||
loop {
|
||||
let installed = orchestrator.manifest_ids().await;
|
||||
let failures =
|
||||
crate::container::companion::reconcile(&installed).await;
|
||||
let failures = crate::container::companion::reconcile(&installed).await;
|
||||
for (companion, err) in &failures {
|
||||
tracing::warn!(
|
||||
companion = %companion,
|
||||
|
||||
@ -90,15 +90,13 @@ pub fn archy_anchor() -> SeedAnchor {
|
||||
pub fn fips_network_anchors() -> Vec<SeedAnchor> {
|
||||
vec![
|
||||
SeedAnchor {
|
||||
npub: "npub10yffd020a4ag8zcy75f9pruq3rnghvvhd5hphl9s62zgp35s560qrksp9u"
|
||||
.to_string(),
|
||||
npub: "npub10yffd020a4ag8zcy75f9pruq3rnghvvhd5hphl9s62zgp35s560qrksp9u".to_string(),
|
||||
address: "23.182.128.74:443".to_string(),
|
||||
transport: "tcp".to_string(),
|
||||
label: "FIPS network anchor (join.fips.network)".to_string(),
|
||||
},
|
||||
SeedAnchor {
|
||||
npub: "npub1qmc3cvfz0yu2hx96nq3gp55zdan2qclealn7xshgr448d3nh6lks7zel98"
|
||||
.to_string(),
|
||||
npub: "npub1qmc3cvfz0yu2hx96nq3gp55zdan2qclealn7xshgr448d3nh6lks7zel98".to_string(),
|
||||
address: "217.77.8.91:443".to_string(),
|
||||
transport: "tcp".to_string(),
|
||||
label: "FIPS network anchor (join.fips.network)".to_string(),
|
||||
|
||||
@ -34,7 +34,6 @@ mod bitcoin_rpc;
|
||||
mod bitcoin_status;
|
||||
mod blobs;
|
||||
mod bootstrap;
|
||||
mod mesh_ports;
|
||||
mod ceremony;
|
||||
mod config;
|
||||
mod constants;
|
||||
@ -57,6 +56,7 @@ mod identity;
|
||||
mod identity_manager;
|
||||
mod marketplace;
|
||||
mod mesh;
|
||||
mod mesh_ports;
|
||||
mod monitoring;
|
||||
mod names;
|
||||
mod network;
|
||||
|
||||
@ -438,7 +438,10 @@ impl MeshState {
|
||||
let persisted: PersistedMessages = match serde_json::from_slice(&bytes) {
|
||||
Ok(p) => p,
|
||||
Err(e) => {
|
||||
warn!("mesh: parsing {} failed (skipping restore): {e}", path.display());
|
||||
warn!(
|
||||
"mesh: parsing {} failed (skipping restore): {e}",
|
||||
path.display()
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@ -454,7 +457,10 @@ impl MeshState {
|
||||
*id = max_id + 1;
|
||||
}
|
||||
}
|
||||
info!("mesh: restored {count} persisted messages (next id {})", max_id + 1);
|
||||
info!(
|
||||
"mesh: restored {count} persisted messages (next id {})",
|
||||
max_id + 1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,7 +504,11 @@ pub fn spawn_message_persister(state: Arc<MeshState>) {
|
||||
warn!("mesh: chmod {} failed: {e}", tmp.display());
|
||||
}
|
||||
if let Err(e) = tokio::fs::rename(&tmp, &path).await {
|
||||
warn!("mesh: renaming {} -> {} failed: {e}", tmp.display(), path.display());
|
||||
warn!(
|
||||
"mesh: renaming {} -> {} failed: {e}",
|
||||
tmp.display(),
|
||||
path.display()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
last_written = Some(json);
|
||||
|
||||
@ -191,10 +191,13 @@ impl MeshtasticDevice {
|
||||
.current_modem_preset
|
||||
.and_then(modem_preset_name)
|
||||
.map(str::to_string),
|
||||
primary_channel: self
|
||||
.current_primary_channel
|
||||
.as_ref()
|
||||
.map(|(name, _)| if name.is_empty() { "(default public)".to_string() } else { name.clone() }),
|
||||
primary_channel: self.current_primary_channel.as_ref().map(|(name, _)| {
|
||||
if name.is_empty() {
|
||||
"(default public)".to_string()
|
||||
} else {
|
||||
name.clone()
|
||||
}
|
||||
}),
|
||||
secondary_channel: self
|
||||
.current_secondary_channel
|
||||
.as_ref()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user