(beta)
+BinderHub
+This website is powered by BinderHub v{{ binder_version }}. +
++ {{ message | safe }} +
+diff --git a/binderhub/app.py b/binderhub/app.py index d9ce71cff..933576468 100644 --- a/binderhub/app.py +++ b/binderhub/app.py @@ -25,7 +25,7 @@ from traitlets.config import Application from jupyterhub.services.auth import HubOAuthCallbackHandler -from .base import Custom404 +from .base import AboutHandler, Custom404 from .build import Build from .builder import BuildHandler from .launcher import Launcher @@ -94,6 +94,17 @@ def _log_level(self): config=True ) + about_message = Unicode( + '', + help=""" + Additional message to display on the about page. + + Will be directly inserted into the about page's source so you can use + raw HTML. + """, + config=True + ) + extra_footer_scripts = Dict( {}, help=""" @@ -123,8 +134,8 @@ def _valid_base_url(self, proposal): auth_enabled = Bool( False, - help="""If JupyterHub authentication enabled, - require user to login (don't create temporary users during launch) and + help="""If JupyterHub authentication enabled, + require user to login (don't create temporary users during launch) and start the new server for the logged in user.""", config=True) @@ -489,6 +500,7 @@ def initialize(self, *args, **kwargs): 'traitlets_config': self.config, 'google_analytics_code': self.google_analytics_code, 'google_analytics_domain': self.google_analytics_domain, + 'about_message': self.about_message, 'extra_footer_scripts': self.extra_footer_scripts, 'jinja2_env': jinja_env, 'build_memory_limit': self.build_memory_limit, @@ -533,6 +545,7 @@ def initialize(self, *args, **kwargs): (r'/(favicon\_building\.ico)', tornado.web.StaticFileHandler, {'path': os.path.join(self.tornado_settings['static_path'], 'images')}), + (r'/about', AboutHandler), (r'/', MainHandler), (r'.*', Custom404), ] diff --git a/binderhub/base.py b/binderhub/base.py index 37664c876..557ea0df6 100644 --- a/binderhub/base.py +++ b/binderhub/base.py @@ -4,6 +4,8 @@ from tornado import web from jupyterhub.services.auth import HubOAuthenticated, HubOAuth +from ._version import __version__ as binder_version + class BaseHandler(HubOAuthenticated, web.RequestHandler): """HubAuthenticated by default allows all successfully identified users (see allow_all property).""" @@ -87,3 +89,18 @@ class Custom404(BaseHandler): def prepare(self): raise web.HTTPError(404) + + +class AboutHandler(BaseHandler): + """Serve the about page""" + async def get(self): + self.render_template( + "about.html", + base_url=self.settings['base_url'], + submit=False, + binder_version=binder_version, + message=self.settings['about_message'], + google_analytics_code=self.settings['google_analytics_code'], + google_analytics_domain=self.settings['google_analytics_domain'], + extra_footer_scripts=self.settings['extra_footer_scripts'], + ) diff --git a/binderhub/templates/about.html b/binderhub/templates/about.html new file mode 100644 index 000000000..2f7c8ef32 --- /dev/null +++ b/binderhub/templates/about.html @@ -0,0 +1,27 @@ +{% extends "page.html" %} + + +{% block main %} +
This website is powered by BinderHub v{{ binder_version }}. +
++ {{ message | safe }} +
+