*FIX* WebUI + Userscript

General support for problems installing or using Deluge
Post Reply
Znuff
Member
Member
Posts: 11
Joined: Sun Nov 18, 2007 6:34 am

*FIX* WebUI + Userscript

Post by Znuff »

Hi there.

I've been trying all day to fix the webui into accepting input from the userscript now that the function add_torrent_filecontent has been removed or has magically dissapeared somewhere. The fix takes less than a minute. Here's what you need to edit:

(take note, on my ubuntu box the webui files are under/usr/share/python-support/deluge-webui/deluge/ui/webui)

The original code in the file pages.py you need to find is:

Code: Select all

        if vars.data_b64: #b64 post (greasemonkey)
            data_b64 = unicode(vars.data_b64)
            torrent_name = vars.torrent_name
        else:  #file-post (curl)
            data_b64 = base64.b64encode(vars.torrent.file.read())
            torrent_name = vars.torrent.filename
        proxy.add_torrent_filecontent(torrent_name, data_b64)
        return 'ok'
Now, all you need to do is to change some lines around so the code reads:

Code: Select all

        if vars.data_b64: #b64 post (greasemonkey)
            data_b64 = base64.decodestring(unicode(vars.data_b64))
            torrent_name = vars.torrent_name
        else:  #file-post (curl)
            log.debug('testing')
            data_b64 = base64.b64encode(vars.torrent.file.read())
            torrent_name = vars.torrent.filename
        proxy.add_torrent_file_binary(torrent_name, data_b64)
So, we basically decode the b64 data then we replaced add_torrent_filecontents with add_torrent_file_binary.

Have fun with those torrents ;)
andar
Top Bloke
Top Bloke
Posts: 1050
Joined: Fri Jun 08, 2007 8:38 pm
Location: Victoria, BC
Contact:

Re: *FIX* WebUI + Userscript

Post by andar »

Great. I will review and commit this fix to svn for 1.1.9.
andar
Top Bloke
Top Bloke
Posts: 1050
Joined: Fri Jun 08, 2007 8:38 pm
Location: Victoria, BC
Contact:

Re: *FIX* WebUI + Userscript

Post by andar »

This has been committed in revision 5361.
micah.waldstein

Re: *FIX* WebUI + Userscript

Post by micah.waldstein »

Awesome! This fixes a long standing bug I opened - http://dev.deluge-torrent.org/ticket/670
Post Reply