use api to set random port setting

pull/7/head
binhex 6 years ago
parent b68b0069a2
commit 3d76a04622

@ -6,6 +6,7 @@ if [[ "${qbittorrent_running}" == "true" ]]; then
if [[ "${VPN_PROV}" == "pia" && -n "${VPN_INCOMING_PORT}" ]]; then if [[ "${VPN_PROV}" == "pia" && -n "${VPN_INCOMING_PORT}" ]]; then
curl -i -X POST -d "json=%7B%22random_port%22%3Afalse%7D" "http://localhost:${WEBUI_PORT}/command/setPreferences" &> /dev/null
curl -i -X POST -d "json=%7B%22listen_port%22%3A${VPN_INCOMING_PORT}%7D" "http://localhost:${WEBUI_PORT}/command/setPreferences" &> /dev/null curl -i -X POST -d "json=%7B%22listen_port%22%3A${VPN_INCOMING_PORT}%7D" "http://localhost:${WEBUI_PORT}/command/setPreferences" &> /dev/null
fi fi
@ -61,6 +62,7 @@ else
# option 'Bypass authentication for clients on localhost' # option 'Bypass authentication for clients on localhost'
if [[ "${VPN_PROV}" == "pia" && -n "${VPN_INCOMING_PORT}" ]]; then if [[ "${VPN_PROV}" == "pia" && -n "${VPN_INCOMING_PORT}" ]]; then
curl -i -X POST -d "json=%7B%22random_port%22%3Afalse%7D" "http://localhost:${WEBUI_PORT}/command/setPreferences" &> /dev/null
curl -i -X POST -d "json=%7B%22listen_port%22%3A${VPN_INCOMING_PORT}%7D" "http://localhost:${WEBUI_PORT}/command/setPreferences" &> /dev/null curl -i -X POST -d "json=%7B%22listen_port%22%3A${VPN_INCOMING_PORT}%7D" "http://localhost:${WEBUI_PORT}/command/setPreferences" &> /dev/null
fi fi

@ -40,9 +40,6 @@ while true; do
# forcibly set allow anonymous access from localhost to api (used to change incoming port) # forcibly set allow anonymous access from localhost to api (used to change incoming port)
sed -i 's~^WebUI\\LocalHostAuth=.*~WebUI\\LocalHostAuth=false~g' "${qbittorrent_config}" sed -i 's~^WebUI\\LocalHostAuth=.*~WebUI\\LocalHostAuth=false~g' "${qbittorrent_config}"
# forcibly set random incoming port to false
sed -i 's~^General\\UseRandomPort=.*~General\\UseRandomPort=false~g' "${qbittorrent_config}"
# run script to check ip is valid for tunnel device (will block until valid) # run script to check ip is valid for tunnel device (will block until valid)
source /home/nobody/getvpnip.sh source /home/nobody/getvpnip.sh

Loading…
Cancel
Save