@e-mc/request 0.9.27 → 0.9.28
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/README.md +4 -4
- package/index.js +10 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.28/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { IModule, ModuleConstructor } from "./index";
|
|
@@ -202,9 +202,9 @@ instance.get("http://hostname/path/config.yml", options).then(data => {
|
|
|
202
202
|
|
|
203
203
|
## References
|
|
204
204
|
|
|
205
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
206
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
207
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
205
|
+
- https://www.unpkg.com/@e-mc/types@0.9.28/lib/http.d.ts
|
|
206
|
+
- https://www.unpkg.com/@e-mc/types@0.9.28/lib/request.d.ts
|
|
207
|
+
- https://www.unpkg.com/@e-mc/types@0.9.28/lib/settings.d.ts
|
|
208
208
|
|
|
209
209
|
* https://www.npmjs.com/package/@types/node
|
|
210
210
|
|
package/index.js
CHANGED
|
@@ -156,11 +156,17 @@ function getProxySettings(request, agentTimeout) {
|
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
158
|
function closeTorrent(pid) {
|
|
159
|
-
const index = ARIA2.PID_QUEUE.findIndex(value =>
|
|
159
|
+
const index = ARIA2.PID_QUEUE.findIndex(value => value[0] === pid);
|
|
160
160
|
if (index !== -1) {
|
|
161
161
|
ARIA2.PID_QUEUE.splice(index, 1);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
function resetAria2() {
|
|
165
|
+
if (ARIA2.PID_TIMER) {
|
|
166
|
+
clearInterval(ARIA2.PID_TIMER);
|
|
167
|
+
ARIA2.PID_TIMER = null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
164
170
|
function clearDnsLookup() {
|
|
165
171
|
DNS.CACHE = Object.create(null);
|
|
166
172
|
DNS.TIMEOUT.forEach(value => clearTimeout(value));
|
|
@@ -178,7 +184,7 @@ function resetHttpHost(version) {
|
|
|
178
184
|
const host = HTTP.HOST[origin];
|
|
179
185
|
if (host.secure && host.version === 1) {
|
|
180
186
|
const failed = host.failed(2, true);
|
|
181
|
-
if (failed === 0 && host.
|
|
187
|
+
if (failed === 0 && host.error(2, true) < 10 || failed < 3 && host.success(2, true) > 0) {
|
|
182
188
|
host.version = version;
|
|
183
189
|
}
|
|
184
190
|
}
|
|
@@ -1366,13 +1372,9 @@ class Request extends module_1 {
|
|
|
1366
1372
|
stderr.setEncoding('utf-8').on('data', (value) => message += value);
|
|
1367
1373
|
if (pid !== undefined && module_1.isFile(uri, 'torrent')) {
|
|
1368
1374
|
if (!ARIA2.PID_TIMER) {
|
|
1369
|
-
const clearTimer = () => {
|
|
1370
|
-
clearInterval(ARIA2.PID_TIMER);
|
|
1371
|
-
ARIA2.PID_TIMER = null;
|
|
1372
|
-
};
|
|
1373
1375
|
ARIA2.PID_TIMER = setInterval(() => {
|
|
1374
1376
|
if (ARIA2.PID_QUEUE.length === 0) {
|
|
1375
|
-
|
|
1377
|
+
resetAria2();
|
|
1376
1378
|
return;
|
|
1377
1379
|
}
|
|
1378
1380
|
for (const item of ARIA2.PID_QUEUE) {
|
|
@@ -1392,7 +1394,7 @@ class Request extends module_1 {
|
|
|
1392
1394
|
if (ARIA2.UPDATE_STATUS && !silent) {
|
|
1393
1395
|
const item = ARIA2.PID_QUEUE.shift();
|
|
1394
1396
|
if (!item) {
|
|
1395
|
-
|
|
1397
|
+
resetAria2();
|
|
1396
1398
|
return;
|
|
1397
1399
|
}
|
|
1398
1400
|
if ((!ARIA2.UPDATE_BROADCAST_ONLY || item[2]) && this.host?.logState !== 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/request",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.28",
|
|
4
4
|
"description": "Request constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.9.
|
|
24
|
-
"@e-mc/types": "0.9.
|
|
23
|
+
"@e-mc/module": "0.9.28",
|
|
24
|
+
"@e-mc/types": "0.9.28",
|
|
25
25
|
"combined-stream": "^1.0.8",
|
|
26
26
|
"js-yaml": "^4.1.1",
|
|
27
27
|
"picomatch": "^4.0.3",
|