mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 11:58: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)
|
issue = self.gh_issues.create_issue(title + curError.title, message)
|
||||||
if issue:
|
if issue:
|
||||||
ui.notifications.message('Your issue ticket #%s was submitted successfully!' % issue.number)
|
self.log('Your issue ticket #%s was submitted successfully!' % issue.number)
|
||||||
classes.ErrorViewer.clear()
|
|
||||||
|
|
||||||
|
if not sickbeard.GIT_AUTOISSUES:
|
||||||
|
ui.notifications.message('Your issue ticket #%s was submitted successfully!' % issue.number)
|
||||||
|
|
||||||
|
classes.ErrorViewer.clear()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log(sickbeard.exceptions.ex(e), logger.ERROR)
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Wrapper(object):
|
class Wrapper(object):
|
||||||
|
@ -159,7 +159,7 @@ class BaseHandler(RequestHandler):
|
|||||||
url = url[len(sickbeard.WEB_ROOT) + 1:]
|
url = url[len(sickbeard.WEB_ROOT) + 1:]
|
||||||
|
|
||||||
if url[:3] != 'api':
|
if url[:3] != 'api':
|
||||||
return self.redirect(url)
|
return self.redirect('/')
|
||||||
else:
|
else:
|
||||||
self.finish('Wrong API key used')
|
self.finish('Wrong API key used')
|
||||||
|
|
||||||
@ -209,13 +209,13 @@ class WebHandler(BaseHandler):
|
|||||||
def get(self, route, *args, **kwargs):
|
def get(self, route, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
# route -> method obj
|
# route -> method obj
|
||||||
route = route.strip('/').replace('.', '_')
|
route = route.strip('/').replace('.', '_') or 'index'
|
||||||
method = getattr(self, route, self.index)
|
method = getattr(self, route)
|
||||||
|
|
||||||
# process request async
|
# process request async
|
||||||
self.async_call(method, callback=self.async_done)
|
self.async_call(method, callback=self.async_done)
|
||||||
except:
|
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)
|
raise HTTPError(404)
|
||||||
|
|
||||||
@run_on_executor
|
@run_on_executor
|
||||||
@ -231,8 +231,7 @@ class WebHandler(BaseHandler):
|
|||||||
callback(result)
|
callback(result)
|
||||||
return result
|
return result
|
||||||
except:
|
except:
|
||||||
logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.ERROR)
|
logger.log('Failed doing webui callback: %s' % (traceback.format_exc()), logger.DEBUG)
|
||||||
raise
|
|
||||||
|
|
||||||
def async_done(self, results):
|
def async_done(self, results):
|
||||||
try:
|
try:
|
||||||
@ -247,9 +246,6 @@ class WebHandler(BaseHandler):
|
|||||||
|
|
||||||
|
|
||||||
class LoginHandler(BaseHandler):
|
class LoginHandler(BaseHandler):
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(LoginHandler, self).__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
if self.get_current_user():
|
if self.get_current_user():
|
||||||
self.redirect('/home/')
|
self.redirect('/home/')
|
||||||
@ -276,15 +272,11 @@ class LoginHandler(BaseHandler):
|
|||||||
|
|
||||||
|
|
||||||
class LogoutHandler(BaseHandler):
|
class LogoutHandler(BaseHandler):
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(LogoutHandler, self).__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
self.clear_cookie("user")
|
self.clear_cookie("user")
|
||||||
self.redirect('/login/')
|
self.redirect('/login/')
|
||||||
|
|
||||||
|
class KeyHandler(RequestHandler):
|
||||||
class KeyHandler(BaseHandler):
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(KeyHandler, self).__init__(*args, **kwargs)
|
super(KeyHandler, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class SRWebServer(threading.Thread):
|
|||||||
gzip=True,
|
gzip=True,
|
||||||
xheaders=sickbeard.HANDLE_REVERSE_PROXY,
|
xheaders=sickbeard.HANDLE_REVERSE_PROXY,
|
||||||
cookie_secret='61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=',
|
cookie_secret='61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=',
|
||||||
login_url='/login/',
|
login_url='%s/login/' % self.options['web_root'],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Main Handlers
|
# 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/'}),
|
(r'%s/api/builder' % self.options['web_root'], RedirectHandler, {"url": self.options['web_root'] + '/apibuilder/'}),
|
||||||
|
|
||||||
# webui login/logout handlers
|
# webui login/logout handlers
|
||||||
(r'%s/login(/?.*)' % self.options['web_root'], LoginHandler),
|
(r'%s/login(/?)' % self.options['web_root'], LoginHandler),
|
||||||
(r'%s/logout(/?.*)' % self.options['web_root'], LogoutHandler),
|
(r'%s/logout(/?)' % self.options['web_root'], LogoutHandler),
|
||||||
|
|
||||||
# webui redirect
|
|
||||||
(r'/', RedirectHandler, {"url": self.options['web_root'] + '/home/'}),
|
|
||||||
|
|
||||||
# webui handlers
|
# webui handlers
|
||||||
] + route.get_routes(self.options['web_root']))
|
] + route.get_routes(self.options['web_root']))
|
||||||
|
Loading…
Reference in New Issue
Block a user