diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 037e5acf2..61c6902cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: with: node-version: 18 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package.json') }} diff --git a/AUTHORS.md b/AUTHORS.md index 86740739a..3b930ae6f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -67,5 +67,8 @@ - Arsène Fougerouse (arsene582@gmail.com) - Brad Marsden (silentbot1@gmail.com) - krazak (krazak@vt.edu) +- Chocobozzz (chocobozzz@cpy.re) +- uriva (uriva@users.noreply.github.com) +- Subin Siby (mail@subinsb.com) #### Generated by tools/update-authors.sh. diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f7e29d3f..6b00b4dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,31 @@ +## [11.2.2](https://github.com/webtorrent/bittorrent-tracker/compare/v11.2.1...v11.2.2) (2025-09-06) + + +### Bug Fixes + +* export WebSocketTracker ([#558](https://github.com/webtorrent/bittorrent-tracker/issues/558)) ([1571551](https://github.com/webtorrent/bittorrent-tracker/commit/15715518decfed77d7888ba21d6ab592fa91cc85)) + +## [11.2.1](https://github.com/webtorrent/bittorrent-tracker/compare/v11.2.0...v11.2.1) (2025-01-19) + + +### Bug Fixes + +* http announce no left ([#548](https://github.com/webtorrent/bittorrent-tracker/issues/548)) ([3cd77f3](https://github.com/webtorrent/bittorrent-tracker/commit/3cd77f3e6f5b52f5d58adaf004b333cd2061a4da)) + +# [11.2.0](https://github.com/webtorrent/bittorrent-tracker/compare/v11.1.2...v11.2.0) (2024-12-28) + + +### Features + +* release [#539](https://github.com/webtorrent/bittorrent-tracker/issues/539) and [#535](https://github.com/webtorrent/bittorrent-tracker/issues/535) ([#544](https://github.com/webtorrent/bittorrent-tracker/issues/544)) ([e7de90c](https://github.com/webtorrent/bittorrent-tracker/commit/e7de90c0cbcfb41c9c53c5caf69cc37c6d3ef1e8)) + +## [11.1.2](https://github.com/webtorrent/bittorrent-tracker/compare/v11.1.1...v11.1.2) (2024-08-13) + + +### Bug Fixes + +* statuscode ([#526](https://github.com/webtorrent/bittorrent-tracker/issues/526)) ([e9d8f8c](https://github.com/webtorrent/bittorrent-tracker/commit/e9d8f8cd754ba26d86f32f9b8da0c0c4a3dcd646)) + ## [11.1.1](https://github.com/webtorrent/bittorrent-tracker/compare/v11.1.0...v11.1.1) (2024-07-01) diff --git a/README.md b/README.md index 2f0d99c12..db0eba161 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ To start a BitTorrent tracker server to track swarms of peers: ```js import { Server } from 'bittorrent-tracker' +// Or import Server from 'bittorrent-tracker/server' const server = new Server({ udp: true, // enable udp server? [default=true] @@ -267,6 +268,8 @@ Scraping multiple torrent info is possible with a static `Client.scrape` method: ```js import Client from 'bittorrent-tracker' +// Or import Client from 'bittorrent-tracker/client' + Client.scrape({ announce: announceUrl, infoHash: [ infoHash1, infoHash2 ]}, function (err, results) { results[infoHash1].announce results[infoHash1].infoHash diff --git a/lib/client/http-tracker.js b/lib/client/http-tracker.js index 6297d2e20..43464e8eb 100644 --- a/lib/client/http-tracker.js +++ b/lib/client/http-tracker.js @@ -55,6 +55,8 @@ class HTTPTracker extends Tracker { peer_id: this.client._peerIdBinary, port: this.client._port }) + + if (params.left !== 0 && !params.left) params.left = 16384 if (this._trackerId) params.trackerid = this._trackerId this._request(this.announceUrl, params, (err, data) => { @@ -150,6 +152,7 @@ class HTTPTracker extends Tracker { 'user-agent': this.client._userAgent || '' } }) + if (res.body.on) res.body.on('error', cb) } catch (err) { if (err) return cb(err) } @@ -158,7 +161,7 @@ class HTTPTracker extends Tracker { if (this.destroyed) return if (res.status !== 200) { - return cb(new Error(`Non-200 response code ${res.statusCode} from ${this.announceUrl}`)) + return cb(new Error(`Non-200 response code ${res.status} from ${this.announceUrl}`)) } if (!data || data.length === 0) { return cb(new Error(`Invalid tracker response from${this.announceUrl}`)) diff --git a/package.json b/package.json index 71e0fb3d2..ca9cebd6d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bittorrent-tracker", "description": "Simple, robust, BitTorrent tracker (client & server) implementation", - "version": "11.1.1", + "version": "11.2.2", "author": { "name": "WebTorrent LLC", "email": "feross@webtorrent.io", @@ -52,10 +52,10 @@ "devDependencies": { "@mapbox/node-pre-gyp": "1.0.11", "@webtorrent/semantic-release-config": "1.0.10", - "magnet-uri": "7.0.5", + "magnet-uri": "7.0.7", "semantic-release": "21.1.2", "standard": "*", - "tape": "5.8.1", + "tape": "5.9.0", "undici": "^6.16.1", "webrtc-polyfill": "^1.1.5", "webtorrent-fixtures": "2.0.2" @@ -64,7 +64,18 @@ "node": ">=16.0.0" }, "exports": { - "import": "./index.js" + ".": { + "import": "./index.js" + }, + "./client": { + "import": "./client.js" + }, + "./server": { + "import": "./server.js" + }, + "./websocket-tracker": { + "import": "./lib/client/websocket-tracker.js" + } }, "keywords": [ "bittorrent",