identify protocol used by curl for api

pull/42/head 4.2.1-1-05
binhex 5 years ago
parent 7151044024
commit 78fde36be4

@ -56,8 +56,16 @@ fi
# option 'Bypass authentication for clients on localhost'
if [[ "${VPN_PROV}" == "pia" && -n "${VPN_INCOMING_PORT}" ]]; then
curl -i -X POST -d "json={\"random_port\": false}" "http://localhost:${WEBUI_PORT}/api/v2/app/setPreferences" &> /dev/null
curl -i -X POST -d "json={\"listen_port\": ${VPN_INCOMING_PORT}}" "http://localhost:${WEBUI_PORT}/api/v2/app/setPreferences" &> /dev/null
# identify protocol, used by curl to connect to api
if grep -q 'WebUI\\HTTPS\\Enabled=true' '/config/qBittorrent/config/qBittorrent.conf'; then
web_protocol="https"
else
web_protocol="http"
fi
# note -k flag required to support insecure connection (self signed certs) when https used
curl -k -i -X POST -d "json={\"random_port\": false}" "${web_protocol}://localhost:${WEBUI_PORT}/api/v2/app/setPreferences" &> /dev/null
curl -k -i -X POST -d "json={\"listen_port\": ${VPN_INCOMING_PORT}}" "${web_protocol}://localhost:${WEBUI_PORT}/api/v2/app/setPreferences" &> /dev/null
# set qbittorrent port to current vpn port (used when checking for changes on next run)s
qbittorrent_port="${VPN_INCOMING_PORT}"

Loading…
Cancel
Save