@ctrl/qbittorrent 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/qbittorrent.js +9 -6
- package/package.json +12 -12
package/dist/src/qbittorrent.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
+
import { parse as cookieParse } from 'cookie';
|
1
2
|
import { FormData } from 'node-fetch-native';
|
2
3
|
import { ofetch } from 'ofetch';
|
3
|
-
import { Cookie } from 'tough-cookie';
|
4
4
|
import { joinURL } from 'ufo';
|
5
5
|
import { magnetDecode } from '@ctrl/magnet-link';
|
6
6
|
import { hash } from '@ctrl/torrent-file';
|
@@ -530,17 +530,20 @@ export class QBittorrent {
|
|
530
530
|
redirect: 'manual',
|
531
531
|
retry: false,
|
532
532
|
timeout: this.config.timeout,
|
533
|
-
|
533
|
+
...(this.config.agent ? { agent: this.config.agent } : {}),
|
534
534
|
});
|
535
535
|
if (!res.headers.get('set-cookie')?.length) {
|
536
536
|
throw new Error('Cookie not found. Auth Failed.');
|
537
537
|
}
|
538
|
-
const cookie =
|
539
|
-
if (!cookie
|
538
|
+
const cookie = cookieParse(res.headers.get('set-cookie'));
|
539
|
+
if (!cookie.SID) {
|
540
540
|
throw new Error('Invalid cookie');
|
541
541
|
}
|
542
|
-
this._sid = cookie.
|
543
|
-
|
542
|
+
this._sid = cookie.SID;
|
543
|
+
// Not sure if it might be lowercase
|
544
|
+
const expires = cookie.Expires ?? cookie.expires;
|
545
|
+
// Default expiration is expected to be 1 hour
|
546
|
+
this._exp = expires ? new Date(expires) : new Date(Date.now() + 3600000);
|
544
547
|
return true;
|
545
548
|
}
|
546
549
|
logout() {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ctrl/qbittorrent",
|
3
|
-
"version": "7.0
|
3
|
+
"version": "7.1.0",
|
4
4
|
"description": "TypeScript api wrapper for qbittorrent using got",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
@@ -32,24 +32,24 @@
|
|
32
32
|
"test:ci": "vitest run --coverage --reporter=default --reporter=junit --outputFile=./junit.xml"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@ctrl/magnet-link": "^
|
35
|
+
"@ctrl/magnet-link": "^4.0.1",
|
36
36
|
"@ctrl/shared-torrent": "^5.0.0",
|
37
37
|
"@ctrl/torrent-file": "^3.0.0",
|
38
|
-
"
|
38
|
+
"cookie": "^0.6.0",
|
39
|
+
"node-fetch-native": "^1.6.1",
|
39
40
|
"ofetch": "^1.3.3",
|
40
|
-
"
|
41
|
-
"ufo": "^1.3.1"
|
41
|
+
"ufo": "^1.3.2"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
|
-
"@ctrl/eslint-config": "4.0.
|
44
|
+
"@ctrl/eslint-config": "4.0.12",
|
45
45
|
"@sindresorhus/tsconfig": "5.0.0",
|
46
|
-
"@types/
|
47
|
-
"@types/
|
48
|
-
"@vitest/coverage-v8": "
|
46
|
+
"@types/cookie": "0.6.0",
|
47
|
+
"@types/node": "20.10.5",
|
48
|
+
"@vitest/coverage-v8": "1.1.0",
|
49
49
|
"p-wait-for": "5.0.2",
|
50
|
-
"typedoc": "0.25.
|
51
|
-
"typescript": "5.
|
52
|
-
"vitest": "
|
50
|
+
"typedoc": "0.25.4",
|
51
|
+
"typescript": "5.3.3",
|
52
|
+
"vitest": "1.1.0"
|
53
53
|
},
|
54
54
|
"release": {
|
55
55
|
"branches": [
|