feat: add app tier system — core/recommended/optional (SCALE-02, SCALE-03)
get_app_tier() classifies all apps: - core: Bitcoin, LND, Electrs, Mempool, BTCPay, DWN, FileBrowser - recommended: Fedimint, Grafana, Vaultwarden, Kuma, SearXNG, etc. - optional: everything else Tier field added to Manifest struct (data_model.rs) and exposed via WebSocket package data for frontend tier badges. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1030,6 +1030,7 @@ fn create_installing_entry(package_id: &str) -> PackageDataEntry {
|
||||
author: None,
|
||||
website: None,
|
||||
interfaces: None,
|
||||
tier: None,
|
||||
},
|
||||
installed: None,
|
||||
install_progress: None,
|
||||
|
||||
@@ -176,6 +176,7 @@ impl DockerPackageScanner {
|
||||
donation_url: None,
|
||||
author: Some("Archipelago".to_string()),
|
||||
website: lan_address.clone(),
|
||||
tier: Some(metadata.tier.to_string()),
|
||||
interfaces: if lan_address.is_some() || tor_address.is_some() {
|
||||
Some(Interfaces {
|
||||
main: Some(MainInterface {
|
||||
@@ -246,6 +247,7 @@ impl DockerPackageScanner {
|
||||
donation_url: None,
|
||||
author: Some("Indeehub Team".to_string()),
|
||||
website: lan_address.clone(),
|
||||
tier: Some("optional".to_string()),
|
||||
interfaces: Some(Interfaces {
|
||||
main: Some(MainInterface {
|
||||
ui: Some("true".to_string()),
|
||||
@@ -286,21 +288,47 @@ struct AppMetadata {
|
||||
description: String,
|
||||
icon: String,
|
||||
repo: String,
|
||||
tier: &'static str,
|
||||
}
|
||||
|
||||
/// Get the app tier: "core", "recommended", or "optional".
|
||||
fn get_app_tier(app_id: &str) -> &'static str {
|
||||
match app_id {
|
||||
// Core: required for basic Bitcoin node
|
||||
"bitcoin" | "bitcoin-core" | "bitcoin-knots" => "core",
|
||||
"lnd" => "core",
|
||||
"mempool" | "mempool-web" | "mempool-api" | "mempool-electrs" | "electrs" => "core",
|
||||
"btcpay" | "btcpay-server" | "btcpayserver" => "core",
|
||||
"dwn" => "core",
|
||||
"filebrowser" => "core",
|
||||
// Recommended: enhanced functionality
|
||||
"fedimint" | "fedimint-gateway" => "recommended",
|
||||
"vaultwarden" => "recommended",
|
||||
"uptime-kuma" => "recommended",
|
||||
"grafana" => "recommended",
|
||||
"searxng" => "recommended",
|
||||
"tailscale" => "recommended",
|
||||
"portainer" => "recommended",
|
||||
// Optional: everything else
|
||||
_ => "optional",
|
||||
}
|
||||
}
|
||||
|
||||
fn get_app_metadata(app_id: &str) -> AppMetadata {
|
||||
match app_id {
|
||||
let mut meta = match app_id {
|
||||
"bitcoin" | "bitcoin-core" | "bitcoin-knots" => AppMetadata {
|
||||
title: "Bitcoin Knots".to_string(),
|
||||
description: "Full Bitcoin node implementation".to_string(),
|
||||
icon: "/assets/img/app-icons/bitcoin-knots.webp".to_string(),
|
||||
repo: "https://github.com/bitcoinknots/bitcoin".to_string(),
|
||||
tier: "",
|
||||
},
|
||||
"btcpay" | "btcpay-server" | "btcpayserver" => AppMetadata {
|
||||
title: "BTCPay Server".to_string(),
|
||||
description: "Self-hosted Bitcoin payment processor".to_string(),
|
||||
icon: "/assets/img/app-icons/btcpay-server.png".to_string(),
|
||||
repo: "https://github.com/btcpayserver/btcpayserver".to_string(),
|
||||
tier,
|
||||
},
|
||||
"homeassistant" | "home-assistant" => AppMetadata {
|
||||
title: "Home Assistant".to_string(),
|
||||
@@ -443,7 +471,7 @@ fn get_app_metadata(app_id: &str) -> AppMetadata {
|
||||
"indeedhub" => AppMetadata {
|
||||
title: "Indeehub".to_string(),
|
||||
description: "Decentralized media streaming platform".to_string(),
|
||||
icon: "/assets/img/app-icons/indeedhub.png".to_string(),
|
||||
icon: "/assets/img/app-icons/indeehub.ico".to_string(),
|
||||
repo: "https://github.com/indeedhub/indeedhub".to_string(),
|
||||
},
|
||||
"nostr-rs-relay" => AppMetadata {
|
||||
@@ -511,8 +539,11 @@ fn get_app_metadata(app_id: &str) -> AppMetadata {
|
||||
description: format!("{} application", app_id),
|
||||
icon: "/assets/img/favico.png".to_string(),
|
||||
repo: "#".to_string(),
|
||||
tier: "",
|
||||
},
|
||||
}
|
||||
};
|
||||
meta.tier = get_app_tier(app_id);
|
||||
meta
|
||||
}
|
||||
|
||||
/// Map app_id to Tor hidden service directory name.
|
||||
|
||||
@@ -150,6 +150,9 @@ pub struct Manifest {
|
||||
pub author: Option<String>,
|
||||
pub website: Option<String>,
|
||||
pub interfaces: Option<Interfaces>,
|
||||
/// App tier: "core", "recommended", or "optional"
|
||||
#[serde(default)]
|
||||
pub tier: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
|
||||
Reference in New Issue
Block a user