Commit Graph

16 Commits

Author SHA1 Message Date
a9130715e9 feat(p2p): Add SecuBox Factory unified dashboard with signed Merkle snapshots
Implement mesh-distributed, cryptographically-validated control center:

- Add factory.sh library with Ed25519 signing via signify-openbsd
- Add Merkle tree calculation for /etc/config validation
- Add CGI endpoints: dashboard, tools, run, snapshot, pubkey
- Add KISS Web UI (~280 lines vanilla JS, inline CSS, zero deps)
- Add gossip-based 3-peer fanout for snapshot synchronization
- Add offline operations queue with replay on reconnect
- Add LuCI iframe integration under MirrorBox > Factory tab
- Configure uhttpd alias for /factory/ on port 7331
- Bump secubox-p2p version to 0.4.0

Factory UI accessible at http://<device>:7331/factory/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:03:54 +01:00
3a8555b207 fix(secubox-p2p): Fix RPC expect array handling in peers view
The RPC `expect: { peers: [] }` extracts the array directly, so result
IS the peers array, not result.peers. Added Array.isArray() defensive
check for consistent handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 06:04:54 +01:00
78f4fe4962 feat: Major updates - CDN cache with Squid, network modes UI rework, bugfixes
CDN Cache:
- Migrate from nginx to Squid proxy for better caching
- Add aggressive caching rules for Windows Update, Linux repos, Steam, Apple
- Proper firewall integration via UCI (transparent proxy)
- Real-time stats from Squid access logs

Network Modes:
- Complete UI rework with MirrorBox dark theme
- 9 network modes with emojis and descriptions
- Dynamic CSS animations and modern styling

Fixes:
- Fix jshn boolean handling in secubox-recovery (1/0 vs true/false)
- Fix nDPId RPCD to use netifyd as fallback DPI provider
- Update media-flow and security-threats dashboards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
b2fc1b27d8 feat(p2p): Add MirrorBox overview and profiles pages
Overview Page (SOC Admin Landing):
- Architecture diagram with layer visualization
- Modular component cards with status indicators
- Network topology with animated orbital nodes
- System status grid with health indicators
- Development roadmap timeline

Profiles Page (Dynamic Cloning):
- Component readiness tracking with progress bars
- Quick presets for common configurations
- Package feeds management with toggles
- Saved profiles list with load/delete
- Clone & deploy actions (export, import, sync, push)

Menu Structure:
- Renamed P2P Hub to MirrorBox
- Added Overview as landing page
- Added Profiles for cloning management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
4b2241c86e feat(p2p): Add MirrorBox auto-init, self-recovery, and ACL fixes
MirrorBox Auto-Init:
- Add blockchain-like gigogne P2P structure with peer zero (P0) genesis
- Auto-create self-mesh on page load with configurable depth
- Preserve MirrorBox peers during refresh cycles

Self-Recovery System:
- Add secubox-restore script for bootstrapping new OpenWrt boxes
- Generate customized bootstrap.sh in Gitea backups
- Support interactive and command-line restore modes

ACL Fixes:
- Add missing deploy/pull methods to luci-app-secubox-p2p ACL
- Add luci.gitea and luci.secubox-p2p access to luci-app-secubox ACL
- Fix null display issue in hub.js (changed to empty string)

Backup Enhancements:
- Fix syntax error in RPCD heredoc (openwrt_version line)
- Add branch reference to Gitea API calls (main branch)
- Include bootstrap.sh and secubox-restore in backup push

Documentation:
- Add comprehensive README.md for SecuBox P2P module

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
b7acc04a20 fix(p2p): Add ACL permissions for Gitea and backup RPCD methods
Add missing ACL permissions for new RPCD methods:

Read permissions:
- get_gitea_config
- list_gitea_repos
- get_gitea_commits
- list_local_backups

Write permissions:
- set_gitea_config
- create_gitea_repo
- push_gitea_backup
- pull_gitea_backup
- create_local_backup
- restore_local_backup

Fixes: RPC call failed with error -32002: Access denied

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
d57e954d21 feat(p2p): Auto-create mesh repository without modal parameters
Add autoCreateMeshRepo() function that automatically:
- Generates repo name from hostname: secubox-mesh-{hostname}
- Detects local Gitea server (gitea.local, git.local, etc.)
- Only prompts for access token on first use (one-time setup)
- Creates private repository with README
- Pushes initial mesh state immediately

Replace manual " Create" button with "🚀 Auto Setup" for seamless
mesh repository initialization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
7c1bcbe585 feat(p2p): Add backend Gitea and backup support via secubox-core RPCD
Add complete backend implementation for Gitea integration and local backups
with admin permissions:

RPCD Methods (luci.secubox-p2p):
- get_gitea_config / set_gitea_config - Gitea server configuration
- create_gitea_repo - Create new Gitea repository via API
- list_gitea_repos - List user's Gitea repositories
- get_gitea_commits - Fetch commit history
- push_gitea_backup - Push config/packages/scripts to Gitea
- pull_gitea_backup - Restore from Gitea commit
- create_local_backup - Create local backup snapshot
- list_local_backups - List available local backups
- restore_local_backup - Restore from local backup

UCI Config (secubox-p2p):
- gitea section: server_url, repo_name, access_token, auto_backup options
- backup section: backup_dir, max_backups, auto_cleanup

Frontend (hub.js):
- Updated createGiteaRepo() to use backend API
- Updated backup functions to use backend storage
- Added refreshGiteaCommits() for real API calls
- Load function now fetches Gitea config and backup list

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
9ed98b7fbc feat(p2p): Add Gitea repository creation feature
Add createGiteaRepo() function with modal interface for creating new Gitea
repositories directly from the P2P Hub. Users can configure server URL,
repo name, description, access token, and options (private, init README,
push current state).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
0d003a4cd1 feat(p2p): Add parallel component sources and auto-self mesh
- Add 6 parallel component sources: ipk, sets, profiles, scripts, macros, workflows
- Add component sources grid with enable/sync controls per source
- Add component list modal with import functionality
- Add auto-self mesh configuration with options:
  - Auto-create self peer
  - Full backup on create
  - Real test mode
  - Parallel sync
- Add runAutoSelfMesh() for automated mesh setup workflow
- Add exportFullState() for complete state export to JSON
- Add syncAllComponents() for parallel synchronization
- Add comprehensive CSS for component sources grid and auto-self section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
b472a7e995 feat(p2p): Add mesh backup, test cloning, and Gitea history feed
- Add Backup & Versioning panel with three cards:
  - Mesh Auto-Backup: scheduled snapshots with configurable targets
  - Test Cloning: clone config from any peer with auto-sync option
  - Gitea History: connect to Gitea for version control and commit feed
- Add backup history modal with restore/delete actions
- Add Gitea configuration modal with server/repo/token settings
- Add formatTime helper for relative timestamps
- Add comprehensive CSS for backup panel, gitea commits, history modal

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
2d91a8f7eb feat(p2p): Add self-peer testing and gigogne distribution mode
- Add self-peer for local mesh testing without remote nodes
- Add gigogne (nested matryoshka) distribution mode with configurable depth
- Add distribution mode selector: gigogne, mono, ring, full-mesh
- Add visual indicators for self/gigogne peers on globe and peers panel
- Add test mode badge and clear test button
- Add rebuildGigogneStructure for dynamic mode switching
- Update CSS with gigogne/self peer styles and animations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
675e4abcc7 feat(p2p): Add master deployment, DNS bridge, and WireGuard mirror
- Add renderServiceItemWithDeploy() for services with mesh deployment status
- Add deployment action handlers: deployAllRegistry, deployRegistryEntry,
  deployAllServices, deployLocalServices, pullAllServices, deployService, pullService
- Add deployment modals: showDeployRegistryModal, showDeployServicesModal
- Add DNS Bridge with load balancing strategies (round-robin, weighted, geo, latency)
- Add Onion Relay integration for privacy/fallback routing
- Add WireGuard Mirror inverse system with modes (active-passive, active-active, ring, full-mesh)
- Add showDNSBridgeModal and showWGMirrorModal configuration dialogs
- Add new API functions for deployment, DNS bridge, and WG mirror
- Add comprehensive CSS styles for deploy banners, mesh status dots, modal styles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
e5fb408744 feat(p2p): Add globe visualization with peer map
- Animated 3D globe with CSS transformations
- Peer nodes positioned around globe with depth sorting
- Master node at center with pulse animation
- Connection lines between master and peers
- Stars background with twinkle animation
- Health indicators with emoji status (💚💛❤️)
- Quick stats (Peers, Online, Services, Registry)
- Quick actions (Discover, Sync All, Add Peer)
- Responsive layout for mobile

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
5cf4776b8e feat(p2p): Add complete Hub Registry and Services Registry panels
- Hub Registry Panel with:
  - Short URL table with copy, status, hits
  - MaaS toggles (enabled, auto-register, cache)
  - DNS config modal with zone preview
  - Register URL, Sync Peers, Flush Cache actions

- Services Registry Panel with:
  - Service type legend with color coding
  - Local services / Network services columns
  - Service sharing toggles
  - Register Service, Subscribe, Export actions

- Extensible panel grid layout
- Service type categorization (dns, vpn, ids, proxy, firewall, etc.)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00
2b913d5005 feat(p2p): Add SecuBox P2P Hub packages and Services Registry
- Add secubox-p2p backend package:
  - UCI configuration for P2P settings, DNS federation, WireGuard mesh, HAProxy
  - RPCD handler for peer management, service discovery, mesh configuration
  - Init script and main P2P manager daemon

- Add luci-app-secubox-p2p frontend package:
  - Main hub view with master control, network matrix visualization
  - Peers management with discovery and manual add
  - Services view showing local and shared services
  - Mesh network configuration (DNS, WireGuard, HAProxy)
  - Settings for P2P and registry configuration

- Add Services Registry view to luci-app-secubox
- Add listProfiles/applyProfile to secubox-admin API
- Fix P2P ACL permissions
- Remove old hub.js from luci-app-secubox (moved to dedicated package)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:46:28 +01:00