Fix qBittorrent 5.x session cookie name (SID -> QBT_SID_{port})
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-05-20 19:28:08 +02:00
parent d2a4f3dbad
commit 5ac98d966c
+3 -7
View File
@@ -14,11 +14,8 @@ async function getCookie(): Promise<string> {
const pass = process.env.QBT_PASSWORD
if (!host || !user || !pass) throw new Error('QBT_HOST / QBT_USER / QBT_PASSWORD not configured')
const loginUrl = `${host}/api/v2/auth/login`
console.log(`[qbt] POST ${loginUrl} user=${user}`)
const res = await axios.post(
loginUrl,
`${host}/api/v2/auth/login`,
new URLSearchParams({ username: user, password: pass }),
{
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': host, 'Origin': host },
@@ -26,9 +23,8 @@ async function getCookie(): Promise<string> {
}
)
console.log(`[qbt] status=${res.status} headers=${JSON.stringify(res.headers)} body=${JSON.stringify(res.data)}`)
const cookie = (res.headers['set-cookie'] ?? []).find((c: string) => c.startsWith('SID='))
// qBittorrent 5.x renamed the cookie from SID to QBT_SID_{port}
const cookie = (res.headers['set-cookie'] ?? []).find((c: string) => /^(QBT_)?SID[_=]/.test(c))
if (!cookie) throw new Error(`qBittorrent login failed (${res.status}): "${String(res.data).trim()}"`)
sid = cookie.split(';')[0]