diff --git a/sickbeard/logger.py b/sickbeard/logger.py index 4abbfdea..8c8b6f16 100644 --- a/sickbeard/logger.py +++ b/sickbeard/logger.py @@ -178,11 +178,14 @@ class Logger(object): issue = self.gh_issues.create_issue(title + curError.title, message) if issue: - ui.notifications.message('Your issue ticket #%s was submitted successfully!' % issue.number) - classes.ErrorViewer.clear() + self.log('Your issue ticket #%s was submitted successfully!' % issue.number) + if not sickbeard.GIT_AUTOISSUES: + ui.notifications.message('Your issue ticket #%s was submitted successfully!' % issue.number) + + classes.ErrorViewer.clear() except Exception as e: - self.log(sickbeard.exceptions.ex(e), logger.ERROR) + pass class Wrapper(object): diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index fbf41c22..97b85657 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -159,7 +159,7 @@ class BaseHandler(RequestHandler): url = url[len(sickbeard.WEB_ROOT) + 1:] if url[:3] != 'api': - return self.redirect(url) + return self.redirect('/') else: self.finish('Wrong API key used') @@ -209,13 +209,13 @@ class WebHandler(BaseHandler): def get(self, route, *args, **kwargs): try: # route -> method obj - route = route.strip('/').replace('.', '_') - method = getattr(self, route, self.index) + route = route.strip('/').replace('.', '_') or 'index' + method = getattr(self, route) # process request async self.async_call(method, callback=self.async_done) except: - logger.log('Failed doing webui request "%s": %s' % (route, traceback.format_exc()), logger.ERROR) + logger.log('Failed doing webui request "%s": %s' % (route, traceback.format_exc()), logger.DEBUG) raise HTTPError(404) @run_on_executor @@ -231,8 +231,7 @@ class WebHandler(BaseHandler): callback(result) return result except: - logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.ERROR) - raise + logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.DEBUG) def async_done(self, results): try: @@ -247,9 +246,6 @@ class WebHandler(BaseHandler): class LoginHandler(BaseHandler): - def __init__(self, *args, **kwargs): - super(LoginHandler, self).__init__(*args, **kwargs) - def get(self, *args, **kwargs): if self.get_current_user(): self.redirect('/home/') @@ -276,15 +272,11 @@ class LoginHandler(BaseHandler): class LogoutHandler(BaseHandler): - def __init__(self, *args, **kwargs): - super(LogoutHandler, self).__init__(*args, **kwargs) - def get(self, *args, **kwargs): self.clear_cookie("user") self.redirect('/login/') - -class KeyHandler(BaseHandler): +class KeyHandler(RequestHandler): def __init__(self, *args, **kwargs): super(KeyHandler, self).__init__(*args, **kwargs) diff --git a/sickbeard/webserveInit.py b/sickbeard/webserveInit.py index a88cd871..2192233a 100644 --- a/sickbeard/webserveInit.py +++ b/sickbeard/webserveInit.py @@ -72,7 +72,7 @@ class SRWebServer(threading.Thread): gzip=True, xheaders=sickbeard.HANDLE_REVERSE_PROXY, cookie_secret='61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=', - login_url='/login/', + login_url='%s/login/' % self.options['web_root'], ) # Main Handlers @@ -87,11 +87,8 @@ class SRWebServer(threading.Thread): (r'%s/api/builder' % self.options['web_root'], RedirectHandler, {"url": self.options['web_root'] + '/apibuilder/'}), # webui login/logout handlers - (r'%s/login(/?.*)' % self.options['web_root'], LoginHandler), - (r'%s/logout(/?.*)' % self.options['web_root'], LogoutHandler), - - # webui redirect - (r'/', RedirectHandler, {"url": self.options['web_root'] + '/home/'}), + (r'%s/login(/?)' % self.options['web_root'], LoginHandler), + (r'%s/logout(/?)' % self.options['web_root'], LogoutHandler), # webui handlers ] + route.get_routes(self.options['web_root']))