@ctrl/deluge
Advanced tools
Comparing version
/// <reference types="node" /> | ||
import { Response } from 'got'; | ||
import { TorrentSettings, TorrentClient, NormalizedTorrent, AllClientData, AddTorrentOptions as NormalizedAddTorrentOptions } from '@ctrl/shared-torrent'; | ||
import { GetHostsResponse, GetHostStatusResponse, DefaultResponse, BooleanStatus, TorrentInfo, ListMethods, UploadResponse, AddTorrentOptions, TorrentListResponse, DelugeSettings, PluginInfo, ConfigResponse, PluginsListResponse, TorrentOptions, TorrentFiles, TorrentStatus, Tracker, StringStatus, AddTorrentResponse } from './types'; | ||
import { AddTorrentOptions as NormalizedAddTorrentOptions, AllClientData, NormalizedTorrent, TorrentClient, TorrentSettings } from '@ctrl/shared-torrent'; | ||
import { AddTorrentOptions, AddTorrentResponse, BooleanStatus, ConfigResponse, DefaultResponse, DelugeSettings, GetHostsResponse, GetHostStatusResponse, ListMethods, PluginInfo, PluginsListResponse, StringStatus, TorrentFiles, TorrentInfo, TorrentListResponse, TorrentOptions, TorrentStatus, Tracker, UploadResponse } from './types'; | ||
export declare class Deluge implements TorrentClient { | ||
@@ -6,0 +6,0 @@ config: TorrentSettings; |
@@ -6,7 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const url_join_1 = __importDefault(require("url-join")); | ||
const form_data_1 = __importDefault(require("form-data")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const got_1 = __importDefault(require("got")); | ||
const tough_cookie_1 = require("tough-cookie"); | ||
const form_data_1 = __importDefault(require("form-data")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const url_join_1 = __importDefault(require("url-join")); | ||
const shared_torrent_1 = require("@ctrl/shared-torrent"); | ||
@@ -168,15 +168,11 @@ const defaults = { | ||
const url = url_join_1.default(this.config.baseUrl, '/upload'); | ||
const options = { | ||
const res = await got_1.default.post(url, { | ||
headers: form.getHeaders(), | ||
body: form, | ||
retry: 0, | ||
}; | ||
// allow proxy agent | ||
if (this.config.agent) { | ||
options.agent = this.config.agent; | ||
} | ||
if (this.config.timeout) { | ||
options.timeout = this.config.timeout; | ||
} | ||
const res = await got_1.default.post(url, options); | ||
// allow proxy agent | ||
agent: this.config.agent, | ||
timeout: this.config.timeout, | ||
}); | ||
// repsonse is json but in a string, cannot use native got.json() | ||
return JSON.parse(res.body); | ||
@@ -467,4 +463,4 @@ } | ||
const url = url_join_1.default(this.config.baseUrl, this.config.path); | ||
const options = { | ||
body: { | ||
return got_1.default.post(url, { | ||
json: { | ||
method, | ||
@@ -476,12 +472,7 @@ params, | ||
retry: 0, | ||
json: true, | ||
}; | ||
// allow proxy agent | ||
if (this.config.agent) { | ||
options.agent = this.config.agent; | ||
} | ||
if (this.config.timeout) { | ||
options.timeout = this.config.timeout; | ||
} | ||
return got_1.default.post(url, options); | ||
// allow proxy agent | ||
agent: this.config.agent, | ||
timeout: this.config.timeout, | ||
responseType: 'json', | ||
}); | ||
} | ||
@@ -488,0 +479,0 @@ _normalizeTorrentData(id, torrent) { |
@@ -131,2 +131,3 @@ export interface DefaultResponse { | ||
export interface Torrent { | ||
[key: string]: any; | ||
max_download_speed: number; | ||
@@ -160,3 +161,2 @@ upload_payload_rate: number; | ||
label?: string; | ||
[key: string]: any; | ||
} | ||
@@ -163,0 +163,0 @@ export interface PluginInfo extends DefaultResponse { |
{ | ||
"name": "@ctrl/deluge", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "TypeScript api wrapper for deluge using got", | ||
@@ -30,5 +30,5 @@ "author": "Scott Cooper <scttcper@gmail.com>", | ||
"dependencies": { | ||
"@ctrl/shared-torrent": "^1.3.2", | ||
"form-data": "^2.5.1", | ||
"got": "^9.6.0", | ||
"@ctrl/shared-torrent": "^2.0.0", | ||
"form-data": "^3.0.0", | ||
"got": "^10.3.0", | ||
"tough-cookie": "^3.0.1", | ||
@@ -38,19 +38,18 @@ "url-join": "^4.0.1" | ||
"devDependencies": { | ||
"@types/got": "9.6.7", | ||
"@types/jest": "24.0.18", | ||
"@types/node": "12.7.7", | ||
"@types/tough-cookie": "2.3.5", | ||
"@types/jest": "24.9.1", | ||
"@types/node": "13.5.0", | ||
"@types/tough-cookie": "2.3.6", | ||
"@types/url-join": "4.0.0", | ||
"@typescript-eslint/eslint-plugin": "2.3.1", | ||
"@typescript-eslint/parser": "2.3.1", | ||
"eslint": "6.4.0", | ||
"eslint-config-xo-space": "0.21.0", | ||
"eslint-config-xo-typescript": "0.18.0", | ||
"eslint-plugin-import": "2.18.2", | ||
"jest": "24.9.0", | ||
"@typescript-eslint/eslint-plugin": "2.17.0", | ||
"@typescript-eslint/parser": "2.17.0", | ||
"eslint": "6.8.0", | ||
"eslint-config-xo-space": "0.22.0", | ||
"eslint-config-xo-typescript": "0.24.1", | ||
"eslint-plugin-import": "2.20.0", | ||
"jest": "25.1.0", | ||
"p-wait-for": "3.1.0", | ||
"semantic-release": "15.13.24", | ||
"ts-jest": "24.1.0", | ||
"typedoc": "0.15.0", | ||
"typescript": "3.6.3" | ||
"semantic-release": "16.0.3", | ||
"ts-jest": "25.0.0", | ||
"typedoc": "0.16.8", | ||
"typescript": "3.7.5" | ||
}, | ||
@@ -57,0 +56,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
83258
0.11%16
-5.88%1101
-0.81%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated