From 3d76a04622bb42bbe3fe03aa3ab2aee68bbd0152 Mon Sep 17 00:00:00 2001 From: binhex Date: Sun, 11 Nov 2018 13:38:01 +0000 Subject: [PATCH] use api to set random port setting --- run/nobody/qbittorrent.sh | 2 ++ run/nobody/watchdog.sh | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/run/nobody/qbittorrent.sh b/run/nobody/qbittorrent.sh index 9e450b5..702fbf7 100644 --- a/run/nobody/qbittorrent.sh +++ b/run/nobody/qbittorrent.sh @@ -6,6 +6,7 @@ if [[ "${qbittorrent_running}" == "true" ]]; 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 fi @@ -61,6 +62,7 @@ else # option 'Bypass authentication for clients on localhost' 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 fi diff --git a/run/nobody/watchdog.sh b/run/nobody/watchdog.sh index c762dd4..a342c93 100644 --- a/run/nobody/watchdog.sh +++ b/run/nobody/watchdog.sh @@ -40,9 +40,6 @@ while true; do # 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}" - # 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) source /home/nobody/getvpnip.sh