Per the intended model: catalog sources should live in the config place (like
domains), and registry_catalog.json should be a purely GENERATED artifact
derived from them — not the source of truth. Replaces the earlier
$docker_dir/catalog/sources.json store.
- New configs/general/general_catalogs — CFG_CATALOG_1..9, one catalog base URL
per slot ("url" or "url|channel"), domains-style. Official stays pinned as
source #1 (derived from CFG_RELEASE_BASE_URL, not listed here). Slot N → source
idx N+1 (stable id for the Add picker / `app add --source`).
- catalog_sources.sh now reads/writes those CFG vars (via updateConfigOption)
instead of a JSON file; dropped catalogSourcesFile + the enable/disable toggle
(presence = enabled; remove = clear the slot).
- configUpdateBatch regenerates registry_catalog.json when a CFG_CATALOG_* key
changed — so pressing Save in the WebUI rebuilds the browse data.
- webuiRegistryCatalogScan is unchanged (still iterates catalogEnabledSources).
Verified: CFG_CATALOG_1/2 → sources at idx 2/3, empty slots skipped, url|channel
parsed, official pinned at idx 1.
Signed-off-by: librelad <librelad@digitalangels.vip>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
67 lines
2.0 KiB
Bash
Executable File
67 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Apply a batch of `CFG_KEY=VALUE` pairs joined by `|` (literal `|` in values
|
|
# encoded as `%7C`). Re-runs apps.json regen + startScan after.
|
|
configUpdateBatch()
|
|
{
|
|
local encoded_pairs="$1"
|
|
|
|
if [[ -z "$encoded_pairs" ]]; then
|
|
isNotice "configUpdateBatch called with no changes — skipping update."
|
|
fi
|
|
|
|
isHeader "Applying configuration changes"
|
|
|
|
local applied=0
|
|
local failed=0
|
|
local catalog_changed=false
|
|
|
|
IFS='|' read -ra pairs <<< "$encoded_pairs"
|
|
for pair in "${pairs[@]}"; do
|
|
[[ -z "$pair" ]] && continue
|
|
if [[ "$pair" =~ ^(CFG_[A-Z0-9_]+)=(.*)$ ]]; then
|
|
local key="${BASH_REMATCH[1]}"
|
|
local value="${BASH_REMATCH[2]//%7C/|}"
|
|
[[ "$key" == CFG_CATALOG_* ]] && catalog_changed=true
|
|
if updateConfigOption "$key" "$value"; then
|
|
((applied++))
|
|
else
|
|
((failed++))
|
|
fi
|
|
else
|
|
isNotice "Skipping malformed pair: $pair"
|
|
((failed++))
|
|
fi
|
|
done
|
|
|
|
isSuccessful "Applied $applied config change(s); $failed skipped/failed."
|
|
|
|
echo ""
|
|
echo "---- Regenerating apps.json from updated config..."
|
|
echo ""
|
|
if declare -f webuiGenerateLibrePortalConfig >/dev/null 2>&1; then
|
|
webuiGenerateLibrePortalConfig >/dev/null 2>&1 || true
|
|
isSuccessful "apps.json regenerated."
|
|
fi
|
|
|
|
echo ""
|
|
echo "---- Running system scan to apply new configuration..."
|
|
echo ""
|
|
if declare -f startScan >/dev/null 2>&1; then
|
|
startScan
|
|
isSuccessful "System scan completed."
|
|
fi
|
|
|
|
# Catalog sources are the source of truth for the App Center browse data;
|
|
# rebuild the generated registry_catalog.json when a CFG_CATALOG_* changed.
|
|
if [[ "$catalog_changed" == true ]] && declare -f catalogRefresh >/dev/null 2>&1; then
|
|
echo ""
|
|
echo "---- Refreshing catalog sources..."
|
|
echo ""
|
|
catalogRefresh
|
|
fi
|
|
|
|
echo ""
|
|
isSuccessful "Configuration update complete."
|
|
}
|