@ctrl/deluge 4.0.0 → 4.0.1
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/deluge.d.ts +1 -1
- package/dist/src/deluge.js +3 -5
- package/package.json +16 -26
package/dist/src/deluge.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/// <reference types="node" />
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
2
2
|
import { Response } from 'got';
|
3
3
|
import { AddTorrentOptions as NormalizedAddTorrentOptions, AllClientData, NormalizedTorrent, TorrentClient, TorrentSettings } from '@ctrl/shared-torrent';
|
4
4
|
import { AddTorrentOptions, AddTorrentResponse, BooleanStatus, ConfigResponse, DefaultResponse, DelugeSettings, GetHostsResponse, GetHostStatusResponse, ListMethods, PluginInfo, PluginsListResponse, StringStatus, TorrentFiles, TorrentInfo, TorrentListResponse, TorrentOptions, TorrentStatus, Tracker, UploadResponse } from './types.js';
|
package/dist/src/deluge.js
CHANGED
@@ -89,7 +89,6 @@ export class Deluge {
|
|
89
89
|
* @returns true if valid
|
90
90
|
*/
|
91
91
|
async checkSession() {
|
92
|
-
var _a;
|
93
92
|
// cookie is missing or expires in x seconds
|
94
93
|
if (this._cookie) {
|
95
94
|
// eslint-disable-next-line new-cap
|
@@ -102,7 +101,7 @@ export class Deluge {
|
|
102
101
|
if (this._cookie) {
|
103
102
|
try {
|
104
103
|
const check = await this.request('auth.check_session', undefined, false);
|
105
|
-
if (
|
104
|
+
if (check?.body?.result) {
|
106
105
|
return true;
|
107
106
|
}
|
108
107
|
}
|
@@ -524,7 +523,6 @@ export class Deluge {
|
|
524
523
|
}
|
525
524
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
526
525
|
async request(method, params = [], needsAuth = true, autoConnect = true) {
|
527
|
-
var _a, _b, _c, _d;
|
528
526
|
if (this._msgId === 4096) {
|
529
527
|
this._msgId = 0;
|
530
528
|
}
|
@@ -538,7 +536,7 @@ export class Deluge {
|
|
538
536
|
}
|
539
537
|
}
|
540
538
|
const headers = {
|
541
|
-
Cookie:
|
539
|
+
Cookie: this._cookie?.cookieString?.(),
|
542
540
|
};
|
543
541
|
const url = urlJoin(this.config.baseUrl, this.config.path);
|
544
542
|
const res = await got.post(url, {
|
@@ -554,7 +552,7 @@ export class Deluge {
|
|
554
552
|
// allow proxy agent
|
555
553
|
...(this.config.agent ? { agent: this.config.agent } : {}),
|
556
554
|
});
|
557
|
-
const err =
|
555
|
+
const err = res.body?.error ?? (typeof res.body === 'string' && res.body);
|
558
556
|
if (err) {
|
559
557
|
throw new Error(err.message || err);
|
560
558
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ctrl/deluge",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.1",
|
4
4
|
"description": "TypeScript api wrapper for deluge using got",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
@@ -23,46 +23,36 @@
|
|
23
23
|
"prepare": "npm run build",
|
24
24
|
"build": "tsc",
|
25
25
|
"build:docs": "typedoc",
|
26
|
-
"test": "
|
27
|
-
"test:watch": "
|
28
|
-
"test:ci": "
|
26
|
+
"test": "vitest run",
|
27
|
+
"test:watch": "vitest",
|
28
|
+
"test:ci": "vitest run --coverage"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
31
|
"@ctrl/magnet-link": "^3.1.0",
|
32
32
|
"@ctrl/shared-torrent": "^4.1.0",
|
33
33
|
"@ctrl/url-join": "^2.0.0",
|
34
34
|
"formdata-node": "^4.3.2",
|
35
|
-
"got": "^12.0
|
35
|
+
"got": "^12.1.0",
|
36
36
|
"tough-cookie": "^4.0.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@ctrl/eslint-config": "3.
|
40
|
-
"@sindresorhus/tsconfig": "
|
41
|
-
"@types/node": "17.0.
|
42
|
-
"@types/tough-cookie": "4.0.
|
43
|
-
"
|
44
|
-
"c8": "7.11.0",
|
45
|
-
"ts-node": "10.5.0",
|
39
|
+
"@ctrl/eslint-config": "3.4.4",
|
40
|
+
"@sindresorhus/tsconfig": "3.0.1",
|
41
|
+
"@types/node": "17.0.38",
|
42
|
+
"@types/tough-cookie": "4.0.2",
|
43
|
+
"c8": "7.11.3",
|
46
44
|
"p-wait-for": "4.1.0",
|
47
|
-
"typedoc": "0.22.
|
48
|
-
"typescript": "4.
|
49
|
-
|
50
|
-
"ava": {
|
51
|
-
"files": [
|
52
|
-
"test/**/*.spec.ts"
|
53
|
-
],
|
54
|
-
"extensions": {
|
55
|
-
"ts": "module"
|
56
|
-
},
|
57
|
-
"nodeArguments": [
|
58
|
-
"--loader=ts-node/esm"
|
59
|
-
]
|
45
|
+
"typedoc": "0.22.17",
|
46
|
+
"typescript": "4.7.2",
|
47
|
+
"vitest": "0.13.1"
|
60
48
|
},
|
61
49
|
"publishConfig": {
|
62
50
|
"access": "public"
|
63
51
|
},
|
64
52
|
"release": {
|
65
|
-
"
|
53
|
+
"branches": [
|
54
|
+
"master"
|
55
|
+
]
|
66
56
|
},
|
67
57
|
"engines": {
|
68
58
|
"node": ">=14.16"
|