From 8b3627777f6e4d6bd54745887ac5ced881ac11e1 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 7 Jan 2026 13:15:56 +0100 Subject: [PATCH] fix: Add standalone manifest apps to list_apps wizard display (v0.6.0-r20) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modified list_apps RPC method to include apps from plugin manifests - Previously only catalog apps could have has_wizard flag - Now scans /usr/share/secubox/plugins/*/manifest.json files - Adds apps with wizard.fields to the apps list even if not in catalog - If app exists in catalog, adds has_wizard flag - If app not in catalog, creates new app entry with manifest data - Fixes wizard page showing "No manifests detected" - Apps domoticz and lyrion now appear with Configure button 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../root/usr/libexec/rpcd/luci.secubox | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/package/secubox/secubox-core/root/usr/libexec/rpcd/luci.secubox b/package/secubox/secubox-core/root/usr/libexec/rpcd/luci.secubox index e5455974..ec27de51 100755 --- a/package/secubox/secubox-core/root/usr/libexec/rpcd/luci.secubox +++ b/package/secubox/secubox-core/root/usr/libexec/rpcd/luci.secubox @@ -472,39 +472,60 @@ case "$1" in ;; list_apps) - # Returns apps from catalog and marks apps with wizards + # Returns apps from catalog and adds apps from manifests with wizards CATALOG_FILE="/usr/share/secubox/catalog.json" PLUGINS_DIR="/usr/share/secubox/plugins" if [ -f "$CATALOG_FILE" ]; then # Get base apps from catalog APPS_JSON=$(jq '.plugins' "$CATALOG_FILE") + else + APPS_JSON='[]' + fi - # Check each plugin directory for manifest with wizard - for plugin_dir in "$PLUGINS_DIR"/*; do - [ -d "$plugin_dir" ] || continue - manifest="$plugin_dir/manifest.json" - [ -f "$manifest" ] || continue + # Scan plugin manifests and add apps with wizards + for plugin_dir in "$PLUGINS_DIR"/*; do + [ -d "$plugin_dir" ] || continue + manifest="$plugin_dir/manifest.json" + [ -f "$manifest" ] || continue - # Get app ID from manifest - app_id=$(jq -r '.id // empty' "$manifest" 2>/dev/null) - [ -n "$app_id" ] || continue + # Get app ID from manifest + app_id=$(jq -r '.id // empty' "$manifest" 2>/dev/null) + [ -n "$app_id" ] || continue - # Check if manifest has wizard configuration - has_wizard=$(jq -e '.wizard.fields | length > 0' "$manifest" >/dev/null 2>&1 && echo "true" || echo "false") + # Check if manifest has wizard configuration + has_wizard=$(jq -e '.wizard.fields | length > 0' "$manifest" >/dev/null 2>&1 && echo "true" || echo "false") - # Add has_wizard flag to matching app in catalog - if [ "$has_wizard" = "true" ]; then + if [ "$has_wizard" = "true" ]; then + # Check if app already exists in catalog + app_exists=$(echo "$APPS_JSON" | jq --arg id "$app_id" 'map(select(.id == $id)) | length') + + if [ "$app_exists" -gt 0 ]; then + # Update existing catalog app with has_wizard flag APPS_JSON=$(echo "$APPS_JSON" | jq --arg id "$app_id" \ 'map(if .id == $id then . + {has_wizard: true} else . end)') + else + # Add new app from manifest + app_data=$(jq '{ + id: .id, + name: .name, + description: .description, + version: .version, + icon: "📦", + has_wizard: true, + state: "available" + }' "$manifest") + APPS_JSON=$(echo "$APPS_JSON" | jq --argjson app "$app_data" '. + [$app]') fi - done + fi + done - # Return modified apps list + # Return modified apps list + if [ -f "$CATALOG_FILE" ]; then jq -n --argjson apps "$APPS_JSON" --argjson cats "$(jq '.categories // {}' "$CATALOG_FILE")" \ '{apps: $apps, categories: $cats}' else - echo '{"apps":[],"categories":{}}' + jq -n --argjson apps "$APPS_JSON" '{apps: $apps, categories: {}}' fi ;;