Updated Iphone Bookmarklet to Add Torrent

Discussion of the Web Interface for Transmission, formerly known as Clutch. This applies to all version of Transmission
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Updated Iphone Bookmarklet to Add Torrent

Post by bulljit »

I've created a bookmarklet to add torrents from your iphone. Unfortunately due to cross-domain restrictions, a few server-side files will need to be added to your transmission/web folder aswell.

https://github.com/bulljit/Transmission ... okmarkelet

The only option that needs to be changed is replacing 127.0.0.1:9091 with your SERVER's public IP.address:port in the bookmarklet.

Please let me know how this works out for you.
Any bugs/suggestions/complaints are welcome!

P.S. For private torrents to work you will require at least Transmission version 2.30!
Last edited by bulljit on Sun May 15, 2011 9:16 am, edited 1 time in total.
straddle
Posts: 9
Joined: Mon Feb 28, 2011 2:32 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by straddle »

This is really great. Finally a simple way to add Torrents to your home Transmission from your mobile phone. It works really well - the server files should totally be added into the main Transmission code. Maybe a little beautifying is needed but otherwise its great. All it needs now is a way to easily install the bookmarklet via the iPhone webui. :)

One more thing, while the Bookmarklet works great on your iPhone, it is also just as useful for using on another PC. Great for adding Torrents to your home computer from your laptop while out and about, or from your work desktop.

If you are unsure about trying this out, trust me, it's really nicely done. Go ahead!

Nice work.
straddle
Posts: 9
Joined: Mon Feb 28, 2011 2:32 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by straddle »

I have joined in helping to make it better. :)

There have been some updates. Here is a summary:

- The WIKI Page is now updated to include clearer instructions: https://github.com/bulljit/Transmission ... kelet/wiki
- An easy install page, accessible from your phone, will now help you install the bookmarklet.
- Rewritten README file with clearer instructions.

We would love to hear peoples feedback. What do you think?
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by bulljit »

Even though I'm sure I'm just talking to myself, with the latest trunk of Transmission r12168, cookies can be passed when adding a torrent via RPC.

The bookmarklet now works with private torrent sites :D
lazybones
Posts: 220
Joined: Sun Jan 24, 2010 12:41 am

Re: Updated Iphone Bookmarklet to Add Torrent

Post by lazybones »

It isn't clear from the wiki but does your bookmarklet still work if the RPC password is enabled?
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by bulljit »

@lazybones

yup, if you want you can add it to the bookmarklet aswell user:pass@yourcomputerip:port....
otherwise it will just ask you for the authentication info when you add a link.
any complaints are welcome.
straddle
Posts: 9
Joined: Mon Feb 28, 2011 2:32 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by straddle »

@lazybones I have updated the README to clarify this. :)
lazybones
Posts: 220
Joined: Sun Jan 24, 2010 12:41 am

Re: Updated Iphone Bookmarklet to Add Torrent

Post by lazybones »

Haven't had a chance to install it yet, but thanks.
straddle
Posts: 9
Joined: Mon Feb 28, 2011 2:32 pm

Bookmarklet to add Torrents to Transmission from your Phone

Post by straddle »

A new version 0.5 is now available.

Bulljit has added some filtering to the bookmarklet to only change the links on a page for Torrent files or Magnet links. To ensure all torrent links are captured there will be some false positives. If you discover any sites that don't work then please let us know.

This solution should also work on other devices as well as the iPhone - iPad, iPod Touch, Android - as well as all recent desktop browsers (Safari, Firefox, Chrome, IE, Opera). We do however need your help to test this.

Please encourage your friends to try this out and let us know of any problems.

Get the latest version here: https://github.com/bulljit/Transmission ... okmarkelet

For help on setting up Transmission for remote access check the WIKI: https://github.com/bulljit/Transmission ... kelet/wiki

As of version 0.4 Private Trackers are now supported as long as you have a nightly build of Transmission 2.3. Some changes to Transmission were required to enable this. The next Transmission release will bring this functionality to everyone.
lazybones
Posts: 220
Joined: Sun Jan 24, 2010 12:41 am

Re: Updated Iphone Bookmarklet to Add Torrent

Post by lazybones »

The next public release will have the private tracker function, or also include this bookmarklet?
straddle
Posts: 9
Joined: Mon Feb 28, 2011 2:32 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by straddle »

It will add support for the Private Trackers in Transmission (by enabling Cookies to be sent to RPC).

It would be great if this Bookmarklet was added into the Transmisson binary but that's up to the powers that be. We'll have to wait and see what happens.
metaclam
Posts: 102
Joined: Sat Jan 31, 2009 6:31 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by metaclam »

i tried this on demonoid and nothing happened -- then realized it won't work on private trackers when i saw this thread.

then i tried it on tracker.example.com, and also nothing happened.

i have the correct ip and port set up (using the auto generator and synching bookmarks from safari os x to mobile safari). i believe i copied all server files as directed (see below). They are supposed to be mixed in with other existing files at the same levels, right? Then I restarted transmission. the transmission web server is working normally.

I know i'm not giving much to go on here but any idea what obvious thing i might be doing wrong?

(Transmission is not in the /Applications/ path but rather in a longer path with spaces)

also, it might help to include an installer to install the server files into the transmission app. shouldn't be hard to do just with an applescript applet.

Code: Select all

Transmission.app/Contents/Resources/web/fetchtorrent.html
Transmission.app/Contents/Resources/web/images
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/add_bookmark.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/ajax-loader.gif
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/bm_link.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/bm_page.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/bm_sending.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/bm_success.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/diag_bottom.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/diag_mid.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/diag_top.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/edit_bookmark_finish.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/edit_bookmark_start.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/open_bookmarks.png
Transmission.app/Contents/Resources/web/images/graphics/bookmarklet/save_bookmark.png
Transmission.app/Contents/Resources/web/index.html
Transmission.app/Contents/Resources/web/installbmlet.html
Transmission.app/Contents/Resources/web/javascript
Transmission.app/Contents/Resources/web/javascript/bookmarklet/bkmlt-fetchtorrent.js
Transmission.app/Contents/Resources/web/LICENSE
Transmission.app/Contents/Resources/web/Makefile.am
Transmission.app/Contents/Resources/web/stylesheets
programmer
Posts: 2
Joined: Wed Apr 27, 2011 5:52 am

Re: Updated Iphone Bookmarklet to Add Torrent

Post by programmer »

metaclam wrote:i tried this on demonoid and nothing happened -- then realized it won't work on private trackers when i saw this thread.

then i tried it on tracker.example.com, and also nothing happened.

I know i'm not giving much to go on here but any idea what obvious thing i might be doing wrong?

also, it might help to include an installer to install the server files into the transmission app. shouldn't be hard to do just with an applescript applet.
(quote edited for brevity)

btw: as you say, not much to go on. My symptoms were I would choose the bookmarklet, and the web page would not change. When it works, it should change links ending in .torrent to have a sort of double inset rectangle image that when clicked, would open a page that would send the link to your transmission instance. Links have to end in .torrent or be a magnet link (or one or 2 other criteria).

But, it would not work for me with the code from the github repository above. The bookmarklet code seems to have a bug in it....Then I found this fork of the code: https://github.com/netj/Transmission-Ad ... okmarkelet

It seems the original code did not double the backslashes used to escape the regular expressions. Comparing my link to the original, I'm not sure how the original could ever have worked. The regular expression used to find .torrent links would not ever find them. Anyways, with the new code, it works like a charm.

As a bonus, he also seems to include a 'install.sh' script that looks to be set up for OS X. (Don't use it for Linux, it won't work.)

One caveat. I first tried the original installbmlet.html on my ipad. It didn't work. When I replaced it with this code, the bookmark it created did not have the new double backslashes in there properly, even though it was in the code. I had to edit the bookmark by hand. The same page worked the first time with my iphone (but I never installed the bad code bookmarklet on it). I think mobile safari might have been caching the javascript on the ipad. Or else it was my error. Just letting you know, in case it does the same for you.
metaclam
Posts: 102
Joined: Sat Jan 31, 2009 6:31 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by metaclam »

programmer wrote: It seems the original code did not double the backslashes used to escape the regular expressions. Comparing my link to the original, I'm not sure how the original could ever have worked. The regular expression used to find .torrent links would not ever find them. Anyways, with the new code, it works like a charm.
Thanks a ton... I'm pretty sure I got it working now. (Tested on Mac Safari but not yet on iPhone.)

not knowing javascript i can't really follow all the quoting and escaping. I noticed on the main page bookmarklet starts with a ` and ends with one too. but the bookmarklet I had which was auto-generated did not. So I just copied code from the page you linked manually, left out the opening and closing quotes, and substituted in my IP and port. Then manually replaced the existing bookmarklet in Safari (Mac).

This is a truly great thing; it could sure stand to be made just a little easier to follow...

I do hope it's made to work with private trackers, though...
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Re: Updated Iphone Bookmarklet to Add Torrent

Post by bulljit »

@metaclam and @programmer

The bookmarklet code itself has undergone several revisions, the latest code will be here:

http://github.com/bulljit/Transmission- ... t/issues/7

The biggest problem is that bookmarklets are a pain to install on the iphone itself. I think we caused unnecessary confusion by adding the installbmlt.html, a readme file, and wiki site. It was hard to keep all the instructions in sync, as the bookmarklet was undergoing frequent changes.

Anyways, I promise to eventually consolidate the installation instructions to 1 page, and make a applescript to install the serverside files...

BTW this DOES work with PRIVATE torrents, if you're running the latest SVN branch of transmission https://trac.transmissionbt.com/ticket/4081 or just wait untill 2.30 is official.

Thanks
Post Reply