feat: complete Phase 1 foundation hardening + three-mode UI design doc

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>
This commit is contained in:
Dorian
2026-03-04 05:23:42 +00:00
parent 62d6c13764
commit 486fc39249
58 changed files with 1902 additions and 2286 deletions

View File

@@ -8,6 +8,8 @@ pub enum PortError {
PortConflict(u16, String),
#[error("App {0} has no allocated ports")]
NoPortsAllocated(String),
#[error("Lock poisoned: {0}")]
LockPoisoned(String),
}
pub struct PortManager {
@@ -27,8 +29,8 @@ impl PortManager {
/// Allocate ports for an app, applying the port offset
pub fn allocate_ports(&self, app_id: &str, base_ports: &[u16]) -> Result<Vec<u16>, PortError> {
let mut allocations = self.allocations.write().unwrap();
let mut port_to_app = self.port_to_app.write().unwrap();
let mut allocations = self.allocations.write().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
let mut port_to_app = self.port_to_app.write().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
let mut allocated_ports = Vec::new();
// Check for conflicts and allocate ports
@@ -53,24 +55,23 @@ impl PortManager {
}
/// Get allocated ports for an app
pub fn get_port_mapping(&self, app_id: &str) -> Option<Vec<u16>> {
let allocations = self.allocations.read().unwrap();
allocations.get(app_id).cloned()
pub fn get_port_mapping(&self, app_id: &str) -> Result<Option<Vec<u16>>, PortError> {
let allocations = self.allocations.read().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
Ok(allocations.get(app_id).cloned())
}
/// Get the dev port for a specific base port of an app
pub fn get_dev_port(&self, app_id: &str, base_port: u16) -> Option<u16> {
self.get_port_mapping(app_id)
pub fn get_dev_port(&self, app_id: &str, base_port: u16) -> Result<Option<u16>, PortError> {
Ok(self.get_port_mapping(app_id)?
.and_then(|ports| {
// Find the port that corresponds to this base port
ports.iter().find(|&&p| p == base_port + self.port_offset).copied()
})
}))
}
/// Release all ports allocated to an app
pub fn release_ports(&self, app_id: &str) -> Result<(), PortError> {
let mut allocations = self.allocations.write().unwrap();
let mut port_to_app = self.port_to_app.write().unwrap();
let mut allocations = self.allocations.write().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
let mut port_to_app = self.port_to_app.write().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
if let Some(ports) = allocations.remove(app_id) {
for port in ports {
@@ -83,16 +84,16 @@ impl PortManager {
}
/// Check if a port is available
pub fn is_port_available(&self, base_port: u16) -> bool {
pub fn is_port_available(&self, base_port: u16) -> Result<bool, PortError> {
let dev_port = base_port + self.port_offset;
let port_to_app = self.port_to_app.read().unwrap();
!port_to_app.contains_key(&dev_port)
let port_to_app = self.port_to_app.read().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
Ok(!port_to_app.contains_key(&dev_port))
}
/// Get all allocated ports
pub fn get_all_allocations(&self) -> HashMap<String, Vec<u16>> {
let allocations = self.allocations.read().unwrap();
allocations.clone()
pub fn get_all_allocations(&self) -> Result<HashMap<String, Vec<u16>>, PortError> {
let allocations = self.allocations.read().map_err(|e| PortError::LockPoisoned(e.to_string()))?;
Ok(allocations.clone())
}
/// Get port offset
@@ -108,20 +109,20 @@ mod tests {
#[test]
fn test_port_allocation() {
let manager = PortManager::new(10000);
let ports = manager.allocate_ports("app1", &[8332, 8333]).unwrap();
assert_eq!(ports, vec![18332, 18333]);
let mapping = manager.get_port_mapping("app1").unwrap();
let mapping = manager.get_port_mapping("app1").unwrap().unwrap();
assert_eq!(mapping, vec![18332, 18333]);
}
#[test]
fn test_port_conflict() {
let manager = PortManager::new(10000);
manager.allocate_ports("app1", &[8332]).unwrap();
// Try to allocate the same port to another app
let result = manager.allocate_ports("app2", &[8332]);
assert!(result.is_err());
@@ -130,22 +131,22 @@ mod tests {
#[test]
fn test_port_release() {
let manager = PortManager::new(10000);
manager.allocate_ports("app1", &[8332]).unwrap();
manager.release_ports("app1").unwrap();
// Port should now be available
assert!(manager.is_port_available(8332));
assert!(manager.is_port_available(8332).unwrap());
}
#[test]
fn test_get_dev_port() {
let manager = PortManager::new(10000);
manager.allocate_ports("app1", &[8332, 8333]).unwrap();
assert_eq!(manager.get_dev_port("app1", 8332), Some(18332));
assert_eq!(manager.get_dev_port("app1", 8333), Some(18333));
assert_eq!(manager.get_dev_port("app1", 9999), None);
assert_eq!(manager.get_dev_port("app1", 8332).unwrap(), Some(18332));
assert_eq!(manager.get_dev_port("app1", 8333).unwrap(), Some(18333));
assert_eq!(manager.get_dev_port("app1", 9999).unwrap(), None);
}
}