coding outside the lines

BitTorrent WebUI Firefox Extension (what's new)

You can install the latest version of the Extension from
This Firefox extension allows you to simply click a download link for a torrent file and have it automatically uploaded to your Bit Torrent client through your preffered web interface. This is especially useful if you do a lot of browsing on a different computer than the one which is running your Bit Torrent client.

For example, if I'm at school and I find a Torrent I'd like to download, I just click on it and the extension automatically uploads it to my home computer which begins the download. When I get home my files are waiting for me on my home computer.

Supported Clients:


Since I use the HTML WebUI plugin to control Azureus (which I run headless on a Linux server) I got tired of always having to copy paste .torrent links to the upload form of Az's WebUI. So I made a Firefox extension which automatically downloads .torrent files and then uploads them to my Azureus WebUI. The result is pretty seamless, click on the download link of a bittorrent file and you receive a nice little message telling you if it worked or not.

Here's how it works.

high level sequence diagram

The extension registers itself as a content listener with Firefox, when a new channel is opened we are given the content-type of the channel, if the content-type is that of a .torrent file (application/x-bittorrent) then BitTorrent WebUI supplies an instance of StreamListener, effectively taking over the data transfer. Once the transfer is completed, the StreamListener calls back the extension passing it the channel data (the contents of the .torrent file).

The extension then requests a dispatcher from the dispatcher factory, the dispatcher factory returns a concrete dispatcher based on the BitTorrent client selected in the extension preferences. The dispatcher then creates a post request specifically for the selected web interface, and sends it to the URL of the web interface. The result of the POST request is then parsed and displayed using Firefox's alert service.

Early on I realised that I would get requests to support different BitTorrent clients and remote control plugins so I decided to design the extension so that it could easily accommodate these changes.

Here is an overview of the Dispatcher object hierarchy. (I'm using "object" here because classes don't really make sense in the context of JavaScript)

class diagram for a language without classes

Each BitTorrent client / WebUI has its own dispatcher based on the prototype dispatcher object (kind of like a base class). Dispatchers use the Template Method Pattern to customize the process of creating a POST request containing the torrent file data.

Concrete Dispatcher objects can "hook" into 4 steps of creating and sending the torrent data

So that way I can add support for a new client by writing 1 file which defines a new dispatcher object and registers it with the dispatcher factory... easy peasy.

And if you're still curious, feel free to check out the source code.

If you want to start using the newest version of BitTorrent WebUI as soon as I do then you can install the extension from my site instead of waiting for the review process. Please do this only if you are really (really) impatient or enjoy beta testing, the review process at mozilla is there to protect you!