trdlo / client175

Automatically exported from code.google.com/p/client175
GNU General Public License v3.0
0 stars 0 forks source link

Password protect the web-interface #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
BTW, thanks for the wonderful webui for mpd. Its really nice.

It would be great if you could add password-protection.

Original issue reported on code.google.com by abhijeet...@gmail.com on 9 Feb 2011 at 11:06

GoogleCodeExporter commented 8 years ago
Here's a little guide to do this. It's not hard, but be careful:

First, upgrade to CherryPy 3.2.0:

1) Download a recent version (at least 3.2.0) of CherryPy, which is used 
internally by Client175, from here: 
http://www.cherrypy.org/wiki/CherryPyDownload
2) Extract the archive, and find the directory "CherryPy-3.2.0/py2/cherrypy". 
3) Remove the directory <YourClient175Dir>/cherrypy
4) Copy "CherryPy-3.2.0/py2/cherrypy" to <YourClient175Dir> (Don't copy the 
contents, copy the entire folder!)

Now, patch the code of Client175, so it asks for a password. 

1) Open the file "server.py" in a text editor
2) Towards the end of the file, find the line that starts with 
"cherrypy.tree.mount"
3) Replace this single line with the following (multiple) lines:

app = cherrypy.tree.mount(root, SERVER_ROOT)

userpassdict = {'username' : 'password'} # replace with your username/password
checkpassword = cherrypy.lib.auth_basic.checkpassword_dict(userpassdict)
app.merge({ '/': { 'tools.auth_basic.on': True,
              'tools.auth_basic.realm': 'client175',
             'tools.auth_basic.checkpassword': checkpassword }
          })
4) Restart Client175

Now, when you try to access the client, you should be asked for a password.

Original comment by jeroen.b...@gmail.com on 24 Oct 2011 at 11:43

GoogleCodeExporter commented 8 years ago
Oh, by the way, this ONLY works when you use the standalone version of 
Client175, and not when running it behind Apache or something. But then again, 
if you didn't use the standalone version, you wouldn't be asking this question.

Original comment by jeroen.b...@gmail.com on 24 Oct 2011 at 11:45