Skip to content

Commit

Permalink
put app specific code in seperate file
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhotio committed Jan 23, 2024
1 parent 42b50d0 commit 8238296
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 8 additions & 0 deletions root/app/proton_update_app
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# shellcheck shell=bash
webui_https="http"
if grep -q 'WebUI\\HTTPS\\Enabled=true' "${CONFIG_DIR}/config/qBittorrent.conf"; then
webui_https="https"
fi
curl -fsSL --insecure -X POST -d "json={\"upnp\": false}" "${webui_https}://localhost:${WEBUI_PORTS%%/*}/api/v2/app/setPreferences"
curl -fsSL --insecure -X POST -d "json={\"random_port\": false}" "${webui_https}://localhost:${WEBUI_PORTS%%/*}/api/v2/app/setPreferences"
curl -fsSL --insecure -X POST -d "json={\"listen_port\": ${port}}" "${webui_https}://localhost:${WEBUI_PORTS%%/*}/api/v2/app/setPreferences"
9 changes: 2 additions & 7 deletions root/etc/s6-overlay/s6-rc.d/service-proton/run
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ while true; do
old_port=$(cat "${CONFIG_DIR}/forwarded_port")
if [[ "${port}" != "${old_port}" ]]; then
echo "${port}" > "${CONFIG_DIR}/forwarded_port"
webui_https="http"
if grep -q 'WebUI\\HTTPS\\Enabled=true' "${CONFIG_DIR}/config/qBittorrent.conf"; then
webui_https="https"
fi
curl -fsSL --insecure -X POST -d "json={\"upnp\": false}" "${webui_https}://localhost:${WEBUI_PORTS%%/*}/api/v2/app/setPreferences"
curl -fsSL --insecure -X POST -d "json={\"random_port\": false}" "${webui_https}://localhost:${WEBUI_PORTS%%/*}/api/v2/app/setPreferences"
curl -fsSL --insecure -X POST -d "json={\"listen_port\": ${port}}" "${webui_https}://localhost:${WEBUI_PORTS%%/*}/api/v2/app/setPreferences"
# shellcheck source=/dev/null
source "${APP_DIR}/proton_update_app"
fi
echo "[INFO] [$(date '+%Y-%m-%d %H:%M:%S')] ProtonVPN forwarded port is \"${port}\"."
else
Expand Down

0 comments on commit 8238296

Please sign in to comment.