From e4be5a716f144014d00d9b1cc74f1ed3a0b720e7 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 13 Jun 2019 21:57:05 -0700 Subject: [PATCH] Fix unable to view database status when auth is disabled --- plexpy/__init__.py | 2 ++ plexpy/webserve.py | 2 +- plexpy/webstart.py | 9 +++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 7e325643..31a2790d 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -100,6 +100,7 @@ UMASK = None HTTP_PORT = None HTTP_ROOT = None +AUTH_ENABLED = None DEV = False @@ -114,6 +115,7 @@ WIN_SYS_TRAY_ICON = None SYS_TIMEZONE = None SYS_UTC_OFFSET = None + def initialize(config_file): with INIT_LOCK: diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 76589fdc..6ffe9ded 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -5884,7 +5884,7 @@ class WebInterface(object): status = {'result': 'success', 'message': 'Ok'} if args or kwargs: - if not cherrypy.request.path_info == '/api/v2': + if not cherrypy.request.path_info == '/api/v2' and plexpy.AUTH_ENABLED: cherrypy.request.config['auth.require'] = [] check_auth() diff --git a/plexpy/webstart.py b/plexpy/webstart.py index 685d2efc..0d8281ea 100644 --- a/plexpy/webstart.py +++ b/plexpy/webstart.py @@ -80,14 +80,15 @@ def initialize(options): logger.info(u"Tautulli WebStart :: Web server authentication is enabled: %s.", ' and '.join(login_allowed)) if options['http_basic_auth']: - auth_enabled = False + plexpy.AUTH_ENABLED = False basic_auth_enabled = True else: - auth_enabled = True + plexpy.AUTH_ENABLED = True basic_auth_enabled = False cherrypy.tools.auth = cherrypy.Tool('before_handler', webauth.check_auth, priority=2) else: - auth_enabled = basic_auth_enabled = False + plexpy.AUTH_ENABLED = False + basic_auth_enabled = False if options['http_root'].strip('/'): plexpy.HTTP_ROOT = options['http_root'] = '/' + options['http_root'].strip('/') + '/' @@ -104,7 +105,7 @@ def initialize(options): 'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css', 'text/javascript', 'application/json', 'application/javascript'], - 'tools.auth.on': auth_enabled, + 'tools.auth.on': plexpy.AUTH_ENABLED, 'tools.auth_basic.on': basic_auth_enabled, 'tools.auth_basic.realm': 'Tautulli web server', 'tools.auth_basic.checkpassword': cherrypy.lib.auth_basic.checkpassword_dict({