1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Only display VPS available proxy

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-12-06 18:04:53 +01:00
parent 9eca2b3ed7
commit 4a660fdd72
2 changed files with 54 additions and 0 deletions

View file

@ -1936,8 +1936,10 @@ _set_config_from_vps() {
# Get available server
available_vpn="$(echo "$vps_config" | jsonfilter -q -e '@.vpn.available' | sed -e 's/\[ //' -e 's/ \]//' -e 's/,//g')"
available_proxy="$(echo "$vps_config" | jsonfilter -q -e '@.proxy.available' | sed -e 's/\[ //' -e 's/ \]//' -e 's/,//g')"
uci -q batch <<-EOF >/dev/null
del openmptcprouter.${servername}.available_vpn
del openmptcprouter.${servername}.available_proxy
EOF
if [ "$user_permission" = "ro" ]; then
@ -1947,6 +1949,12 @@ _set_config_from_vps() {
set openmptcprouter.${servername}.available_vpn=${current_vpn}
EOF
fi
current_proxy="$(echo "$vps_config" | jsonfilter -q -e '@.proxy.current')"
if [ -n "$current_proxy" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.${servername}.available_proxy=${current_proxy}
EOF
fi
else
if [ -n "$available_vpn" ]; then
@ -1956,6 +1964,13 @@ _set_config_from_vps() {
EOF
done
fi
if [ -n "$available_proxy" ]; then
for proxy in $available_proxy; do
uci -q batch <<-EOF >/dev/null
add_list openmptcprouter.${servername}.available_proxy=$proxy
EOF
done
fi
fi
if [ "$noerror" = "1" ]; then
uci -q batch <<-EOF >/dev/null