From 0577410c42978ac07826eea1e563e0ff32f1c855 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 7 Jan 2026 12:34:35 +0100 Subject: [PATCH] fix: Detect app wizards and return full profile objects (v0.6.0-r16) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated list_apps RPC to scan /usr/share/secubox/plugins/*/manifest.json - Apps with wizard.fields configuration now get has_wizard: true flag - Updated secubox-profile to return full JSON profile objects instead of filenames - Fixes wizard page showing "No profiles available" and "No manifests detected" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../root/usr/libexec/rpcd/luci.secubox | 31 +++++++++++++++++-- .../root/usr/sbin/secubox-profile | 14 ++++----- 2 files changed, 36 insertions(+), 9 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 9512101b..e5455974 100755 --- a/package/secubox/secubox-core/root/usr/libexec/rpcd/luci.secubox +++ b/package/secubox/secubox-core/root/usr/libexec/rpcd/luci.secubox @@ -472,10 +472,37 @@ case "$1" in ;; list_apps) - # Alias for get_appstore_apps - returns apps from main catalog + # Returns apps from catalog and marks apps with wizards CATALOG_FILE="/usr/share/secubox/catalog.json" + PLUGINS_DIR="/usr/share/secubox/plugins" + if [ -f "$CATALOG_FILE" ]; then - jq '{apps: .plugins, categories: .categories}' "$CATALOG_FILE" + # Get base apps from catalog + APPS_JSON=$(jq '.plugins' "$CATALOG_FILE") + + # 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 + + # 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") + + # Add has_wizard flag to matching app in catalog + if [ "$has_wizard" = "true" ]; then + APPS_JSON=$(echo "$APPS_JSON" | jq --arg id "$app_id" \ + 'map(if .id == $id then . + {has_wizard: true} else . end)') + fi + done + + # Return modified apps list + jq -n --argjson apps "$APPS_JSON" --argjson cats "$(jq '.categories // {}' "$CATALOG_FILE")" \ + '{apps: $apps, categories: $cats}' else echo '{"apps":[],"categories":{}}' fi diff --git a/package/secubox/secubox-core/root/usr/sbin/secubox-profile b/package/secubox/secubox-core/root/usr/sbin/secubox-profile index 62da5d13..786deb6e 100755 --- a/package/secubox/secubox-core/root/usr/sbin/secubox-profile +++ b/package/secubox/secubox-core/root/usr/sbin/secubox-profile @@ -18,19 +18,19 @@ list_profiles() { local format="${1:-table}" if [ "$format" = "--json" ] || [ "$format" = "json" ]; then - json_init - json_add_array "profiles" + echo -n '{"profiles":[' + local first=1 - for ext in yaml yml json; do + for ext in json; do for profile in "$PROFILE_DIR"/*.$ext; do [ -f "$profile" ] || continue - local name=$(basename "$profile" | sed 's/\.\(yaml\|yml\|json\)$//') - json_add_string "" "$name" + [ "$first" = "1" ] || echo -n ',' + cat "$profile" + first=0 done done - json_close_array - json_dump + echo ']}' else echo "Available Profiles:" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"