This commit is contained in:
@@ -22,12 +22,11 @@ async function getCookie(): Promise<string> {
|
||||
new URLSearchParams({ username: user, password: pass }),
|
||||
{
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': host, 'Origin': host },
|
||||
maxRedirects: 0,
|
||||
validateStatus: s => s < 400,
|
||||
}
|
||||
)
|
||||
|
||||
console.log(`[qbt] login status=${res.status} body=${JSON.stringify(res.data)} cookies=${JSON.stringify(res.headers['set-cookie'])}`)
|
||||
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='))
|
||||
if (!cookie) throw new Error(`qBittorrent login failed (${res.status}): "${String(res.data).trim()}"`)
|
||||
|
||||
Reference in New Issue
Block a user