diff --git a/jupyter_server/base/handlers.py b/jupyter_server/base/handlers.py index 314d5852e8..3a31a6be30 100755 --- a/jupyter_server/base/handlers.py +++ b/jupyter_server/base/handlers.py @@ -788,6 +788,16 @@ def get(self): post = put = get +class MainHandler(JupyterHandler): + """Simple handler for base_url.""" + + def get(self): + html = self.render_template("main.html") + self.write(html) + + post = put = get + + class FilesRedirectHandler(JupyterHandler): """Handler for redirecting relative URLs to the /files/ handler""" @@ -859,6 +869,7 @@ def get(self): default_handlers = [ (r".*/", TrailingSlashHandler), + (r"/", MainHandler), (r"api", APIVersionHandler), (r'/(robots\.txt|favicon\.ico)', web.StaticFileHandler), (r'/metrics', PrometheusMetricsHandler) diff --git a/jupyter_server/static/favicon.ico b/jupyter_server/static/favicon.ico new file mode 100644 index 0000000000..2d1bcff7ca Binary files /dev/null and b/jupyter_server/static/favicon.ico differ diff --git a/jupyter_server/templates/edit.html b/jupyter_server/templates/edit.html deleted file mode 100644 index 5ef9eecc74..0000000000 --- a/jupyter_server/templates/edit.html +++ /dev/null @@ -1,103 +0,0 @@ -{% extends "page.html" %} - -{% block title %}{{page_title}}{% endblock %} - -{% block favicon %}{% endblock %} - -{% block stylesheet %} - - -{{super()}} -{% endblock %} - -{% block bodyclasses %}edit_app {{super()}}{% endblock %} - -{% block params %} -data-base-url="{{base_url | urlencode}}" -data-file-path="{{file_path}}" -{{super()}} -{% endblock %} - -{% block headercontainer %} - - - - - - -{% endblock %} - -{% block header %} - - - -
- -{% endblock %} - -{% block site %} - -
-
-
- -{% endblock %} - -{% block script %} - - {{super()}} - - -{% endblock %} diff --git a/jupyter_server/templates/error.html b/jupyter_server/templates/error.html index 694e64f97a..1e3fae6225 100644 --- a/jupyter_server/templates/error.html +++ b/jupyter_server/templates/error.html @@ -1,23 +1,12 @@ {% extends "page.html" %} -{% block login_widget %} -{% endblock %} - -{% block stylesheet %} -{{super()}} - -{% endblock %} {% block site %}
{% block h1_error %}

{{status_code}} : {{status_message}}

{% endblock h1_error %} + {% block error_detail %} {% if message %}

{% trans %}The error was:{% endtrans %}

@@ -25,18 +14,8 @@

{{status_code}} : {{status_message}}

{{message}}
{% endif %} - {% endblock %} + {% endblock error_detail %} {% endblock %} -{% block script %} -{{super()}} - -{% endblock script %} diff --git a/jupyter_server/templates/login.html b/jupyter_server/templates/login.html deleted file mode 100644 index 77273a9cf4..0000000000 --- a/jupyter_server/templates/login.html +++ /dev/null @@ -1,125 +0,0 @@ -{% extends "page.html" %} - - -{% block stylesheet %} -{{super()}} - -{% endblock %} - -{% block login_widget %} -{% endblock %} - -{% block site %} - -
- - {% if login_available %} - {# login_available means password-login is allowed. Show the form. #} -
- -
- {% else %} -

{% trans %}No login available, you shouldn't be seeing this page.{% endtrans %}

- {% endif %} - {% if message %} -
- {% for key in message %} -
- {{message[key]}} -
- {% endfor %} -
- {% endif %} - {% if token_available %} - {% block token_message %} -
-

- Token authentication is enabled -

-

- If no password has been configured, you need to open the notebook - server with its login token in the URL, or paste it above. - This requirement will be lifted if you - - enable a password. -

-

- The command: -

jupyter notebook list
- will show you the URLs of running servers with their tokens, - which you can copy and paste into your browser. For example: -

-
Currently running servers:
-http://localhost:8888/?token=c8de56fa... :: /Users/you/notebooks
-
-

- or you can paste just the token value into the password field on this - page. -

-

- See - - the documentation on how to enable a password - - in place of token authentication, - if you would like to avoid dealing with random tokens. -

-

- Cookies are required for authenticated access to notebooks. -

- {% if allow_password_change %} -

{% trans %}Setup a Password{% endtrans %}

-

You can also setup a password by entering your token and a new password - on the fields below:

-
- {{ xsrf_form_html() | safe }} -
- - -
-
- - -
-
- -
-
- {% endif %} - -
- {% endblock token_message %} - {% endif %} -
- -{% endblock %} - - -{% block script %} -{{super()}} - - - -{% endblock %} diff --git a/jupyter_server/templates/logout.html b/jupyter_server/templates/logout.html deleted file mode 100644 index 3a58875c22..0000000000 --- a/jupyter_server/templates/logout.html +++ /dev/null @@ -1,50 +0,0 @@ -{% extends "page.html" %} - -{# This template is rendered in response to an authenticated request, so the - user is technically logged in. But when the user sees it, the cookie is - cleared by the Javascript, so we should render this as if the user was logged - out, without e.g. authentication tokens. -#} -{% set logged_in = False %} - -{% block stylesheet %} -{{super()}} - -{% endblock %} - -{% block login_widget %} -{% endblock %} - -{% block site %} - -
- - {% if message %} - {% for key in message %} -
- {{message[key]}} -
- {% endfor %} - {% endif %} - - {% if not login_available %} - {% trans %}Proceed to the dashboard{% endtrans %}. - {% else %} - {% trans %}Proceed to the login page{% endtrans %}. - {% endif %} - - -
- -{% endblock %} - -{% block script %} -{{super()}} - - - -{% endblock %} diff --git a/jupyter_server/templates/main.html b/jupyter_server/templates/main.html new file mode 100644 index 0000000000..98b72e9fee --- /dev/null +++ b/jupyter_server/templates/main.html @@ -0,0 +1,5 @@ +{% extends "page.html" %} + +{% block site %} +

A Jupyter Server is running.

+{% endblock site %} \ No newline at end of file diff --git a/jupyter_server/templates/notebook.html b/jupyter_server/templates/notebook.html deleted file mode 100644 index 4dbc4c3cc4..0000000000 --- a/jupyter_server/templates/notebook.html +++ /dev/null @@ -1,381 +0,0 @@ -{% extends "page.html" %} - -{% block favicon %}{% endblock %} - -{% block stylesheet %} - -{% if mathjax_url %} - -{% endif %} - - - - - -{{super()}} - - - - -{% endblock %} - -{% block bodyclasses %}notebook_app {{super()}}{% endblock %} - -{% block params %} - -{{super()}} -data-base-url="{{base_url | urlencode}}" -data-ws-url="{{ws_url | urlencode}}" -data-notebook-name="{{notebook_name | urlencode}}" -data-notebook-path="{{notebook_path | urlencode}}" -{% endblock %} - - -{% block headercontainer %} - - - - - - - - - - {% block kernel_logo_widget %} - - {% endblock %} - - -{% endblock headercontainer %} - -{% block header %} - - -
-{% endblock header %} - -{% block site %} - -
-
-
- -
-
- - -{% endblock %} - -{% block after_site %} - -
-
-
-
-
-
- -{% endblock %} - -{% block script %} -{{super()}} - - - - - - -{% endblock %} diff --git a/jupyter_server/templates/page.html b/jupyter_server/templates/page.html index 37bd992481..ff00411354 100644 --- a/jupyter_server/templates/page.html +++ b/jupyter_server/templates/page.html @@ -2,195 +2,29 @@ + - {% block title %}Jupyter Notebook{% endblock %} - {% block favicon %}{% endblock %} + {% block title %}Jupyter Server{% endblock %} + {% block favicon %}{% endblock %} - - - - {% block stylesheet %} - - {% endblock %} - - - - - - - {% block meta %} {% endblock %} - + - - - - -