@ctrl/qbittorrent 2.10.0 → 4.0.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/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/{index.d.ts → src/qbittorrent.d.ts} +16 -9
- package/dist/{index.js → src/qbittorrent.js} +150 -129
- package/dist/{types.d.ts → src/types.d.ts} +219 -40
- package/dist/{types.js → src/types.js} +8 -11
- package/package.json +36 -34
@@ -1,8 +1,7 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { Options as GotOptions, Response } from 'got';
|
3
|
-
import { AddTorrentOptions as NormalizedAddTorrentOptions, TorrentClient, TorrentSettings } from '@ctrl/shared-torrent';
|
4
|
-
import { AddMagnetOptions, AddTorrentOptions,
|
5
|
-
export { TorrentState, TorrentTrackerStatus, TorrentFilePriority, TorrentPieceState };
|
3
|
+
import { AddTorrentOptions as NormalizedAddTorrentOptions, AllClientData, NormalizedTorrent, TorrentClient, TorrentSettings } from '@ctrl/shared-torrent';
|
4
|
+
import { AddMagnetOptions, AddTorrentOptions, BuildInfo, Preferences, Torrent, TorrentCategories, TorrentFile, TorrentFilePriority, TorrentFilters, TorrentPieceState, TorrentProperties, TorrentTrackers, WebSeed } from './types.js';
|
6
5
|
export declare class QBittorrent implements TorrentClient {
|
7
6
|
config: TorrentSettings;
|
8
7
|
/**
|
@@ -28,7 +27,7 @@ export declare class QBittorrent implements TorrentClient {
|
|
28
27
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-build-info}
|
29
28
|
*/
|
30
29
|
getBuildInfo(): Promise<BuildInfo>;
|
31
|
-
getTorrent(hash: string): Promise<
|
30
|
+
getTorrent(hash: string): Promise<NormalizedTorrent>;
|
32
31
|
/**
|
33
32
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-application-preferences}
|
34
33
|
*/
|
@@ -44,8 +43,16 @@ export declare class QBittorrent implements TorrentClient {
|
|
44
43
|
* @param category Get torrents with the given category (empty string means "without category"; no "category" parameter means "any category")
|
45
44
|
* @returns list of torrents
|
46
45
|
*/
|
47
|
-
listTorrents(hashes
|
48
|
-
|
46
|
+
listTorrents({ hashes, filter, category, sort, offset, reverse, tag, }?: {
|
47
|
+
hashes?: string | string[];
|
48
|
+
filter?: TorrentFilters;
|
49
|
+
sort?: string;
|
50
|
+
tag?: string;
|
51
|
+
category?: string;
|
52
|
+
offset?: number;
|
53
|
+
reverse?: boolean;
|
54
|
+
}): Promise<Torrent[]>;
|
55
|
+
getAllData(): Promise<AllClientData>;
|
49
56
|
/**
|
50
57
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-torrent-generic-properties}
|
51
58
|
*/
|
@@ -95,7 +102,7 @@ export declare class QBittorrent implements TorrentClient {
|
|
95
102
|
/**
|
96
103
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-all-categories}
|
97
104
|
*/
|
98
|
-
getCategories(): Promise<
|
105
|
+
getCategories(): Promise<TorrentCategories>;
|
99
106
|
/**
|
100
107
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-new-category}
|
101
108
|
*/
|
@@ -146,7 +153,7 @@ export declare class QBittorrent implements TorrentClient {
|
|
146
153
|
*/
|
147
154
|
reannounceTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
148
155
|
addTorrent(torrent: string | Buffer, options?: Partial<AddTorrentOptions>): Promise<boolean>;
|
149
|
-
normalizedAddTorrent(torrent: string | Buffer, options?: Partial<NormalizedAddTorrentOptions>): Promise<
|
156
|
+
normalizedAddTorrent(torrent: string | Buffer, options?: Partial<NormalizedAddTorrentOptions>): Promise<NormalizedTorrent>;
|
150
157
|
/**
|
151
158
|
* @param hash Hash for desired torrent
|
152
159
|
* @param id id of the file to be renamed
|
@@ -191,7 +198,7 @@ export declare class QBittorrent implements TorrentClient {
|
|
191
198
|
*/
|
192
199
|
login(): Promise<boolean>;
|
193
200
|
logout(): boolean;
|
194
|
-
request<T extends object | string>(path: string, method: GotOptions['method'], params?: any, body?: GotOptions['body'], headers?: any, json?: boolean): Promise<Response<T>>;
|
201
|
+
request<T extends object | string>(path: string, method: GotOptions['method'], params?: any, body?: GotOptions['body'], form?: GotOptions['form'], headers?: any, json?: boolean): Promise<Response<T>>;
|
195
202
|
/**
|
196
203
|
* Normalizes hashes
|
197
204
|
* @returns hashes as string seperated by `|`
|
@@ -1,23 +1,15 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.QBittorrent = exports.TorrentPieceState = exports.TorrentFilePriority = exports.TorrentTrackerStatus = exports.TorrentState = void 0;
|
7
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Object.defineProperty(exports, "TorrentState", { enumerable: true, get: function () { return types_1.TorrentState; } });
|
20
|
-
Object.defineProperty(exports, "TorrentTrackerStatus", { enumerable: true, get: function () { return types_1.TorrentTrackerStatus; } });
|
2
|
+
import { existsSync } from 'fs';
|
3
|
+
import { URLSearchParams } from 'url';
|
4
|
+
import { File, FormData } from 'formdata-node';
|
5
|
+
import { fileFromPath } from 'formdata-node/file-from-path';
|
6
|
+
import got from 'got';
|
7
|
+
import { Cookie } from 'tough-cookie';
|
8
|
+
import { magnetDecode } from '@ctrl/magnet-link';
|
9
|
+
import { TorrentState as NormalizedTorrentState, } from '@ctrl/shared-torrent';
|
10
|
+
import { hash } from '@ctrl/torrent-file';
|
11
|
+
import { urlJoin } from '@ctrl/url-join';
|
12
|
+
import { TorrentState, } from './types.js';
|
21
13
|
const defaults = {
|
22
14
|
baseUrl: 'http://localhost:9091/',
|
23
15
|
path: '/api/v2',
|
@@ -25,8 +17,32 @@ const defaults = {
|
|
25
17
|
password: '',
|
26
18
|
timeout: 5000,
|
27
19
|
};
|
28
|
-
class QBittorrent {
|
20
|
+
export class QBittorrent {
|
29
21
|
constructor(options = {}) {
|
22
|
+
Object.defineProperty(this, "config", {
|
23
|
+
enumerable: true,
|
24
|
+
configurable: true,
|
25
|
+
writable: true,
|
26
|
+
value: void 0
|
27
|
+
});
|
28
|
+
/**
|
29
|
+
* auth cookie
|
30
|
+
*/
|
31
|
+
Object.defineProperty(this, "_sid", {
|
32
|
+
enumerable: true,
|
33
|
+
configurable: true,
|
34
|
+
writable: true,
|
35
|
+
value: void 0
|
36
|
+
});
|
37
|
+
/**
|
38
|
+
* cookie expiration
|
39
|
+
*/
|
40
|
+
Object.defineProperty(this, "_exp", {
|
41
|
+
enumerable: true,
|
42
|
+
configurable: true,
|
43
|
+
writable: true,
|
44
|
+
value: void 0
|
45
|
+
});
|
30
46
|
this.config = { ...defaults, ...options };
|
31
47
|
}
|
32
48
|
/**
|
@@ -40,11 +56,11 @@ class QBittorrent {
|
|
40
56
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#get-application-version}
|
41
57
|
*/
|
42
58
|
async getAppVersion() {
|
43
|
-
const res = await this.request('/app/version', 'GET', undefined, undefined, undefined, false);
|
59
|
+
const res = await this.request('/app/version', 'GET', undefined, undefined, undefined, undefined, false);
|
44
60
|
return res.body;
|
45
61
|
}
|
46
62
|
async getApiVersion() {
|
47
|
-
const res = await this.request('/app/webapiVersion', 'GET', undefined, undefined, undefined, false);
|
63
|
+
const res = await this.request('/app/webapiVersion', 'GET', undefined, undefined, undefined, undefined, false);
|
48
64
|
return res.body;
|
49
65
|
}
|
50
66
|
/**
|
@@ -55,7 +71,7 @@ class QBittorrent {
|
|
55
71
|
return res.body;
|
56
72
|
}
|
57
73
|
async getTorrent(hash) {
|
58
|
-
const torrentsResponse = await this.listTorrents(hash);
|
74
|
+
const torrentsResponse = await this.listTorrents({ hashes: hash });
|
59
75
|
const torrentData = torrentsResponse[0];
|
60
76
|
if (!torrentData) {
|
61
77
|
throw new Error('Torrent not found');
|
@@ -73,9 +89,9 @@ class QBittorrent {
|
|
73
89
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-application-preferences}
|
74
90
|
*/
|
75
91
|
async setPreferences(preferences) {
|
76
|
-
|
77
|
-
|
78
|
-
|
92
|
+
await this.request('/app/setPreferences', 'POST', undefined, undefined, {
|
93
|
+
json: JSON.stringify(preferences),
|
94
|
+
});
|
79
95
|
return true;
|
80
96
|
}
|
81
97
|
/**
|
@@ -85,10 +101,7 @@ class QBittorrent {
|
|
85
101
|
* @param category Get torrents with the given category (empty string means "without category"; no "category" parameter means "any category")
|
86
102
|
* @returns list of torrents
|
87
103
|
*/
|
88
|
-
|
89
|
-
async listTorrents(hashes, filter, category, sort, offset, reverse,
|
90
|
-
// TODO: refactor filters into an object with optional properties
|
91
|
-
tag) {
|
104
|
+
async listTorrents({ hashes, filter, category, sort, offset, reverse, tag, } = {}) {
|
92
105
|
const params = {};
|
93
106
|
if (hashes) {
|
94
107
|
params.hashes = this._normalizeHashes(hashes);
|
@@ -193,20 +206,20 @@ class QBittorrent {
|
|
193
206
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-location}
|
194
207
|
*/
|
195
208
|
async setTorrentLocation(hashes, location) {
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
209
|
+
await this.request('/torrents/setLocation', 'POST', undefined, undefined, {
|
210
|
+
location,
|
211
|
+
hashes: this._normalizeHashes(hashes),
|
212
|
+
});
|
200
213
|
return true;
|
201
214
|
}
|
202
215
|
/**
|
203
216
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-name}
|
204
217
|
*/
|
205
218
|
async setTorrentName(hash, name) {
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
219
|
+
await this.request('/torrents/rename', 'POST', undefined, undefined, {
|
220
|
+
hash,
|
221
|
+
name,
|
222
|
+
});
|
210
223
|
return true;
|
211
224
|
}
|
212
225
|
/**
|
@@ -221,9 +234,9 @@ class QBittorrent {
|
|
221
234
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#create-tags}
|
222
235
|
*/
|
223
236
|
async createTags(tags) {
|
224
|
-
|
225
|
-
|
226
|
-
|
237
|
+
await this.request('/torrents/createTags', 'POST', undefined, undefined, {
|
238
|
+
tags,
|
239
|
+
}, undefined, false);
|
227
240
|
return true;
|
228
241
|
}
|
229
242
|
/**
|
@@ -231,9 +244,7 @@ class QBittorrent {
|
|
231
244
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-tags}
|
232
245
|
*/
|
233
246
|
async deleteTags(tags) {
|
234
|
-
|
235
|
-
form.append('tags', tags);
|
236
|
-
await this.request('/torrents/deleteTags', 'POST', undefined, form, undefined, false);
|
247
|
+
await this.request('/torrents/deleteTags', 'POST', undefined, undefined, { tags }, undefined, false);
|
237
248
|
return true;
|
238
249
|
}
|
239
250
|
/**
|
@@ -247,39 +258,39 @@ class QBittorrent {
|
|
247
258
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-new-category}
|
248
259
|
*/
|
249
260
|
async createCategory(category, savePath = '') {
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
261
|
+
await this.request('/torrents/createCategory', 'POST', undefined, undefined, {
|
262
|
+
category,
|
263
|
+
savePath,
|
264
|
+
}, undefined, false);
|
254
265
|
return true;
|
255
266
|
}
|
256
267
|
/**
|
257
268
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#edit-category}
|
258
269
|
*/
|
259
270
|
async editCategory(category, savePath = '') {
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
271
|
+
await this.request('/torrents/editCategory', 'POST', undefined, undefined, {
|
272
|
+
category,
|
273
|
+
savePath,
|
274
|
+
}, undefined, false);
|
264
275
|
return true;
|
265
276
|
}
|
266
277
|
/**
|
267
278
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-categories}
|
268
279
|
*/
|
269
280
|
async removeCategory(categories) {
|
270
|
-
|
271
|
-
|
272
|
-
|
281
|
+
await this.request('/torrents/removeCategories', 'POST', undefined, undefined, {
|
282
|
+
categories,
|
283
|
+
}, undefined, false);
|
273
284
|
return true;
|
274
285
|
}
|
275
286
|
/**
|
276
287
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-torrent-tags}
|
277
288
|
*/
|
278
289
|
async addTorrentTags(hashes, tags) {
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
290
|
+
await this.request('/torrents/addTags', 'POST', undefined, undefined, {
|
291
|
+
hashes: this._normalizeHashes(hashes),
|
292
|
+
tags,
|
293
|
+
}, undefined, false);
|
283
294
|
return true;
|
284
295
|
}
|
285
296
|
/**
|
@@ -287,12 +298,11 @@ class QBittorrent {
|
|
287
298
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#remove-torrent-tags}
|
288
299
|
*/
|
289
300
|
async removeTorrentTags(hashes, tags) {
|
290
|
-
const form =
|
291
|
-
form.append('hashes', this._normalizeHashes(hashes));
|
301
|
+
const form = { hashes: this._normalizeHashes(hashes) };
|
292
302
|
if (tags) {
|
293
|
-
form.
|
303
|
+
form.tags = tags;
|
294
304
|
}
|
295
|
-
await this.request('/torrents/removeTags', 'POST', undefined, form, undefined, false);
|
305
|
+
await this.request('/torrents/removeTags', 'POST', undefined, undefined, form, undefined, false);
|
296
306
|
return true;
|
297
307
|
}
|
298
308
|
/**
|
@@ -305,10 +315,10 @@ class QBittorrent {
|
|
305
315
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#set-torrent-category}
|
306
316
|
*/
|
307
317
|
async setTorrentCategory(hashes, category = '') {
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
318
|
+
await this.request('/torrents/setCategory', 'POST', undefined, undefined, {
|
319
|
+
hashes: this._normalizeHashes(hashes),
|
320
|
+
category,
|
321
|
+
});
|
312
322
|
return true;
|
313
323
|
}
|
314
324
|
/**
|
@@ -363,26 +373,25 @@ class QBittorrent {
|
|
363
373
|
return true;
|
364
374
|
}
|
365
375
|
async addTorrent(torrent, options = {}) {
|
366
|
-
var _a;
|
367
|
-
const form = new
|
368
|
-
const fileOptions = {
|
369
|
-
contentType: 'application/x-bittorrent',
|
370
|
-
filename: (_a = options.filename) !== null && _a !== void 0 ? _a : 'torrent',
|
371
|
-
};
|
376
|
+
var _a, _b;
|
377
|
+
const form = new FormData();
|
372
378
|
// remove options.filename, not used in form
|
373
379
|
if (options.filename) {
|
374
380
|
delete options.filename;
|
375
381
|
}
|
382
|
+
const type = { type: 'application/x-bittorrent' };
|
376
383
|
if (typeof torrent === 'string') {
|
377
|
-
if (
|
378
|
-
|
384
|
+
if (existsSync(torrent)) {
|
385
|
+
const file = await fileFromPath(torrent, (_a = options.filename) !== null && _a !== void 0 ? _a : 'torrent', type);
|
386
|
+
form.set('file', file);
|
379
387
|
}
|
380
388
|
else {
|
381
|
-
form.
|
389
|
+
form.set('file', new File([Buffer.from(torrent, 'base64')], 'file.torrent', type));
|
382
390
|
}
|
383
391
|
}
|
384
392
|
else {
|
385
|
-
|
393
|
+
const file = new File([torrent], (_b = options.filename) !== null && _b !== void 0 ? _b : 'torrent', type);
|
394
|
+
form.set('file', file);
|
386
395
|
}
|
387
396
|
if (options) {
|
388
397
|
// disable savepath when autoTMM is defined
|
@@ -396,7 +405,7 @@ class QBittorrent {
|
|
396
405
|
form.append(key, value);
|
397
406
|
}
|
398
407
|
}
|
399
|
-
const res = await this.request('/torrents/add', 'POST', undefined, form,
|
408
|
+
const res = await this.request('/torrents/add', 'POST', undefined, form, undefined, undefined, false);
|
400
409
|
if (res.body === 'Fails.') {
|
401
410
|
throw new Error('Failed to add torrent');
|
402
411
|
}
|
@@ -410,11 +419,21 @@ class QBittorrent {
|
|
410
419
|
if (options.label) {
|
411
420
|
torrentOptions.category = options.label;
|
412
421
|
}
|
413
|
-
|
414
|
-
|
422
|
+
let torrentHash;
|
423
|
+
if (typeof torrent === 'string' && torrent.startsWith('magnet:')) {
|
424
|
+
torrentHash = magnetDecode(torrent).infoHash;
|
425
|
+
if (!torrentHash) {
|
426
|
+
throw new Error('Magnet did not contain hash');
|
427
|
+
}
|
428
|
+
await this.addMagnet(torrent, torrentOptions);
|
429
|
+
}
|
430
|
+
else {
|
431
|
+
if (!Buffer.isBuffer(torrent)) {
|
432
|
+
torrent = Buffer.from(torrent);
|
433
|
+
}
|
434
|
+
torrentHash = await hash(torrent);
|
435
|
+
await this.addTorrent(torrent, torrentOptions);
|
415
436
|
}
|
416
|
-
const torrentHash = await (0, torrent_file_1.hash)(torrent);
|
417
|
-
await this.addTorrent(torrent, torrentOptions);
|
418
437
|
return this.getTorrent(torrentHash);
|
419
438
|
}
|
420
439
|
/**
|
@@ -423,11 +442,11 @@ class QBittorrent {
|
|
423
442
|
* @param name new name to be assigned to the file
|
424
443
|
*/
|
425
444
|
async renameFile(hash, id, name) {
|
426
|
-
const form = new
|
445
|
+
const form = new FormData();
|
427
446
|
form.append('hash', hash);
|
428
447
|
form.append('id', id);
|
429
448
|
form.append('name', name);
|
430
|
-
await this.request('/torrents/renameFile', 'POST', undefined, form,
|
449
|
+
await this.request('/torrents/renameFile', 'POST', undefined, form, undefined, false);
|
431
450
|
return true;
|
432
451
|
}
|
433
452
|
/**
|
@@ -435,7 +454,7 @@ class QBittorrent {
|
|
435
454
|
* @param options
|
436
455
|
*/
|
437
456
|
async addMagnet(urls, options = {}) {
|
438
|
-
const form = new
|
457
|
+
const form = new FormData();
|
439
458
|
form.append('urls', urls);
|
440
459
|
if (options) {
|
441
460
|
// disable savepath when autoTMM is defined
|
@@ -449,7 +468,7 @@ class QBittorrent {
|
|
449
468
|
form.append(key, value);
|
450
469
|
}
|
451
470
|
}
|
452
|
-
const res = await this.request('/torrents/add', 'POST', undefined, form,
|
471
|
+
const res = await this.request('/torrents/add', 'POST', undefined, form, undefined, undefined, false);
|
453
472
|
if (res.body === 'Fails.') {
|
454
473
|
throw new Error('Failed to add torrent');
|
455
474
|
}
|
@@ -523,23 +542,25 @@ class QBittorrent {
|
|
523
542
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#login}
|
524
543
|
*/
|
525
544
|
async login() {
|
526
|
-
|
527
|
-
const
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
545
|
+
var _a, _b;
|
546
|
+
const url = urlJoin(this.config.baseUrl, this.config.path, '/auth/login');
|
547
|
+
const res = await got({
|
548
|
+
url,
|
549
|
+
method: 'POST',
|
550
|
+
form: {
|
551
|
+
username: (_a = this.config.username) !== null && _a !== void 0 ? _a : '',
|
552
|
+
password: (_b = this.config.password) !== null && _b !== void 0 ? _b : '',
|
553
|
+
},
|
533
554
|
followRedirect: false,
|
534
|
-
retry: 0,
|
555
|
+
retry: { limit: 0 },
|
556
|
+
timeout: { request: this.config.timeout },
|
535
557
|
// allow proxy agent
|
536
|
-
agent: this.config.agent,
|
537
|
-
timeout: this.config.timeout,
|
558
|
+
...(this.config.agent ? { agent: this.config.agent } : {}),
|
538
559
|
});
|
539
560
|
if (!res.headers['set-cookie'] || !res.headers['set-cookie'].length) {
|
540
561
|
throw new Error('Cookie not found. Auth Failed.');
|
541
562
|
}
|
542
|
-
const cookie =
|
563
|
+
const cookie = Cookie.parse(res.headers['set-cookie'][0]);
|
543
564
|
if (!cookie || cookie.key !== 'SID') {
|
544
565
|
throw new Error('Invalid cookie');
|
545
566
|
}
|
@@ -553,7 +574,7 @@ class QBittorrent {
|
|
553
574
|
return true;
|
554
575
|
}
|
555
576
|
// eslint-disable-next-line max-params
|
556
|
-
async request(path, method, params = {}, body, headers = {}, json = true) {
|
577
|
+
async request(path, method, params = {}, body, form, headers = {}, json = true) {
|
557
578
|
var _a;
|
558
579
|
if (!this._sid || !this._exp || this._exp.getTime() < new Date().getTime()) {
|
559
580
|
const authed = await this.login();
|
@@ -561,8 +582,8 @@ class QBittorrent {
|
|
561
582
|
throw new Error('Auth Failed');
|
562
583
|
}
|
563
584
|
}
|
564
|
-
const url =
|
565
|
-
const res = await (
|
585
|
+
const url = urlJoin(this.config.baseUrl, this.config.path, path);
|
586
|
+
const res = await got(url, {
|
566
587
|
isStream: false,
|
567
588
|
resolveBodyOnly: false,
|
568
589
|
method,
|
@@ -570,13 +591,14 @@ class QBittorrent {
|
|
570
591
|
Cookie: `SID=${(_a = this._sid) !== null && _a !== void 0 ? _a : ''}`,
|
571
592
|
...headers,
|
572
593
|
},
|
573
|
-
retry: 0,
|
594
|
+
retry: { limit: 0 },
|
574
595
|
body,
|
575
|
-
|
596
|
+
form,
|
597
|
+
searchParams: new URLSearchParams(params),
|
576
598
|
// allow proxy agent
|
577
|
-
|
578
|
-
timeout: this.config.timeout,
|
599
|
+
timeout: { request: this.config.timeout },
|
579
600
|
responseType: json ? 'json' : 'text',
|
601
|
+
...(this.config.agent ? { agent: this.config.agent } : {}),
|
580
602
|
});
|
581
603
|
return res;
|
582
604
|
}
|
@@ -591,40 +613,40 @@ class QBittorrent {
|
|
591
613
|
return hashes;
|
592
614
|
}
|
593
615
|
_normalizeTorrentData(torrent) {
|
594
|
-
let state =
|
616
|
+
let state = NormalizedTorrentState.unknown;
|
595
617
|
switch (torrent.state) {
|
596
|
-
case
|
597
|
-
case
|
598
|
-
state =
|
618
|
+
case TorrentState.ForcedDL:
|
619
|
+
case TorrentState.MetaDL:
|
620
|
+
state = NormalizedTorrentState.downloading;
|
599
621
|
break;
|
600
|
-
case
|
622
|
+
case TorrentState.Allocating:
|
601
623
|
// state = 'stalledDL';
|
602
|
-
state =
|
624
|
+
state = NormalizedTorrentState.queued;
|
603
625
|
break;
|
604
|
-
case
|
605
|
-
state =
|
626
|
+
case TorrentState.ForcedUP:
|
627
|
+
state = NormalizedTorrentState.seeding;
|
606
628
|
break;
|
607
|
-
case
|
608
|
-
state =
|
629
|
+
case TorrentState.PausedDL:
|
630
|
+
state = NormalizedTorrentState.paused;
|
609
631
|
break;
|
610
|
-
case
|
632
|
+
case TorrentState.PausedUP:
|
611
633
|
// state = 'completed';
|
612
|
-
state =
|
634
|
+
state = NormalizedTorrentState.paused;
|
613
635
|
break;
|
614
|
-
case
|
615
|
-
case
|
616
|
-
state =
|
636
|
+
case TorrentState.QueuedDL:
|
637
|
+
case TorrentState.QueuedUP:
|
638
|
+
state = NormalizedTorrentState.queued;
|
617
639
|
break;
|
618
|
-
case
|
619
|
-
case
|
620
|
-
case
|
621
|
-
case
|
622
|
-
case
|
623
|
-
state =
|
640
|
+
case TorrentState.CheckingDL:
|
641
|
+
case TorrentState.CheckingUP:
|
642
|
+
case TorrentState.QueuedForChecking:
|
643
|
+
case TorrentState.CheckingResumeData:
|
644
|
+
case TorrentState.Moving:
|
645
|
+
state = NormalizedTorrentState.checking;
|
624
646
|
break;
|
625
|
-
case
|
626
|
-
case
|
627
|
-
state =
|
647
|
+
case TorrentState.Unknown:
|
648
|
+
case TorrentState.MissingFiles:
|
649
|
+
state = NormalizedTorrentState.error;
|
628
650
|
break;
|
629
651
|
default:
|
630
652
|
break;
|
@@ -658,4 +680,3 @@ class QBittorrent {
|
|
658
680
|
return result;
|
659
681
|
}
|
660
682
|
}
|
661
|
-
exports.QBittorrent = QBittorrent;
|
@@ -1,32 +1,22 @@
|
|
1
|
-
import { AllClientData, NormalizedTorrent } from '@ctrl/shared-torrent';
|
2
|
-
/**
|
3
|
-
* refine the normalized torrent options for qbittorrent
|
4
|
-
*/
|
5
|
-
export interface NormalizedTorrentQbittorrent extends NormalizedTorrent {
|
6
|
-
id: string;
|
7
|
-
}
|
8
|
-
export interface AllClientDataQbittorrent extends AllClientData {
|
9
|
-
torrents: NormalizedTorrentQbittorrent[];
|
10
|
-
}
|
11
1
|
export interface BuildInfo {
|
12
2
|
/**
|
13
|
-
*
|
3
|
+
* QT version
|
14
4
|
*/
|
15
5
|
qt: string;
|
16
6
|
/**
|
17
|
-
*
|
7
|
+
* libtorrent version
|
18
8
|
*/
|
19
9
|
libtorrent: string;
|
20
10
|
/**
|
21
|
-
*
|
11
|
+
* Boost version
|
22
12
|
*/
|
23
13
|
boost: string;
|
24
14
|
/**
|
25
|
-
*
|
15
|
+
* OpenSSL version
|
26
16
|
*/
|
27
17
|
openssl: string;
|
28
18
|
/**
|
29
|
-
*
|
19
|
+
* Application bitness (e.g. 64-bit)
|
30
20
|
*/
|
31
21
|
bitness: string;
|
32
22
|
}
|
@@ -176,8 +166,8 @@ export interface Torrent {
|
|
176
166
|
*/
|
177
167
|
category: string;
|
178
168
|
}
|
179
|
-
export declare type
|
180
|
-
|
169
|
+
export declare type TorrentCategories = Record<string, Category>;
|
170
|
+
interface Category {
|
181
171
|
name: string;
|
182
172
|
savePath: string;
|
183
173
|
}
|
@@ -544,9 +534,10 @@ export interface AddTorrentOptions {
|
|
544
534
|
*/
|
545
535
|
paused: TrueFalseStr;
|
546
536
|
/**
|
547
|
-
*
|
537
|
+
* Control filesystem structure for content (added in Web API v2.7)
|
538
|
+
* Migrating from rootFolder example rootFolder ? 'Original' : 'NoSubfolder'
|
548
539
|
*/
|
549
|
-
|
540
|
+
contentLayout: 'Original' | 'Subfolder' | 'NoSubfolder';
|
550
541
|
/**
|
551
542
|
* Rename torrent
|
552
543
|
*/
|
@@ -559,6 +550,14 @@ export interface AddTorrentOptions {
|
|
559
550
|
* Set torrent download speed limit. Unit in bytes/second
|
560
551
|
*/
|
561
552
|
dlLimit: number;
|
553
|
+
/**
|
554
|
+
* Set torrent share ratio limit
|
555
|
+
*/
|
556
|
+
ratioLimit: number;
|
557
|
+
/**
|
558
|
+
* Set torrent seeding time limit. Unit in seconds
|
559
|
+
*/
|
560
|
+
seedingTimeLimit: number;
|
562
561
|
/**
|
563
562
|
* Whether Automatic Torrent Management should be used, disables use of savepath
|
564
563
|
*/
|
@@ -670,9 +669,13 @@ export interface Preferences {
|
|
670
669
|
*/
|
671
670
|
temp_path: string;
|
672
671
|
/**
|
673
|
-
*
|
672
|
+
* Directory to watch for torrent files, value: where torrents loaded from this directory should be downloaded to (see list of possible values below). Slashes are used as path separators; multiple key/value pairs can be specified
|
673
|
+
* Possible values of scan_dirs:
|
674
|
+
* 0 Download to the monitored folder
|
675
|
+
* 1 Download to the default save path
|
676
|
+
* "/path/to/download/to" Download to this path
|
674
677
|
*/
|
675
|
-
scan_dirs: Record<string,
|
678
|
+
scan_dirs: Record<string, 0 | 1 | string>;
|
676
679
|
/**
|
677
680
|
* Path to directory to copy .torrent files to. Slashes are used as path separators
|
678
681
|
*/
|
@@ -808,11 +811,14 @@ export interface Preferences {
|
|
808
811
|
/**
|
809
812
|
* True if the advanced libtorrent option piece_extent_affinity is enabled
|
810
813
|
*/
|
811
|
-
|
814
|
+
enable_piece_extent_affinity: boolean;
|
812
815
|
/**
|
813
|
-
*
|
816
|
+
* Bittorrent Protocol to use
|
817
|
+
* 0 TCP and μTP
|
818
|
+
* 1 TCP
|
819
|
+
* 2 μTP
|
814
820
|
*/
|
815
|
-
|
821
|
+
bittorrent_protocol: 0 | 1 | 2;
|
816
822
|
/**
|
817
823
|
* True if [du]l_limit should be applied to uTP connections; this option is only available in qBittorent built against libtorrent version 0.16.X and higher
|
818
824
|
*/
|
@@ -855,20 +861,22 @@ export interface Preferences {
|
|
855
861
|
schedule_to_min: number;
|
856
862
|
/**
|
857
863
|
* Scheduler days. See possible values here below
|
858
|
-
|
859
|
-
|
864
|
+
* 0 Every day
|
865
|
+
* 1 Every weekday
|
866
|
+
* 2 Every weekend
|
867
|
+
* 3 Every Monday
|
868
|
+
* 4 Every Tuesday
|
869
|
+
* 5 Every Wednesday
|
870
|
+
* 6 Every Thursday
|
871
|
+
* 7 Every Friday
|
872
|
+
* 8 Every Saturday
|
873
|
+
* 9 Every Sunday
|
874
|
+
*/
|
875
|
+
scheduler_days: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
860
876
|
/**
|
861
877
|
* True if DHT is enabled
|
862
878
|
*/
|
863
879
|
dht: boolean;
|
864
|
-
/**
|
865
|
-
* True if DHT port should match TCP port
|
866
|
-
*/
|
867
|
-
dhtSameAsBT: boolean;
|
868
|
-
/**
|
869
|
-
* DHT port if dhtSameAsBT is false
|
870
|
-
*/
|
871
|
-
dht_port: number;
|
872
880
|
/**
|
873
881
|
* True if PeX is enabled
|
874
882
|
*/
|
@@ -879,10 +887,13 @@ export interface Preferences {
|
|
879
887
|
lsd: boolean;
|
880
888
|
/**
|
881
889
|
* See list of possible values here below
|
890
|
+
* 0 Prefer encryption
|
891
|
+
* 1 Force encryption on
|
892
|
+
* 2 Force encryption off
|
882
893
|
*/
|
883
|
-
encryption:
|
894
|
+
encryption: 0 | 1 | 2;
|
884
895
|
/**
|
885
|
-
* If true anonymous mode will be enabled; read more [here](Anonymous-Mode); this option is only available in qBittorent built against libtorrent version 0.16.X and higher
|
896
|
+
* If true anonymous mode will be enabled; read more [here](https://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode); this option is only available in qBittorent built against libtorrent version 0.16.X and higher
|
886
897
|
*/
|
887
898
|
anonymous_mode: boolean;
|
888
899
|
/**
|
@@ -901,10 +912,6 @@ export interface Preferences {
|
|
901
912
|
* True if peer and web seed connections should be proxified; this option will have any effect only in qBittorent built against libtorrent version 0.16.X and higher
|
902
913
|
*/
|
903
914
|
proxy_peer_connections: boolean;
|
904
|
-
/**
|
905
|
-
* True if the connections not supported by the proxy are disabled
|
906
|
-
*/
|
907
|
-
force_proxy: boolean;
|
908
915
|
/**
|
909
916
|
* True proxy requires authentication; doesn't apply to SOCKS4 proxies
|
910
917
|
*/
|
@@ -917,6 +924,10 @@ export interface Preferences {
|
|
917
924
|
* Password for proxy authentication
|
918
925
|
*/
|
919
926
|
proxy_password: string;
|
927
|
+
/**
|
928
|
+
* True if proxy is only used for torrents
|
929
|
+
*/
|
930
|
+
proxy_torrents_only: boolean;
|
920
931
|
/**
|
921
932
|
* True if external IP filter should be enabled
|
922
933
|
*/
|
@@ -973,6 +984,14 @@ export interface Preferences {
|
|
973
984
|
* WebUI access ban duration in seconds
|
974
985
|
*/
|
975
986
|
web_ui_ban_duration: number;
|
987
|
+
/**
|
988
|
+
* Seconds until WebUI is automatically signed off
|
989
|
+
*/
|
990
|
+
web_ui_session_timeout: number;
|
991
|
+
/**
|
992
|
+
* True if WebUI host header validation is enabled
|
993
|
+
*/
|
994
|
+
web_ui_host_header_validation_enabled: boolean;
|
976
995
|
/**
|
977
996
|
* True if authentication challenge for loopback address (127.0.0.1) should be disabled
|
978
997
|
*/
|
@@ -1005,6 +1024,14 @@ export interface Preferences {
|
|
1005
1024
|
* SSL certificate contents (this is a not a path)
|
1006
1025
|
*/
|
1007
1026
|
ssl_cert: string;
|
1027
|
+
/**
|
1028
|
+
* For API ≥ v2.0.1: Path to SSL keyfile
|
1029
|
+
*/
|
1030
|
+
web_ui_https_key_path: string;
|
1031
|
+
/**
|
1032
|
+
* For API ≥ v2.0.1: Path to SSL certificate
|
1033
|
+
*/
|
1034
|
+
web_ui_https_cert_path: string;
|
1008
1035
|
/**
|
1009
1036
|
* True if server DNS should be updated dynamically
|
1010
1037
|
*/
|
@@ -1041,5 +1068,157 @@ export interface Preferences {
|
|
1041
1068
|
* Enable auto-downloading of torrents from the RSS feeds
|
1042
1069
|
*/
|
1043
1070
|
rss_auto_downloading_enabled: boolean;
|
1071
|
+
/**
|
1072
|
+
* For API ≥ v2.5.1: Enable downloading of repack/proper Episodes
|
1073
|
+
*/
|
1074
|
+
rss_download_repack_proper_episodes: boolean;
|
1075
|
+
/**
|
1076
|
+
* For API ≥ v2.5.1: List of RSS Smart Episode Filters
|
1077
|
+
*/
|
1078
|
+
rss_smart_episode_filters: string;
|
1079
|
+
/**
|
1080
|
+
* Enable automatic adding of trackers to new torrents
|
1081
|
+
*/
|
1082
|
+
add_trackers_enabled: boolean;
|
1083
|
+
/**
|
1084
|
+
* List of trackers to add to new torrent
|
1085
|
+
*/
|
1086
|
+
add_trackers: string;
|
1087
|
+
/**
|
1088
|
+
* For API ≥ v2.5.1: Enable custom http headers
|
1089
|
+
*/
|
1090
|
+
web_ui_use_custom_http_headers_enabled: boolean;
|
1091
|
+
/**
|
1092
|
+
* For API ≥ v2.5.1: List of custom http headers
|
1093
|
+
*/
|
1094
|
+
web_ui_custom_http_headers: string;
|
1095
|
+
/**
|
1096
|
+
* True enables max seeding time
|
1097
|
+
*/
|
1098
|
+
max_seeding_time_enabled: boolean;
|
1099
|
+
/**
|
1100
|
+
* Number of minutes to seed a torrent
|
1101
|
+
*/
|
1102
|
+
max_seeding_time: number;
|
1103
|
+
/**
|
1104
|
+
* TODO
|
1105
|
+
*/
|
1106
|
+
announce_ip: string;
|
1107
|
+
/**
|
1108
|
+
* True always announce to all tiers
|
1109
|
+
*/
|
1110
|
+
announce_to_all_tiers: boolean;
|
1111
|
+
/**
|
1112
|
+
* True always announce to all trackers in a tier
|
1113
|
+
*/
|
1114
|
+
announce_to_all_trackers: boolean;
|
1115
|
+
/**
|
1116
|
+
* Number of asynchronous I/O threads
|
1117
|
+
*/
|
1118
|
+
async_io_threads: number;
|
1119
|
+
/**
|
1120
|
+
* List of banned IPs
|
1121
|
+
*/
|
1122
|
+
banned_IPs: string;
|
1123
|
+
/**
|
1124
|
+
* Outstanding memory when checking torrents in MiB
|
1125
|
+
*/
|
1126
|
+
checking_memory_use: number;
|
1127
|
+
/**
|
1128
|
+
* IP Address to bind to. Empty String means All addresses
|
1129
|
+
*/
|
1130
|
+
current_interface_address: string;
|
1131
|
+
/**
|
1132
|
+
* Network Interface used
|
1133
|
+
*/
|
1134
|
+
current_network_interface: string;
|
1135
|
+
/**
|
1136
|
+
* Disk cache used in MiB
|
1137
|
+
*/
|
1138
|
+
disk_cache: number;
|
1139
|
+
/**
|
1140
|
+
* Disk cache expiry interval in seconds
|
1141
|
+
*/
|
1142
|
+
disk_cache_ttl: number;
|
1143
|
+
/**
|
1144
|
+
* Port used for embedded tracker
|
1145
|
+
*/
|
1146
|
+
embedded_tracker_port: number;
|
1147
|
+
/**
|
1148
|
+
* True enables coalesce reads & writes
|
1149
|
+
*/
|
1150
|
+
enable_coalesce_read_write: boolean;
|
1151
|
+
/**
|
1152
|
+
* True enables embedded tracker
|
1153
|
+
*/
|
1154
|
+
enable_embedded_tracker: boolean;
|
1155
|
+
/**
|
1156
|
+
* True allows multiple connections from the same IP address
|
1157
|
+
*/
|
1158
|
+
enable_multi_connections_from_same_ip: boolean;
|
1159
|
+
/**
|
1160
|
+
* True enables os cache
|
1161
|
+
*/
|
1162
|
+
enable_os_cache: boolean;
|
1163
|
+
/**
|
1164
|
+
* True enables sending of upload piece suggestions
|
1165
|
+
*/
|
1166
|
+
enable_upload_suggestions: boolean;
|
1167
|
+
/**
|
1168
|
+
* File pool size
|
1169
|
+
*/
|
1170
|
+
file_pool_size: number;
|
1171
|
+
/**
|
1172
|
+
* Maximal outgoing port (0: Disabled)
|
1173
|
+
*/
|
1174
|
+
outgoing_ports_max: number;
|
1175
|
+
/**
|
1176
|
+
* Minimal outgoing port (0: Disabled)
|
1177
|
+
*/
|
1178
|
+
outgoing_ports_min: number;
|
1179
|
+
/**
|
1180
|
+
* True rechecks torrents on completion
|
1181
|
+
*/
|
1182
|
+
recheck_completed_torrents: boolean;
|
1183
|
+
/**
|
1184
|
+
* True resolves peer countries
|
1185
|
+
*/
|
1186
|
+
resolve_peer_countries: boolean;
|
1187
|
+
/**
|
1188
|
+
* Save resume data interval in min
|
1189
|
+
*/
|
1190
|
+
save_resume_data_interval: number;
|
1191
|
+
/**
|
1192
|
+
* Send buffer low watermark in KiB
|
1193
|
+
*/
|
1194
|
+
send_buffer_low_watermark: number;
|
1195
|
+
/**
|
1196
|
+
* Send buffer watermark in KiB
|
1197
|
+
*/
|
1198
|
+
send_buffer_watermark: number;
|
1199
|
+
/**
|
1200
|
+
* Send buffer watermark factor in percent
|
1201
|
+
*/
|
1202
|
+
send_buffer_watermark_factor: number;
|
1203
|
+
/**
|
1204
|
+
* Socket backlog size
|
1205
|
+
*/
|
1206
|
+
socket_backlog_size: number;
|
1207
|
+
/**
|
1208
|
+
* Upload choking algorithm used (see list of possible values below)
|
1209
|
+
*/
|
1210
|
+
upload_choking_algorithm: number;
|
1211
|
+
/**
|
1212
|
+
* Upload slots behavior used (see list of possible values below)
|
1213
|
+
*/
|
1214
|
+
upload_slots_behavior: number;
|
1215
|
+
/**
|
1216
|
+
* UPnP lease duration (0: Permanent lease)
|
1217
|
+
*/
|
1218
|
+
upnp_lease_duration: number;
|
1219
|
+
/**
|
1220
|
+
* μTP-TCP mixed mode algorithm (see list of possible values below)
|
1221
|
+
*/
|
1222
|
+
utp_tcp_mixed_mode: number;
|
1044
1223
|
}
|
1045
1224
|
export {};
|
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TorrentPieceState = exports.TorrentFilePriority = exports.TorrentTrackerStatus = exports.TorrentState = void 0;
|
4
|
-
var TorrentState;
|
1
|
+
export var TorrentState;
|
5
2
|
(function (TorrentState) {
|
6
3
|
/**
|
7
4
|
* Some error occurred, applies to paused torrents
|
@@ -80,8 +77,8 @@ var TorrentState;
|
|
80
77
|
* Torrent data files is missing
|
81
78
|
*/
|
82
79
|
TorrentState["MissingFiles"] = "missingFiles";
|
83
|
-
})(TorrentState
|
84
|
-
var TorrentTrackerStatus;
|
80
|
+
})(TorrentState || (TorrentState = {}));
|
81
|
+
export var TorrentTrackerStatus;
|
85
82
|
(function (TorrentTrackerStatus) {
|
86
83
|
/**
|
87
84
|
* Tracker is disabled (used for DHT, PeX, and LSD)
|
@@ -103,8 +100,8 @@ var TorrentTrackerStatus;
|
|
103
100
|
* Tracker has not been contacted yet
|
104
101
|
*/
|
105
102
|
TorrentTrackerStatus[TorrentTrackerStatus["Waiting"] = 4] = "Waiting";
|
106
|
-
})(TorrentTrackerStatus
|
107
|
-
var TorrentFilePriority;
|
103
|
+
})(TorrentTrackerStatus || (TorrentTrackerStatus = {}));
|
104
|
+
export var TorrentFilePriority;
|
108
105
|
(function (TorrentFilePriority) {
|
109
106
|
/**
|
110
107
|
* Do not download
|
@@ -122,8 +119,8 @@ var TorrentFilePriority;
|
|
122
119
|
* Maximal priority
|
123
120
|
*/
|
124
121
|
TorrentFilePriority[TorrentFilePriority["MaxPriority"] = 7] = "MaxPriority";
|
125
|
-
})(TorrentFilePriority
|
126
|
-
var TorrentPieceState;
|
122
|
+
})(TorrentFilePriority || (TorrentFilePriority = {}));
|
123
|
+
export var TorrentPieceState;
|
127
124
|
(function (TorrentPieceState) {
|
128
125
|
/**
|
129
126
|
* Not downloaded yet
|
@@ -137,4 +134,4 @@ var TorrentPieceState;
|
|
137
134
|
* Already downloaded
|
138
135
|
*/
|
139
136
|
TorrentPieceState[TorrentPieceState["Downloaded"] = 2] = "Downloaded";
|
140
|
-
})(TorrentPieceState
|
137
|
+
})(TorrentPieceState || (TorrentPieceState = {}));
|
package/package.json
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ctrl/qbittorrent",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.0",
|
4
4
|
"description": "TypeScript api wrapper for qbittorrent using got",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
7
7
|
"repository": "scttcper/qbittorrent",
|
8
|
-
"
|
9
|
-
"
|
8
|
+
"homepage": "https://qbittorrent.vercel.app",
|
9
|
+
"type": "module",
|
10
|
+
"main": "./dist/src/index.js",
|
11
|
+
"typings": "./dist/src/index.d.ts",
|
10
12
|
"files": [
|
11
|
-
"dist"
|
13
|
+
"dist/src"
|
12
14
|
],
|
13
15
|
"sideEffects": false,
|
14
16
|
"publishConfig": {
|
@@ -22,49 +24,49 @@
|
|
22
24
|
"lint": "eslint --ext .js,.ts, .",
|
23
25
|
"lint:fix": "eslint --fix --ext .js,.ts, .",
|
24
26
|
"prepare": "npm run build",
|
25
|
-
"build": "tsc
|
27
|
+
"build": "tsc",
|
26
28
|
"build:docs": "typedoc",
|
27
|
-
"test": "
|
28
|
-
"test:watch": "
|
29
|
-
"test:ci": "
|
29
|
+
"test": "ava",
|
30
|
+
"test:watch": "ava --watch",
|
31
|
+
"test:ci": "c8 --reporter=text --reporter=lcov ava --tap | tap-junit -o junit -n test-result.xml"
|
30
32
|
},
|
31
33
|
"dependencies": {
|
32
|
-
"@ctrl/
|
33
|
-
"@ctrl/torrent
|
34
|
-
"@ctrl/
|
35
|
-
"
|
36
|
-
"
|
34
|
+
"@ctrl/magnet-link": "^3.1.0",
|
35
|
+
"@ctrl/shared-torrent": "^4.1.0",
|
36
|
+
"@ctrl/torrent-file": "^2.0.1",
|
37
|
+
"@ctrl/url-join": "^2.0.0",
|
38
|
+
"formdata-node": "^4.3.2",
|
39
|
+
"got": "^12.0.4",
|
37
40
|
"tough-cookie": "^4.0.0"
|
38
41
|
},
|
39
42
|
"devDependencies": {
|
40
|
-
"@
|
41
|
-
"@
|
42
|
-
"@
|
43
|
-
"@
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"typescript": "4.4.4"
|
43
|
+
"@ctrl/eslint-config": "3.4.2",
|
44
|
+
"@sindresorhus/tsconfig": "2.0.0",
|
45
|
+
"@types/node": "17.0.31",
|
46
|
+
"@types/tough-cookie": "4.0.2",
|
47
|
+
"ava": "4.2.0",
|
48
|
+
"c8": "7.11.2",
|
49
|
+
"p-wait-for": "4.1.0",
|
50
|
+
"tap-junit": "5.0.2",
|
51
|
+
"ts-node": "10.7.0",
|
52
|
+
"typedoc": "0.22.15",
|
53
|
+
"typescript": "4.6.4"
|
52
54
|
},
|
53
|
-
"
|
54
|
-
"
|
55
|
-
|
56
|
-
"babel": {
|
57
|
-
"presets": [
|
58
|
-
"@babel/preset-typescript"
|
55
|
+
"ava": {
|
56
|
+
"files": [
|
57
|
+
"test/**/*.spec.ts"
|
59
58
|
],
|
60
|
-
"
|
61
|
-
"
|
59
|
+
"extensions": {
|
60
|
+
"ts": "module"
|
61
|
+
},
|
62
|
+
"nodeArguments": [
|
63
|
+
"--loader=ts-node/esm"
|
62
64
|
]
|
63
65
|
},
|
64
66
|
"release": {
|
65
67
|
"branch": "master"
|
66
68
|
},
|
67
69
|
"engines": {
|
68
|
-
"node": ">=
|
70
|
+
"node": ">=14.16"
|
69
71
|
}
|
70
72
|
}
|