mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-06 03:18:01 -05:00
Possible fix for sickragetv/sickrage-issues#180 - redirect loop
This commit is contained in:
parent
2785abe8a4
commit
120ea961f2
@ -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):
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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']))
|
||||
|
Loading…
Reference in New Issue
Block a user