Fix unable to view database status when auth is disabled

This commit is contained in:
JonnyWong16 2019-06-13 21:57:05 -07:00
parent 13579b8140
commit e4be5a716f
3 changed files with 8 additions and 5 deletions

View file

@ -100,6 +100,7 @@ UMASK = None
HTTP_PORT = None HTTP_PORT = None
HTTP_ROOT = None HTTP_ROOT = None
AUTH_ENABLED = None
DEV = False DEV = False
@ -114,6 +115,7 @@ WIN_SYS_TRAY_ICON = None
SYS_TIMEZONE = None SYS_TIMEZONE = None
SYS_UTC_OFFSET = None SYS_UTC_OFFSET = None
def initialize(config_file): def initialize(config_file):
with INIT_LOCK: with INIT_LOCK:

View file

@ -5884,7 +5884,7 @@ class WebInterface(object):
status = {'result': 'success', 'message': 'Ok'} status = {'result': 'success', 'message': 'Ok'}
if args or kwargs: 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'] = [] cherrypy.request.config['auth.require'] = []
check_auth() check_auth()

View file

@ -80,14 +80,15 @@ def initialize(options):
logger.info(u"Tautulli WebStart :: Web server authentication is enabled: %s.", ' and '.join(login_allowed)) logger.info(u"Tautulli WebStart :: Web server authentication is enabled: %s.", ' and '.join(login_allowed))
if options['http_basic_auth']: if options['http_basic_auth']:
auth_enabled = False plexpy.AUTH_ENABLED = False
basic_auth_enabled = True basic_auth_enabled = True
else: else:
auth_enabled = True plexpy.AUTH_ENABLED = True
basic_auth_enabled = False basic_auth_enabled = False
cherrypy.tools.auth = cherrypy.Tool('before_handler', webauth.check_auth, priority=2) cherrypy.tools.auth = cherrypy.Tool('before_handler', webauth.check_auth, priority=2)
else: else:
auth_enabled = basic_auth_enabled = False plexpy.AUTH_ENABLED = False
basic_auth_enabled = False
if options['http_root'].strip('/'): if options['http_root'].strip('/'):
plexpy.HTTP_ROOT = options['http_root'] = '/' + 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', 'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css',
'text/javascript', 'application/json', 'text/javascript', 'application/json',
'application/javascript'], 'application/javascript'],
'tools.auth.on': auth_enabled, 'tools.auth.on': plexpy.AUTH_ENABLED,
'tools.auth_basic.on': basic_auth_enabled, 'tools.auth_basic.on': basic_auth_enabled,
'tools.auth_basic.realm': 'Tautulli web server', 'tools.auth_basic.realm': 'Tautulli web server',
'tools.auth_basic.checkpassword': cherrypy.lib.auth_basic.checkpassword_dict({ 'tools.auth_basic.checkpassword': cherrypy.lib.auth_basic.checkpassword_dict({