@torrent-tv/proxy 2.6.2 → 2.6.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.6.3
2
+
3
+ - **Fix**: Data channel handler now logs **all** requests regardless of body presence — `GET /transcode/…`, `GET /api/…/progress`, `GET /api/…/stats` etc. were previously invisible in logs. Non-2xx response statuses and fetch errors are also logged, enabling diagnosis of HLS manifest load failures.
4
+
1
5
  ## 2.6.1
2
6
 
3
7
  - **Fix**: `TorrentPool.getTorrent()` — eliminated a race condition where two concurrent requests for the same torrent both found the cache empty and both called `client.add()`, causing WebTorrent to throw "Cannot add duplicate torrent". In-flight promises are now cached in a private `#pending` map; subsequent requests for the same key join the existing promise instead of triggering a second `client.add()`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "publishConfig": {
@@ -143,9 +143,9 @@ export function createDataChannelHandler({ proxyPort, onLog }) {
143
143
  return;
144
144
  }
145
145
 
146
- if (body != null && typeof body === "string" && body.length > 0) {
147
- log(`[dc] ${method} ${path} body=${body.length} bytes`);
148
- }
146
+ const queryInfo = query ? `?${query}` : "";
147
+ const bodyInfo = body != null && typeof body === "string" && body.length > 0 ? ` body=${body.length} bytes` : "";
148
+ log(`[dc] ${method} ${path}${queryInfo}${bodyInfo}`);
149
149
 
150
150
  const targetUrl = `http://127.0.0.1:${proxyPort}${path}${query ? `?${query}` : ""}`;
151
151
  const requestHeaders = { ...(forwardedHeaders ?? {}), host: `127.0.0.1:${proxyPort}` };
@@ -159,10 +159,15 @@ export function createDataChannelHandler({ proxyPort, onLog }) {
159
159
  redirect: "manual"
160
160
  });
161
161
  } catch (fetchError) {
162
+ log(`[dc] ${method} ${path}${queryInfo} → error: ${fetchError?.message ?? String(fetchError)}`);
162
163
  send(channel, { type: "response-error", requestId, error: fetchError?.message ?? String(fetchError) });
163
164
  return;
164
165
  }
165
166
 
167
+ if (response.status !== 200 && response.status !== 206) {
168
+ log(`[dc] ${method} ${path}${queryInfo} → ${response.status}`);
169
+ }
170
+
166
171
  /** @type {Record<string, string>} */
167
172
  const responseHeaders = {};
168
173
  for (const [name, value] of response.headers.entries()) {