fix: Detect app wizards and return full profile objects (v0.6.0-r16)

- 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 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-07 12:34:35 +01:00
parent 937e57c3e7
commit 0577410c42
2 changed files with 36 additions and 9 deletions

View File

@ -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

View File

@ -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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"