torrent-online 1.7.1 → 1.7.2

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.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/wtui.js +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "torrent-online",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
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,6 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@inquirer/prompts": "^7.0.0",
43
+ "hls.js": "^1.5.17",
43
44
  "webtorrent": "^3.0.21"
44
45
  },
45
46
  "engines": {
package/wtui.js CHANGED
@@ -669,6 +669,15 @@ async function webReq(req, res, client, st, opts, cacheDir, base) {
669
669
  res.end(WEB_HTML.replace('__BASE__', base));
670
670
  return;
671
671
  }
672
+ if (p === '/hls.min.js') {
673
+ try {
674
+ const b = fs.readFileSync(require.resolve('hls.js/dist/hls.min.js'));
675
+ res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
676
+ res.setHeader('Cache-Control', 'no-store');
677
+ res.end(b);
678
+ } catch { res.statusCode = 404; res.end('no hls.js'); }
679
+ return;
680
+ }
672
681
  if (p === '/api/search') {
673
682
  const q = u.searchParams.get('q') || '';
674
683
  const { items, notes } = await searchIndexers(q);
@@ -942,7 +951,7 @@ video{flex:1;width:100%;min-height:0;background:#000}
942
951
  <div class=bar><b>${esc(f.name)}</b><select id=a style=display:none></select><select id=s style=display:none></select><span id=n></span></div>
943
952
  <video id=v controls autoplay playsinline></video>
944
953
  <div id=ov>▶</div>
945
- <script src="https://cdn.jsdelivr.net/npm/hls.js@1.5.17/dist/hls.min.js"></script>
954
+ <script src="${base}/hls.min.js"></script>
946
955
  <script>
947
956
  var B=${JSON.stringify(base)},ID=${mV[1]},I=${mV[2]};
948
957
  var v=document.getElementById("v"),aS=document.getElementById("a"),sS=document.getElementById("s"),n=document.getElementById("n"),ov=document.getElementById("ov");