torrent-online 1.4.8 → 1.4.10
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/package.json +2 -2
- package/wtui.js +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "torrent-online",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Stream .torrent / magnet to VLC or browser — torrent streaming for macOS/Linux without a torrent client. Стрим торрентов в VLC или браузер.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@inquirer/prompts": "^7.0.0",
|
|
43
|
-
"webtorrent": "
|
|
43
|
+
"webtorrent": "^3.0.21"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18"
|
package/wtui.js
CHANGED
|
@@ -194,6 +194,15 @@ function contentTypeByExt(ext) {
|
|
|
194
194
|
|
|
195
195
|
function makeServer(torrent, base) {
|
|
196
196
|
return http.createServer((req, res) => {
|
|
197
|
+
try {
|
|
198
|
+
handleReq(req, res, torrent, base);
|
|
199
|
+
} catch (e) {
|
|
200
|
+
if (!res.headersSent) { res.statusCode = 500; res.end('stream error'); }
|
|
201
|
+
console.error('server:', e?.stack || e);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function handleReq(req, res, torrent, base) {
|
|
197
206
|
const u = new URL(req.url, 'http://127.0.0.1');
|
|
198
207
|
let p = u.pathname;
|
|
199
208
|
if (base) {
|
|
@@ -253,7 +262,6 @@ function makeServer(torrent, base) {
|
|
|
253
262
|
res.setHeader('Content-Length', total);
|
|
254
263
|
file.createReadStream().pipe(res);
|
|
255
264
|
}
|
|
256
|
-
});
|
|
257
265
|
}
|
|
258
266
|
|
|
259
267
|
// ---- Поиск индексаторов ----
|
|
@@ -622,6 +630,7 @@ async function main() {
|
|
|
622
630
|
const msg = (e && (e.message || e)) + '';
|
|
623
631
|
if (NET_NOISE.test(msg)) return;
|
|
624
632
|
console.error('uncaughtException:', msg);
|
|
633
|
+
console.error((e && e.stack || '').split('\n').slice(0, 8).join('\n'));
|
|
625
634
|
shutdown('uncaught', 1);
|
|
626
635
|
});
|
|
627
636
|
if (vlc) vlc.on('exit', () => shutdown('VLC exit'));
|