Add config import to settings page

This commit is contained in:
JonnyWong16 2020-07-15 23:51:48 -07:00
parent 06665fdd06
commit 3043956dec
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
4 changed files with 213 additions and 10 deletions

View file

@ -3876,9 +3876,8 @@ class WebInterface(object):
if not config_path:
return {'result': 'error', 'message': 'No config specified for import'}
threading.Thread(target=config.import_tautulli_config,
kwargs={'config': config_path,
'backup': helpers.bool_true(backup)}).start()
config.set_import_thread(config=config_path, backup=helpers.bool_true(backup))
return {'result': 'success',
'message': 'Config import has started. Check the logs to monitor any problems. '
'Tautulli will restart automatically.'}
@ -3896,6 +3895,11 @@ class WebInterface(object):
logger.warn("No app specified for import.")
return
@cherrypy.expose
@requireAuth(member_of("admin"))
def import_config_tool(self, **kwargs):
return serve_template(templatename="config_import.html", title="Import Tautulli Config")
@cherrypy.expose
@cherrypy.tools.json_out()
@requireAuth(member_of("admin"))
@ -4158,7 +4162,8 @@ class WebInterface(object):
def do_state_change(self, signal, title, timer, **kwargs):
message = title
quote = self.random_arnold_quotes()
plexpy.SIGNAL = signal
if signal:
plexpy.SIGNAL = signal
if plexpy.CONFIG.HTTP_ROOT.strip('/'):
new_http_root = '/' + plexpy.CONFIG.HTTP_ROOT.strip('/') + '/'
@ -4207,6 +4212,13 @@ class WebInterface(object):
def reset_git_install(self, **kwargs):
return self.do_state_change('reset', 'Resetting to {}'.format(common.RELEASE), 120)
@cherrypy.expose
@requireAuth(member_of("admin"))
def restart_import_config(self, **kwargs):
if config.IMPORT_THREAD:
config.IMPORT_THREAD.start()
return self.do_state_change(None, 'Importing a Config', 15)
@cherrypy.expose
@requireAuth(member_of("admin"))
def get_changelog(self, latest_only=False, since_prev_release=False, update_shown=False, **kwargs):