mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 14:33:00 +00:00
Merge pull request #1854 from summerswallow-whi/extra_handler
Add custom handlers and allow setting of defaults
This commit is contained in:
@@ -937,6 +937,9 @@ class JupyterHub(Application):
|
||||
handlers[i] = tuple(lis)
|
||||
return handlers
|
||||
|
||||
extra_handlers = List(help="Register extra page handlers for jupyterhub, should be of the form (<regex>,handler)").tag(config=True)
|
||||
default_url = Any(default_value=None, help='specify default URL for "next_url" (e.g. when user directs to "/"').tag(config=True)
|
||||
|
||||
def init_handlers(self):
|
||||
h = []
|
||||
# load handlers from the authenticator
|
||||
@@ -945,6 +948,9 @@ class JupyterHub(Application):
|
||||
h.extend(handlers.default_handlers)
|
||||
h.extend(apihandlers.default_handlers)
|
||||
|
||||
# add any user configurable handlers.
|
||||
h.extend(self.extra_handlers)
|
||||
|
||||
h.append((r'/logo', LogoHandler, {'path': self.logo_file}))
|
||||
self.handlers = self.add_url_prefix(self.hub_prefix, h)
|
||||
# some extra handlers, outside hub_prefix
|
||||
|
@@ -428,6 +428,8 @@ class BaseHandler(RequestHandler):
|
||||
self.log.warning("Redirecting %s to %s. For sharing public links, use /user-redirect/",
|
||||
self.request.uri, next_url,
|
||||
)
|
||||
if not next_url and self.config.JupyterHub.get('default_url'):
|
||||
next_url = self.config.JupyterHub['default_url']
|
||||
|
||||
if not next_url:
|
||||
# default URL after login
|
||||
|
Reference in New Issue
Block a user