webtorrent / instant.io

🚀 Streaming file transfer over WebTorrent (torrents on the web)
https://instant.io
MIT License
3.43k stars 436 forks source link

Adds Overridable Trackers #365

Closed zackees closed 2 years ago

zackees commented 2 years ago

Note: Fixed bug of udp trackers slipping in despite explicit filter due to implicit list concatenations from global variables. The result is a change in the generated magnetURI where the udp trackers have now been removed. The website continues to operate ok. Preserving previous behavior involves modifying global state in the call stack, specifically the globalThis.WEBTORRENT_ANNOUNCE variable. This cl ends the writing of this variable by setting the announce list explicitly in the call.

However, that's a lot of changes. I understand if the team will pass on this feature.

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update [ ] Bug fix [x] New feature [ ] Other, please explain:

What changes did you make? (Give an overview)

image

Allows overridable trackers such as the all important localhost tracker during development. This is represented as a text box which is auto populated by the default trackers. The user can change these trackers urls to their own. For example I'll change mine to ws://localhost:8000

Which issue (if any) does this pull request address?

The ability to run instant.io in a development setting using a local debug server.

Is there anything you'd like reviewers to focus on?

Testing was performed manually:

Update: Manually verified that this causes a bug, due to this line of code: https://github.com/webtorrent/create-torrent/blob/1c62c651a99efe3394b81366b19b8ae13c64c3cc/index.js#L300

Local dev instant.io generated this magnetURI: magnet:?xt=urn:btih:a79afb88341ce1e3b30167889991ea03310d73ff&dn=battery_swap.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com

instant.io version generated this magnetURI: magnet:?xt=urn:btih:a79afb88341ce1e3b30167889991ea03310d73ff&dn=battery_swap.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337

Keep in mind the local dev version of instant.io did not have any turn servers enabled.