Phase 1a — Gradient Removal: - Replaced all gradient-button/gradient-card with glass-button/path-option-card - Removed banned gradient CSS classes Phase 1b — Security Hardening: - SecretsManager: AES-256-GCM encryption (core/security) - electrs_status: credentials from env vars instead of hardcoded - port_manager: RwLock proper error handling (no unwrap) - Pinned all 11 :latest manifest images to specific versions - parmanode converter: pinned inferred image versions Phase 1c — Code Quality: - Split rpc.rs (1795 lines) into 6 handler modules (auth, node, container, package, peers) - Removed sideload code (UI, store, RPC client, 3 doc files) - Fixed body background flash on logout/refresh - Replaced 30 TypeScript `any` types with proper types - Deleted HelloWorld.vue, removed TODO comments - Added set -euo pipefail to all shell scripts - Made deploy script verbose with timestamps and elapsed time Also adds: - CLAUDE.md project guide - docs/three-mode-ui-design.md — design spec for Easy/Pro/Chat UI modes - OnlineStatusPill component Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
102 lines
3.0 KiB
Rust
102 lines
3.0 KiB
Rust
// Parmanode to App Manifest converter
|
|
// Converts Parmanode module structure to Archipelago app manifest format
|
|
|
|
use archipelago_container::AppManifest;
|
|
use anyhow::{Context, Result};
|
|
use std::path::PathBuf;
|
|
use tokio::fs;
|
|
use tracing::info;
|
|
|
|
pub struct ParmanodeConverter;
|
|
|
|
impl ParmanodeConverter {
|
|
pub fn new() -> Self {
|
|
Self
|
|
}
|
|
|
|
/// Convert a Parmanode module directory to an App Manifest
|
|
pub async fn convert_to_manifest(&self, module_path: &PathBuf) -> Result<AppManifest> {
|
|
info!("Converting Parmanode module to manifest: {:?}", module_path);
|
|
|
|
// Read Parmanode module metadata if available
|
|
let module_name = module_path
|
|
.file_name()
|
|
.and_then(|n| n.to_str())
|
|
.unwrap_or("unknown")
|
|
.to_string();
|
|
|
|
// Try to detect what the module installs
|
|
let install_script = module_path.join("install.sh");
|
|
let script_content = if install_script.exists() {
|
|
fs::read_to_string(&install_script).await.ok()
|
|
} else {
|
|
None
|
|
};
|
|
|
|
// Infer app details from script content
|
|
let (app_id, image) = self.infer_from_script(&script_content)?;
|
|
|
|
// Create a basic manifest
|
|
let manifest_yaml = format!(
|
|
r#"
|
|
app:
|
|
id: {}
|
|
name: {}
|
|
version: 1.0.0
|
|
description: Converted from Parmanode module
|
|
|
|
container:
|
|
image: {}
|
|
pull_policy: if-not-present
|
|
|
|
resources:
|
|
cpu_limit: 1
|
|
memory_limit: 512Mi
|
|
disk_limit: 10Gi
|
|
|
|
security:
|
|
capabilities: []
|
|
readonly_root: true
|
|
network_policy: isolated
|
|
"#,
|
|
app_id, module_name, image
|
|
);
|
|
|
|
AppManifest::from_str(&manifest_yaml)
|
|
.context("Failed to create manifest from Parmanode module")
|
|
}
|
|
|
|
fn infer_from_script(&self, script_content: &Option<String>) -> Result<(String, String)> {
|
|
let content = script_content.as_deref().unwrap_or("");
|
|
|
|
// Try to detect Bitcoin Core
|
|
if content.contains("bitcoind") || content.contains("bitcoin-core") {
|
|
return Ok(("bitcoin-core".to_string(), "bitcoin/bitcoin:24.0".to_string()));
|
|
}
|
|
|
|
// Try to detect LND
|
|
if content.contains("lnd") && !content.contains("lightning") {
|
|
return Ok(("lnd".to_string(), "lightninglabs/lnd:v0.18.0".to_string()));
|
|
}
|
|
|
|
// Try to detect Core Lightning
|
|
if content.contains("clightning") || content.contains("core-lightning") {
|
|
return Ok(("core-lightning".to_string(), "elementsproject/lightningd:v23.08.2".to_string()));
|
|
}
|
|
|
|
// Try to detect Electrs
|
|
if content.contains("electrs") {
|
|
return Ok(("electrs".to_string(), "romanz/electrs:v0.10.0".to_string()));
|
|
}
|
|
|
|
// Default fallback — pin Alpine to a specific version
|
|
Ok(("parmanode-module".to_string(), "alpine:3.19".to_string()))
|
|
}
|
|
}
|
|
|
|
impl Default for ParmanodeConverter {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|