refactor(gluetun): collapse to one function name for the refresh hook
Drop the appWebuiRefresh_gluetun -> webuiGenerateGluetunProviders wrapper; rename the function itself to appWebuiRefresh_gluetun and point the installer + the gluetun_refresh_providers tool at it. One name, no indirection. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
parent
e24927ee6f
commit
8670a02c00
@ -96,7 +96,7 @@ installGluetun()
|
|||||||
echo "---- $menu_number. Refreshing Gluetun provider snapshot."
|
echo "---- $menu_number. Refreshing Gluetun provider snapshot."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
webuiGenerateGluetunProviders;
|
appWebuiRefresh_gluetun;
|
||||||
|
|
||||||
((menu_number++))
|
((menu_number++))
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Per-app routine WebUI-refresh hook (appWebuiRefresh_<app>): webui_updater calls
|
||||||
|
# it on every WebUI update while gluetun is installed; the installer (gluetun.sh)
|
||||||
|
# and the 'gluetun_refresh_providers' tool call it directly too.
|
||||||
|
#
|
||||||
# Fetches gluetun's upstream servers.json, slims it down to a
|
# Fetches gluetun's upstream servers.json, slims it down to a
|
||||||
# { providers: { <name>: { vpnTypes, countries } } } shape, and writes it
|
# { providers: { <name>: { vpnTypes, countries } } } shape, and writes it
|
||||||
# to the WebUI data dir so the per-app config dropdowns stay honest as
|
# to the WebUI data dir so the per-app config dropdowns stay honest as
|
||||||
# gluetun adds/removes providers and protocols. Falls back silently to the
|
# gluetun adds/removes providers and protocols. Falls back silently to the
|
||||||
# previous snapshot (or the bundled default) on network failure.
|
# previous snapshot (or the bundled default) on network failure.
|
||||||
webuiGenerateGluetunProviders() {
|
appWebuiRefresh_gluetun() {
|
||||||
local output_file="${containers_dir}libreportal/frontend/data/apps/generated/gluetun-providers.json"
|
local output_file="${containers_dir}libreportal/frontend/data/apps/generated/gluetun-providers.json"
|
||||||
local upstream="https://raw.githubusercontent.com/qdm12/gluetun/master/internal/storage/servers.json"
|
local upstream="https://raw.githubusercontent.com/qdm12/gluetun/master/internal/storage/servers.json"
|
||||||
local tmp="$(mktemp)"
|
local tmp="$(mktemp)"
|
||||||
@ -78,11 +82,3 @@ webuiGenerateGluetunProviders() {
|
|||||||
isNotice "Empty gluetun snapshot generated; ignoring."
|
isNotice "Empty gluetun snapshot generated; ignoring."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Routine WebUI-update hook (appWebuiRefresh_<app>): 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
|
|
||||||
}
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@ appGluetunRefreshProviders()
|
|||||||
local tool_args="$1"
|
local tool_args="$1"
|
||||||
|
|
||||||
isNotice "Refreshing Gluetun provider snapshot..."
|
isNotice "Refreshing Gluetun provider snapshot..."
|
||||||
webuiGenerateGluetunProviders
|
appWebuiRefresh_gluetun
|
||||||
isSuccessful "Provider snapshot regenerated."
|
isSuccessful "Provider snapshot regenerated."
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user