secubox-openwrt/.codex/SECUBOX_APP_STORE.md

8.7 KiB

SecuBox App Store Implementation

Date: 2024-12-30 Status: Complete

Overview

Enhanced the SecuBox build system to support secubox-app-* packages as first-class plugins in the app store, alongside existing luci-app-* and luci-theme-* packages.


Changes Made

1. Package Reorganization

Renamed: nodogsplash → secubox-app-nodogsplash

Location: package/secubox/secubox-app-nodogsplash/

Changes:

  • Directory renamed from nodogsplash to secubox-app-nodogsplash
  • PKG_NAME updated to secubox-app-nodogsplash
  • PKG_SOURCE kept as nodogsplash-$(PKG_VERSION).tar.gz (upstream source)
  • PKG_BUILD_DIR set to nodogsplash-$(PKG_VERSION) (build directory)

2. Build System Enhancement

Updated: secubox-tools/local-build.sh

Command Line Support:

# Line 1639: Added secubox-app-* pattern matching
luci-app-*|luci-theme-*|secubox-app-*)
    single_package="$1"
    shift
    ;;

Package Installation (lines 653-660):

# Install secubox-app-* packages
for pkg in "$feed_dir"/secubox-app-*/; do
    if [[ -d "$pkg" ]]; then
        local pkg_name=$(basename "$pkg")
        echo "  Installing $pkg_name..."
        ./scripts/feeds install "$pkg_name" 2>&1 | grep -v "WARNING:" || true
    fi
done

Package Configuration (lines 708-715):

# Enable all SecuBox app packages from feed (secubox-app-*)
for pkg in feeds/secubox/secubox-app-*/; do
    if [[ -d "$pkg" ]]; then
        local pkg_name=$(basename "$pkg")
        echo "CONFIG_PACKAGE_${pkg_name}=m" >> .config
        print_success "$pkg_name enabled"
    fi
done

Feed Display (line 622):

ls -d "$feed_dir/secubox-app-"*/ 2>/dev/null || true

Help Text:

  • Updated COMMANDS section to show secubox-app-* support
  • Added example: ./secubox-tools/local-build.sh build secubox-app-nodogsplash

3. App Store Metadata

Created: package/secubox/.appstore/

Structure:

package/secubox/.appstore/
├── apps.json          # Master app catalog
└── README.md          # App store documentation

Apps Catalog: apps.json

Metadata for all 5 SecuBox applications:

  1. secubox-app-crowdsec (v1.7.4)

    • Category: Security 🛡️
    • Status: Development (requires full OpenWrt build environment)
    • LuCI App: luci-app-crowdsec-dashboard
    • Dependencies: iptables-nft
    • Build: Go 1.23+ (available in OpenWrt 24.10), full build environment required
  2. secubox-app-nodogsplash (v5.0.2)

    • Category: Network 🌐
    • Status: Stable
    • Dependencies: libmicrohttpd, libjson-c, iptables-nft
  3. secubox-app-domoticz (v1.0.0)

    • Category: IoT 🏠
    • Status: Stable
    • Requires: Docker
    • Dependencies: docker, dockerd
  4. secubox-app-lyrion (v1.0.0)

    • Category: Media 🎵
    • Status: Stable
    • Requires: Docker
    • Dependencies: docker, dockerd
  5. secubox-app-zigbee2mqtt (v1.0.0)

    • Category: IoT 📡
    • Status: Stable
    • Requires: Docker, Zigbee adapter
    • LuCI App: luci-app-zigbee2mqtt
    • Dependencies: docker, dockerd, mqtt-broker

Categories Defined:

  • Security 🔒 - Security and threat detection
  • Network 🌐 - Network services and utilities
  • IoT & Home Automation 🏠 - Smart home and IoT
  • Media 🎬 - Media streaming and entertainment

Current Package Inventory

LuCI Applications (18)

luci-app-auth-guardian
luci-app-bandwidth-manager
luci-app-cdn-cache
luci-app-client-guardian
luci-app-crowdsec-dashboard
luci-app-ksm-manager
luci-app-media-flow
luci-app-mqtt-bridge
luci-app-netdata-dashboard
luci-app-netifyd-dashboard
luci-app-network-modes
luci-app-secubox
luci-app-system-hub
luci-app-traffic-shaper
luci-app-vhost-manager
luci-app-wireguard-dashboard
luci-app-zigbee2mqtt

SecuBox Apps (5)

secubox-app-crowdsec
secubox-app-domoticz
secubox-app-lyrion
secubox-app-nodogsplash
secubox-app-zigbee2mqtt

Themes (1)

luci-theme-secubox

Core Packages (1)

secubox-app

Total: 25 packages


Usage Examples

Build Single SecuBox App

./secubox-tools/local-build.sh build secubox-app-nodogsplash

Build All Packages (including secubox-app-*)

./secubox-tools/local-build.sh build

Build for Specific Architecture

./secubox-tools/local-build.sh build secubox-app-crowdsec --arch aarch64-cortex-a72

App Store Integration Points

1. Build System

  • Automatic detection of secubox-app-* packages
  • Feed integration
  • Configuration generation
  • Dependency resolution

2. Metadata

  • Centralized app catalog (apps.json)
  • Category system
  • Status tracking (stable/beta/alpha/dev)
  • Dependency declarations
  • Conflict detection

3. LuCI Integration (Future)

  • 🔄 App browser in luci-app-secubox
  • 🔄 One-click installation
  • 🔄 Automatic dependency installation
  • 🔄 App status monitoring
  • 🔄 Update notifications

4. Documentation

  • Automated documentation from metadata
  • Category browsing
  • Searchable tags
  • System requirements display

App Store API (Proposed)

Metadata Access

// luci-app-secubox/htdocs/luci-static/resources/secubox/appstore.js

class AppStore {
    // Get all apps
    async getApps() {
        const response = await fetch('/appstore/apps.json');
        return await response.json();
    }

    // Get apps by category
    getAppsByCategory(category) {
        const apps = await this.getApps();
        return apps.apps.filter(app => app.category === category);
    }

    // Search apps
    searchApps(query) {
        const apps = await this.getApps();
        return apps.apps.filter(app =>
            app.name.toLowerCase().includes(query) ||
            app.tags.some(tag => tag.includes(query))
        );
    }

    // Get app status
    async getAppStatus(appId) {
        // Check if installed via opkg
        return await L.resolveDefault(fs.exec('opkg', ['status', appId]));
    }

    // Install app
    async installApp(appId) {
        return await L.resolveDefault(fs.exec('opkg', ['install', appId]));
    }
}

File Changes Summary

Modified Files:

  1. secubox-tools/local-build.sh

    • Added secubox-app-* pattern matching (1 location)
    • Added secubox-app-* installation loop (1 location)
    • Added secubox-app-* configuration loop (1 location)
    • Added secubox-app-* feed display (1 location)
    • Updated help text and examples (2 locations)
  2. package/secubox/secubox-app-nodogsplash/Makefile

    • Changed PKG_NAME from nodogsplash to secubox-app-nodogsplash
    • Kept PKG_SOURCE as nodogsplash-$(PKG_VERSION).tar.gz
    • Set PKG_BUILD_DIR to nodogsplash-$(PKG_VERSION)

Created Files:

  1. package/secubox/.appstore/apps.json (4.1 KB)

    • Master catalog with 5 apps
    • 4 categories defined
    • Complete metadata structure
  2. package/secubox/.appstore/README.md (2.0 KB)

    • App store documentation
    • Metadata field descriptions
    • Integration guide
  3. .codex/SECUBOX_APP_STORE.md (this file)

    • Implementation documentation
    • Usage examples
    • API proposals

Renamed Directories:

  1. package/secubox/nodogsplashpackage/secubox/secubox-app-nodogsplash

Testing Checklist

  • Build script recognizes secubox-app-* pattern
  • Help text displays secubox-app-* examples
  • Package renamed successfully
  • App store metadata created
  • Build test for secubox-app-nodogsplash
  • Build test for secubox-app-crowdsec (blocked by Go 1.25)
  • Integration with luci-app-secubox
  • App installation workflow
  • Dependency resolution

Next Steps

  1. LuCI Integration

    • Create app browser view in luci-app-secubox
    • Implement app installation UI
    • Add app status monitoring
    • Create update notification system
  2. Package Management

    • Implement dependency auto-installation
    • Add conflict detection UI
    • Create app removal workflow
    • Add backup/restore for app configs
  3. Documentation

    • Generate app documentation from metadata
    • Create user guides for each app
    • Add troubleshooting guides
    • Create video tutorials
  4. CI/CD

    • Automated app testing
    • Package signing
    • Repository hosting
    • Update distribution

Notes

  • All secubox-app-* packages follow consistent naming convention
  • App store metadata uses standard JSON format
  • Build system fully supports parallel builds
  • Categories are extensible for future apps
  • Status tracking allows beta testing of new apps

References

  • Build Script: secubox-tools/local-build.sh
  • App Catalog: package/secubox/.appstore/apps.json
  • Package Directory: package/secubox/secubox-app-*/
  • Dashboard: luci-app-secubox/ (future integration)