It would be great if magnet links downloaded right in the browser. The code to integrate is already quite accessible via WebTorrent.
If you aren't familiar WebTorrent:
/cc @feross
Nice idea, @mikeal. This would definitely set Brave apart from other browsers. Built-in torrent support would be really cool, and not that hard to implement with webtorrent.
Here's how this could work:
.torrent file is clicked, initialize a WebTorrent instance add the link.js
var client = new WebTorrent()
var torrent = client.add(magnetLink)
js
torrent.once('metadata', function () {
torrent.files.forEach(function (file) {
console.log(file.name, file.length) // render the files in the UI
})
}
js
// Get a Node.js style Readable stream with file data and render it.
// Pieces needed by the stream will be prioritized highly and fetched from the network.
file.createReadStream()
js
torrent.destroy()
client.destroy()
It also probably makes sense to warn the user before starting a torrent on their behalf so they can make an informed decision about whether they wish to join the swarm.
If you don't want to implement any custom UI, you can actually hack this together really quickly using the torrent.createServer() feature in WebTorrent.
// create HTTP server for this torrent
var server = torrent.createServer()
// start the server listening to a port
server.listen(port, function () {
// Navigate the user to http://localhost:<port>/ to see a list of files.
// Access individual files at http://localhost:<port>/<index> where index is the
// index in the torrent.files array.
// As the local http server receives requests for pieces of the file, webtorrent
// fetches them from the torrent network.
})
More info: https://webtorrent.io/docs
how hard would it be to make it pipe through a VPN?
@TheAlphaNerd There is an open PR on WebTorrent to add SOCKS proxy support. Not sure what's required for VPN support.
@feross I think we will be at some of the same events in the next couple months. maybe we can find time to hack on it ??
[--- Commented from Asana.com
---[aa]
@TheAlphaNerd That would be fun!
This would be awesome!
@TheAlphaNerd If the OS is using a VPN everything WebTorrent does should be behind it already. I don't really know if the browsers SOCKS setting would put WebRTC connections behind it, @feross ?
Would it be possible to use this feature while IP address leakage via WebRTC is disabled with the fingerprinting protection? / cc: @diracdeltas
We could combine this with serving static files from a webtorrent over a custom protocol:
https://github.com/retrohacker/peerweb/blob/master/index.js#L65-L207
Note: the http fallback there is a nasty hack, when https://github.com/electron/electron/issues/4303 lands, a redirect will solve that.
@luixxiul Yes, WebTorrent should work just fine with the fingerprinting detection in Brave. With that setting enabled, WebRTC just finds detects fewer ip:port candidates. Specifically, it would just use the ip:port of the default route (public IP, or if a VPN聽is in use, then the VPN's IP). Normally WebRTC finds additional IPs, including the local IP address, but that's just to increase the chances of a successful connection (more possible routes) and to improve the performance of the connection (local routes will be faster than public routes).
tldr: WebTorrent's WebRTC functionality will operate fine with the reduced list of IPs that Brave's fingerprinting mode returns.
Hey torrent fans! I'm working on adding WebTorrent to Brave with @dcposch over the next couple weeks. Here's the design doc that explains our current plan.
Feedback and comments welcome!
Initial PR to add WebTorrent support is out! https://github.com/brave/browser-laptop/pull/5342
馃帀 馃帀 馃帀
Can we close this?
Would someone please specify the steps for QA? They must have been specified somewhere in a PR, but it should be clarified here for reference as the QA work should start from the issue, not a PR.
Thanks in advance!
@luixxiul There's a design doc here that will probably be helpful: https://docs.google.com/document/d/1d_NXJp05gGcy8kYYDcntIRPQaDrvU3CUF-QjEpf0PLI/edit?usp=sharing
Support the following in the Brave desktop app:
@feross thanks, I didn't know .torrent files were just planned but not supported yet. I was almost creating an issue for it.
QA Steps
QA possible once #5981 is fixed
Most helpful comment
Initial PR to add WebTorrent support is out! https://github.com/brave/browser-laptop/pull/5342
馃帀 馃帀 馃帀