From bc9db0aa705595112c892a8c97d66dc5fa267cdc Mon Sep 17 00:00:00 2001 From: s0x <7237915+soxfor@users.noreply.github.com> Date: Tue, 18 Apr 2023 23:52:56 +0100 Subject: [PATCH 1/2] fix: #6 - qbt_login fails if qbittorrent has CSRF disabled --- data/start.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/start.sh b/data/start.sh index f74bd81..ea8c9a1 100755 --- a/data/start.sh +++ b/data/start.sh @@ -18,7 +18,7 @@ findactiveport() { } qbt_login() { - curl -s -i --header "Referer: http://${QBITTORRENT_SERVER}:${QBITTORRENT_PORT}" --data "username=${QBITTORRENT_USER}&password=${QBITTORRENT_PASS}" http://${QBITTORRENT_SERVER}:${QBITTORRENT_PORT}/api/v2/auth/login | grep -oP '(?!set-cookie:.)SID=.*(?=\;.HttpOnly\;.path=\/\;)' + curl -s -i --header "Referer: http://${QBITTORRENT_SERVER}:${QBITTORRENT_PORT}" --data "username=${QBITTORRENT_USER}&password=${QBITTORRENT_PASS}" http://${QBITTORRENT_SERVER}:${QBITTORRENT_PORT}/api/v2/auth/login | grep -oP '(?!set-cookie:.)SID=.*(?=\;.HttpOnly\;)' } qbt_changeport(){ @@ -62,6 +62,10 @@ get_portmap() { if ! qbt_checksid; then echo "$(timestamp) | qBittorrent Cookie invalid, getting new SessionID" qbt_sid=$(qbt_login) + if [ -z "${qbt_sid}" ]; then + echo "$(timestamp) | Failed getting new SessionID from qBittorrent" + return 1 + fi else echo "$(timestamp) | qBittorrent SessionID Ok!" fi From 738e1240ff91524ca461e56903f8d955a66916b3 Mon Sep 17 00:00:00 2001 From: s0x <7237915+soxfor@users.noreply.github.com> Date: Tue, 18 Apr 2023 23:53:46 +0100 Subject: [PATCH 2/2] update: Dockerfile - bump patch level --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a83e826..6d0f104 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ FROM ubuntu:jammy LABEL org.opencontainers.image.source="https://github.com/soxfor/qbittorrent-natmap" LABEL org.opencontainers.image.base.name="ubuntu:jammy" LABEL description="Map port via NAT-PMP and update qBittorrent configuration" -LABEL version="1.0.5" +LABEL version="1.0.6" ARG DEBIAN_FRONTEND=noninteractive