Disable Deluge-Web Authorization

Disable Deluge-Web Authorization

IT, Others

The Deluge-web has a build-in Authorization, you need to input your password to manage your client. If we already have a reverse proxy for it(I usually add ssl and htpasswd via proxy), Deluge-Web will be useless, we can disable this build-in auth by folloing steps.

Stop Deluge-Web service:

killall deluged
killall deluge-web

modify following files:
[deluge.egg]/ui/web/js/deluge-all.js, usually the [deluge.egg] is /usr/lib/python2.7/dist-packages/deluge/ or /usr/lib/python2.7/dist-packages/deluge-1.3.15-py2.7.egg/deluge. find section “deluge.LoginWindow” and replace the function (it is located near the end of the minified line)


onShow:function(){this.onLogin();}

[deluge.egg]/ui/web/auth.py should be like following:


#if s.hexdigest() == config["pwd_sha1"]:
#    return True
return True

or apply following patch:


diff -Nur deluge-1.3.15-py2.7.egg/deluge/ui/web/auth.py deluge-1.3.15-py2.7.egg-noauth/deluge/ui/web/auth.py
--- deluge-1.3.15-py2.7.egg/deluge/ui/web/auth.py	2018-12-26 04:37:43.734788434 -0500
+++ deluge-1.3.15-py2.7.egg-noauth/deluge/ui/web/auth.py	2018-12-26 04:38:54.250879522 -0500
@@ -200,8 +200,9 @@
             s = hashlib.sha1()
             s.update(config["pwd_salt"])
             s.update(utf8_encoded(password))
-            if s.hexdigest() == config["pwd_sha1"]:
-                return True
+            #if s.hexdigest() == config["pwd_sha1"]:
+            #    return True
+            return True
 
         else:
             # Can't detect which method we should be using so just deny
diff -Nur deluge-1.3.15-py2.7.egg/deluge/ui/web/js/deluge-all.js deluge-1.3.15-py2.7.egg-noauth/deluge/ui/web/js/deluge-all.js
--- deluge-1.3.15-py2.7.egg/deluge/ui/web/js/deluge-all.js	2018-12-26 04:37:43.734788434 -0500
+++ deluge-1.3.15-py2.7.egg-noauth/deluge/ui/web/js/deluge-all.js	2018-12-26 05:35:16.141247100 -0500
@@ -1437,7 +1437,7 @@
  * this exception statement from your version. If you delete this exception
  * statement from all source files in the program, then also delete it here.
  */
-Deluge.LoginWindow=Ext.extend(Ext.Window,{firstShow:true,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closable:false,closeAction:"hide",iconCls:"x-deluge-login-window-icon",layout:"fit",modal:true,plain:true,resizable:false,title:_("Login"),width:300,height:120,initComponent:function(){Deluge.LoginWindow.superclass.initComponent.call(this);this.on("show",this.onShow,this);this.addButton({text:_("Login"),handler:this.onLogin,scope:this});this.form=this.add({xtype:"form",baseCls:"x-plain",labelWidth:120,labelAlign:"right",defaults:{width:110},defaultType:"textfield"});this.passwordField=this.form.add({xtype:"textfield",fieldLabel:_("Password"),grow:true,growMin:"110",growMax:"145",id:"_password",name:"password",inputType:"password"});this.passwordField.on("specialkey",this.onSpecialKey,this)},logout:function(){deluge.events.fire("logout");deluge.client.auth.delete_session({success:function(a){this.show(true)},scope:this})},show:function(a){if(this.firstShow){deluge.client.on("error",this.onClientError,this);this.firstShow=false}if(a){return Deluge.LoginWindow.superclass.show.call(this)}deluge.client.auth.check_session({success:function(b){if(b){deluge.events.fire("login")}else{this.show(true)}},failure:function(b){this.show(true)},scope:this})},onSpecialKey:function(b,a){if(a.getKey()==13){this.onLogin()}},onLogin:function(){var a=this.passwordField;deluge.client.auth.login(a.getValue(),{success:function(b){if(b){deluge.events.fire("login");this.hide();a.setRawValue("")}else{Ext.MessageBox.show({title:_("Login Failed"),msg:_("You entered an incorrect password"),buttons:Ext.MessageBox.OK,modal:false,fn:function(){a.focus(true,10)},icon:Ext.MessageBox.WARNING,iconCls:"x-deluge-icon-warning"})}},scope:this})},onClientError:function(c,b,a){if(c.error.code==1){deluge.events.fire("logout");this.show(true)}},onShow:function(){this.passwordField.focus(true,300)}});
+Deluge.LoginWindow=Ext.extend(Ext.Window,{firstShow:true,bodyStyle:"padding: 10px 5px;",buttonAlign:"center",closable:false,closeAction:"hide",iconCls:"x-deluge-login-window-icon",layout:"fit",modal:true,plain:true,resizable:false,title:_("Login"),width:300,height:120,initComponent:function(){Deluge.LoginWindow.superclass.initComponent.call(this);this.on("show",this.onShow,this);this.addButton({text:_("Login"),handler:this.onLogin,scope:this});this.form=this.add({xtype:"form",baseCls:"x-plain",labelWidth:120,labelAlign:"right",defaults:{width:110},defaultType:"textfield"});this.passwordField=this.form.add({xtype:"textfield",fieldLabel:_("Password"),grow:true,growMin:"110",growMax:"145",id:"_password",name:"password",inputType:"password"});this.passwordField.on("specialkey",this.onSpecialKey,this)},logout:function(){deluge.events.fire("logout");deluge.client.auth.delete_session({success:function(a){this.show(true)},scope:this})},show:function(a){if(this.firstShow){deluge.client.on("error",this.onClientError,this);this.firstShow=false}if(a){return Deluge.LoginWindow.superclass.show.call(this)}deluge.client.auth.check_session({success:function(b){if(b){deluge.events.fire("login")}else{this.show(true)}},failure:function(b){this.show(true)},scope:this})},onSpecialKey:function(b,a){if(a.getKey()==13){this.onLogin()}},onLogin:function(){var a=this.passwordField;deluge.client.auth.login(a.getValue(),{success:function(b){if(b){deluge.events.fire("login");this.hide();a.setRawValue("")}else{Ext.MessageBox.show({title:_("Login Failed"),msg:_("You entered an incorrect password"),buttons:Ext.MessageBox.OK,modal:false,fn:function(){a.focus(true,10)},icon:Ext.MessageBox.WARNING,iconCls:"x-deluge-icon-warning"})}},scope:this})},onClientError:function(c,b,a){if(c.error.code==1){deluge.events.fire("logout");this.show(true)}},onShow:function(){this.onLogin();}});
 /*
  * Deluge.Menus.js
  *


copy patch to [deluge.egg], and run:


patch -p1 < disable-auth.patch

Amefs, EFS, Linux, seedbox
Previous Post
Transmission Multiple daemon instances
Next Post
Compile rtorrent-0.9.4 on ubuntu 18.04

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

keyboard_arrow_up