Remove tokens from downloaded config

This commit is contained in:
JonnyWong16 2022-01-15 16:14:20 -08:00
parent ce0cdf9ce6
commit c35cbb06e2
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -4838,13 +4838,24 @@ class WebInterface(object):
def download_config(self, **kwargs):
""" Download the Tautulli configuration file. """
config_file = config.FILENAME
config_copy = os.path.join(plexpy.CONFIG.CACHE_DIR, config_file)
try:
plexpy.CONFIG.write()
shutil.copyfile(plexpy.CONFIG_FILE, config_copy)
except:
pass
return serve_download(plexpy.CONFIG_FILE, name=config_file)
try:
cfg = config.Config(config_copy)
cfg.PMS_TOKEN = ''
cfg.JWT_SECRET = ''
cfg.write()
except:
cherrypy.response.status = 500
return 'Error downloading config. Check the logs.'
return serve_download(config_copy, name=config_file)
@cherrypy.expose
@requireAuth(member_of("admin"))