diff --git a/scripts/webui/data/generators/apps/webui_gluetun_providers.sh b/containers/gluetun/scripts/gluetun_providers.sh similarity index 89% rename from scripts/webui/data/generators/apps/webui_gluetun_providers.sh rename to containers/gluetun/scripts/gluetun_providers.sh index b692898..785112e 100644 --- a/scripts/webui/data/generators/apps/webui_gluetun_providers.sh +++ b/containers/gluetun/scripts/gluetun_providers.sh @@ -78,3 +78,11 @@ webuiGenerateGluetunProviders() { isNotice "Empty gluetun snapshot generated; ignoring." fi } + +# Routine WebUI-update hook (appWebuiRefresh_): keep the provider snapshot +# fresh on every WebUI update while gluetun is installed. The installer +# (gluetun.sh) refreshes on first install and the 'gluetun_refresh_providers' +# tool refreshes on demand; this covers the in-between drift. +appWebuiRefresh_gluetun() { + webuiGenerateGluetunProviders +} diff --git a/scripts/source/files/arrays/files_webui.sh b/scripts/source/files/arrays/files_webui.sh index 86f31fd..8ec9064 100755 --- a/scripts/source/files/arrays/files_webui.sh +++ b/scripts/source/files/arrays/files_webui.sh @@ -8,7 +8,6 @@ webui_scripts=( "webui/data/generators/apps/webui_app_status.sh" "webui/data/generators/apps/webui_config_patch.sh" "webui/data/generators/apps/webui_config.sh" - "webui/data/generators/apps/webui_gluetun_providers.sh" "webui/data/generators/apps/webui_services.sh" "webui/data/generators/apps/webui_tools.sh" "webui/data/generators/backup/webui_backup_app_status.sh" diff --git a/scripts/webui/webui_updater.sh b/scripts/webui/webui_updater.sh index aa05ce4..6bc62a9 100755 --- a/scripts/webui/webui_updater.sh +++ b/scripts/webui/webui_updater.sh @@ -69,17 +69,21 @@ webuiLibrePortalUpdate() { local result=$(webuiGenerateAppsToolsConfig) checkSuccess "Generated apps-tools.json..." - # Only refresh the gluetun provider snapshot when gluetun is - # actually deployed — the upstream servers.json is ~7 MB and - # routine WebUI updates shouldn't burn that bandwidth for users - # who never install gluetun. The gluetun installer itself - # (containers/gluetun/gluetun.sh) refreshes on first install, - # and the Tools action 'gluetun_refresh_providers' lets users - # refresh on demand. - if [[ -f "${containers_dir}gluetun/docker-compose.yml" ]]; then - local result=$(webuiGenerateGluetunProviders) - checkSuccess "Refreshed gluetun provider snapshot..." - fi + # Per-app routine refresh hooks. An installed app may define + # appWebuiRefresh_ (in containers//scripts/) for data it + # wants refreshed on every WebUI update — e.g. gluetun's provider + # snapshot. Gated on the app being installed (its live compose + # exists, tested directly so it works without list perm on the + # container-user-owned data dir), so non-users never pay for it. + local _app _dir _hook + for _dir in "${install_containers_dir}"*/; do + _app="$(basename "$_dir")" + [[ -f "${containers_dir}${_app}/docker-compose.yml" ]] || continue + _hook="appWebuiRefresh_${_app}" + declare -F "$_hook" >/dev/null 2>&1 || continue + local result=$($_hook) + checkSuccess "Refreshed ${_app} WebUI data..." + done # Generate Backup locations / snapshots / engines / dashboards local result=$(webuiGenerateBackupLocations && webuiGenerateBackupDashboard && webuiGenerateBackupSnapshots all && webuiGenerateBackupAppStatus && webuiGenerateBackupEngines && webuiGenerateBackupSchema && webuiGenerateBackupPasswords)