@torrent-tv/proxy 2.107.87 → 2.107.89

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.107.87",
3
+ "version": "2.107.89",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  "ffmpeg-static": "5.3.0",
47
47
  "franc": "6.2.0",
48
48
  "get-port": "7.2.0",
49
- "node-datachannel": "0.32.3",
49
+ "node-datachannel": "0.33.6",
50
50
  "parse-torrent": "11.0.24",
51
51
  "uint8-util": "2.2.6",
52
52
  "undici": "7.30.2",
@@ -1,15 +1,14 @@
1
1
  #!/bin/sh
2
- # Builds and checks the proxy's two native modules in an installed proxy:
3
- # node-datachannel (WebRTC) and utp-native (our fork, uTP to peers). Every
4
- # image that installs the proxy runs this one script after its install with
5
- # `--ignore-scripts` (torrent-tv/meta#302).
2
+ # Checks that node-datachannel (WebRTC) loads and builds utp-native (our fork,
3
+ # uTP to peers) in an installed proxy. Every image that installs the proxy runs
4
+ # this one script after its install with `--ignore-scripts`
5
+ # (torrent-tv/meta#302).
6
6
  #
7
7
  # sh scripts/install-native.sh <package dir>
8
8
  #
9
9
  # <package dir> holds the installed proxy: its package.json and node_modules/.
10
- # INSTALL_NATIVE_RETRY_DELAY is the wait in seconds between node-datachannel
11
- # attempts (default 10). npm and node are taken from PATH, and every npm call
12
- # runs in the package directory, never with --global.
10
+ # npm and node are taken from PATH, and every npm call runs in the package
11
+ # directory, never with --global.
13
12
 
14
13
  set -eu
15
14
 
@@ -59,26 +58,26 @@ if [ "$major" -lt "$floor" ]; then
59
58
  fi
60
59
  echo "install-native: node v$version (floor $floor)"
61
60
 
62
- # 2. node-datachannel fetches a prebuilt binary; one failed request ends the
63
- # rebuild, so it is tried up to five times. Without the binary the proxy has no
64
- # WebRTC.
65
- delay=${INSTALL_NATIVE_RETRY_DELAY:-10}
66
- attempt=1
67
- while ! npm rebuild node-datachannel; do
68
- if [ "$attempt" -ge 5 ]; then
69
- break
70
- fi
71
- echo "install-native: node-datachannel attempt $attempt of 5 failed; retrying in ${delay}s" >&2
72
- sleep "$delay"
73
- attempt=$((attempt + 1))
74
- done
75
- binary_found=
76
- for binary in node_modules/node-datachannel/build/Release/*.node; do
77
- if [ -f "$binary" ]; then
78
- binary_found=1
79
- fi
80
- done
81
- [ -n "$binary_found" ] || fatal "node-datachannel has no native binary; the proxy would have no WebRTC"
61
+ # 2. node-datachannel ships its binary as an optional per-platform npm package
62
+ # that `npm ci` installs by itself, so there is nothing to build or fetch here.
63
+ # The one fact this step needs is that this node loads the binding the install
64
+ # left, and only the package's own loader answers it. Without the binding the
65
+ # proxy has no WebRTC.
66
+ if ndc=$(node -e '
67
+ const fs = require("node:fs");
68
+ try {
69
+ const ndc = require("node-datachannel");
70
+ const version = JSON.parse(fs.readFileSync("node_modules/node-datachannel/package.json", "utf8")).version;
71
+ process.stdout.write(version + " " + ndc.getLibraryVersion());
72
+ } catch (error) {
73
+ process.stdout.write(String((error && error.message) || error).split("\n")[0]);
74
+ process.exit(1);
75
+ }
76
+ '); then
77
+ echo "install-native: node-datachannel ${ndc% *}: binding loads (libdatachannel ${ndc#* })"
78
+ else
79
+ fatal "node-datachannel binding does not load: ${ndc:-no error message}"
80
+ fi
82
81
 
83
82
  # 3. The proxy pins our utp-native fork through overrides.
84
83
  spec=$(json_field package.json overrides utp-native)