The frontend modularization moved icons to frontend/core/icons/ and updated the frontend JS, but the host-side generators were never updated — they wrote the apps.json/categories 'icon' field as /icons/apps/<app>.svg and /icons/categories/ <cat>.svg, and webui_app_icons.sh / webui_config.sh synced icon files into the non-existent frontend/icons/apps. Those served paths 404 (text/html catch-all), so every app card fell back to default.svg (the generic box) instead of its real logo. Repointed to /core/icons/... (where the SVGs actually live and serve as image/svg+xml): - webui_config.sh: icon dir + emitted apps.json icon path - webui_app_icons.sh: icon sync dir + comment - webui_container_setup.sh: comment - webui_create_app_categories.sh: 11 category icon paths Source fix only — the live apps.json refreshes on the next host-side regen (lpRegen). NOT touched: scripts/backup/engines/*.json '/icons/config/backup.svg' (that SVG lives at the oddly-nested components/admin/config/icons/config/ and serves at neither path — needs a placement decision, flagged separately). Signed-off-by: librelad <librelad@digitalangels.vip>
59 lines
2.1 KiB
Bash
Executable File
59 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Sync app icons from container template dirs to the LibrePortal frontend.
|
|
#
|
|
# apps.json references /core/icons/apps/<app>.<ext> unconditionally (see
|
|
# webui_config.sh), so the icon file must physically exist in the frontend
|
|
# icons dir or the apps page falls back to the default icon.
|
|
|
|
# Copy a single app's icon into the frontend icons dir. Returns 0 if an
|
|
# icon was copied, 1 if the app has no icon (or no app name given).
|
|
# Idempotent — cheap enough to call on every install/uninstall.
|
|
webuiSyncAppIcon() {
|
|
local app_name="$1"
|
|
[[ -z "$app_name" ]] && return 1
|
|
|
|
local icons_dir="${containers_dir}libreportal/frontend/core/icons/apps"
|
|
mkdir -p "$icons_dir"
|
|
|
|
# Icons live in the install template dir — copy_build_context.sh
|
|
# excludes *.svg from the install→deployed copy, so the deployed
|
|
# container dir can't be relied on as the source.
|
|
local src_dir="${install_containers_dir}/${app_name}"
|
|
local ext
|
|
for ext in svg png; do
|
|
local src="${src_dir}/${app_name}.${ext}"
|
|
if [[ -f "$src" ]]; then
|
|
# cp to a temp name then mv so the webserver never serves a
|
|
# half-written file.
|
|
local dest="${icons_dir}/${app_name}.${ext}"
|
|
if cp "$src" "${dest}.tmp.$$" 2>/dev/null; then
|
|
mv "${dest}.tmp.$$" "$dest" 2>/dev/null
|
|
fi
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
# Sync every app's icon. Used by the full WebUI update pass.
|
|
webuiSyncAppIcons() {
|
|
echo "Syncing app icons from installed containers to LibrePortal frontend..."
|
|
|
|
if [ -d "$install_containers_dir" ]; then
|
|
find "$install_containers_dir" -maxdepth 1 -type d -not -path "$install_containers_dir" | while read -r dir; do
|
|
local app_name
|
|
app_name=$(basename "$dir")
|
|
if webuiSyncAppIcon "$app_name"; then
|
|
echo "✅ Copied icon for $app_name"
|
|
else
|
|
echo "⚠️ No icon found for $app_name"
|
|
fi
|
|
done
|
|
else
|
|
echo "❌ Install containers directory not found: $install_containers_dir"
|
|
fi
|
|
|
|
echo "Icon sync completed!"
|
|
}
|