fix(apps): restore mobile and website launching

This commit is contained in:
archipelago
2026-05-17 19:22:18 -04:00
parent daad50325b
commit 413d50116e
12 changed files with 402 additions and 39 deletions

View File

@@ -376,7 +376,8 @@ impl RpcHandler {
package_id
))
.await;
if let Err(e) = ensure_host_port_listener(package_id, package_id, &[]).await {
if let Err(e) = ensure_host_port_listener(package_id, package_id, &[]).await
{
install_log(&format!(
"INSTALL ADOPT RECREATE: {} — host listener repair failed, removing wedged container: {}",
package_id, e

View File

@@ -557,10 +557,37 @@ fn get_app_metadata(app_id: &str) -> AppMetadata {
tier: "",
},
};
apply_dynamic_metadata(app_id, &mut meta);
meta.tier = get_app_tier(app_id);
meta
}
fn apply_dynamic_metadata(app_id: &str, meta: &mut AppMetadata) {
let config_path = format!("/var/lib/archipelago/app-configs/{}.json", app_id);
let Ok(data) = std::fs::read_to_string(config_path) else {
return;
};
let Ok(cfg) = serde_json::from_str::<serde_json::Value>(&data) else {
return;
};
if let Some(title) = cfg
.get("title")
.and_then(|v| v.as_str())
.map(str::trim)
.filter(|s| !s.is_empty() && s.len() <= 80)
{
meta.title = title.to_string();
}
if let Some(description) = cfg
.get("description")
.and_then(|v| v.as_str())
.map(str::trim)
.filter(|s| !s.is_empty() && s.len() <= 240)
{
meta.description = description.to_string();
}
}
/// Map app_id to Tor hidden service directory name.
/// "archipelago" is the main web UI (nginx port 80).
/// Supports container names from deploy (archy-*, btcpay-server, etc.).

View File

@@ -48,7 +48,9 @@ pub struct MeshtasticDevice {
impl MeshtasticDevice {
pub async fn open(path: &str) -> Result<Self> {
match tokio::fs::metadata(path).await {
Ok(meta) => debug!(path = %path, permissions = ?meta.permissions(), "Device node exists"),
Ok(meta) => {
debug!(path = %path, permissions = ?meta.permissions(), "Device node exists")
}
Err(e) => anyhow::bail!("Serial device {} not accessible: {}", path, e),
}
@@ -82,7 +84,12 @@ impl MeshtasticDevice {
if remaining.is_zero() {
break;
}
match tokio::time::timeout(remaining.min(Duration::from_millis(250)), self.read_from_radio()).await {
match tokio::time::timeout(
remaining.min(Duration::from_millis(250)),
self.read_from_radio(),
)
.await
{
Ok(Ok(Some(frame))) => {
saw_meshtastic_frame = true;
self.handle_from_radio(&frame);
@@ -210,7 +217,11 @@ impl MeshtasticDevice {
FROM_RADIO_PACKET => self.packet_to_inbound_frame(value),
FROM_RADIO_CONFIG_COMPLETE_ID | FROM_RADIO_REBOOTED => None,
other => {
debug!(field = other, len = value.len(), "Unhandled Meshtastic FromRadio field");
debug!(
field = other,
len = value.len(),
"Unhandled Meshtastic FromRadio field"
);
None
}
}
@@ -336,7 +347,10 @@ fn decode_top_level_variant(buf: &[u8]) -> Option<(u64, &[u8])> {
if end > buf.len() {
return None;
}
if matches!(field, FROM_RADIO_PACKET | FROM_RADIO_MY_INFO | FROM_RADIO_NODE_INFO) {
if matches!(
field,
FROM_RADIO_PACKET | FROM_RADIO_MY_INFO | FROM_RADIO_NODE_INFO
) {
return Some((field, &buf[idx..end]));
}
idx = end;
@@ -500,12 +514,8 @@ fn next_field(buf: &[u8], idx: usize) -> Option<(u64, FieldValue<'_>, usize)> {
if end > buf.len() {
None
} else {
let value = u32::from_le_bytes([
buf[pos],
buf[pos + 1],
buf[pos + 2],
buf[pos + 3],
]);
let value =
u32::from_le_bytes([buf[pos], buf[pos + 1], buf[pos + 2], buf[pos + 3]]);
Some((field, FieldValue::Fixed32(value), end))
}
}