diff --git a/Tautulli.py b/Tautulli.py index bc8c9385..8bfd54f3 100755 --- a/Tautulli.py +++ b/Tautulli.py @@ -263,6 +263,8 @@ def main(): plexpy.shutdown(restart=True) elif plexpy.SIGNAL == 'checkout': plexpy.shutdown(restart=True, checkout=True) + elif plexpy.SIGNAL == 'reset': + plexpy.shutdown(restart=True, reset=True) else: plexpy.shutdown(restart=True, update=True) diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 3b04ae59..156ab05c 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -2170,11 +2170,14 @@ $(document).ready(function() { $("#reset_git_install").click(function () { var msg = 'Are you sure you want to reset your Tautulli installtion?'; - var url = 'reset_git_install'; - confirmAjaxCall(url, msg); + $('#confirm-message').html(msg); + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-button', function () { + settingsChanged = false; + window.location.href = 'reset_git_install'; + }); }); - $('#api_key').click(function(){ $('#api_key').select() }); $("#generate_api").click(function() { $.get('generate_api_key', diff --git a/plexpy/__init__.py b/plexpy/__init__.py index ff13280d..8dbb31ae 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -2077,7 +2077,7 @@ def upgrade(): libraries.update_libraries_db_notify() -def shutdown(restart=False, update=False, checkout=False): +def shutdown(restart=False, update=False, checkout=False, reset=False): webstart.stop() # Shutdown the websocket connection @@ -2112,6 +2112,13 @@ def shutdown(restart=False, update=False, checkout=False): except Exception as e: logger.warn(u"Tautulli failed to switch git branch: %s. Restarting." % e) + if reset: + logger.info(u"Tautulli is resetting the git install...") + try: + versioncheck.reset_git_install() + except Exception as e: + logger.warn(u"Tautulli failed to reset git install: %s. Restarting." % e) + if CREATEPID: logger.info(u"Removing pidfile %s", PIDFILE) os.remove(PIDFILE) diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py index ee7dce85..9638ed79 100644 --- a/plexpy/versioncheck.py +++ b/plexpy/versioncheck.py @@ -328,7 +328,7 @@ def update(): return -def reset(): +def reset_git_install(): if plexpy.INSTALL_TYPE == 'git': logger.info('Attempting to reset git install to "%s/%s"' % (plexpy.CONFIG.GIT_REMOTE, plexpy.CONFIG.GIT_BRANCH)) output, err = runGit('remote set-url {} https://github.com/{}/{}.git'.format(plexpy.CONFIG.GIT_REMOTE, diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 814cb720..45e84604 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -3920,16 +3920,9 @@ class WebInterface(object): return self.do_state_change('checkout', 'Switching Git Branches', 120) @cherrypy.expose - @cherrypy.tools.json_out() @requireAuth(member_of("admin")) def reset_git_install(self, **kwargs): - result = versioncheck.reset() - - if result: - return {'result': 'success', 'message': 'Tautulli installation reset.'} - else: - return {'result': 'error', 'message': 'Reset installation failed.'} - + return self.do_state_change('reset', 'Resetting Git Install', 120) @cherrypy.expose @requireAuth(member_of("admin"))