Skip to content

Use base_url so that the extension works in a JupyterHub setting. #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions jupyterlab_github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from notebook.utils import url_path_join, url_escape
from notebook.base.handlers import APIHandler

path_regex = r'(?P<path>(?:(?:/[^/]+)+|/?))'
link_regex = re.compile(r'<([^>]*)>;\s*rel="([\w]*)\"')
GITHUB_API = 'https://api.github.com'

Expand Down Expand Up @@ -100,5 +99,7 @@ def load_jupyter_server_extension(nb_server_app):
nb_server_app (NotebookWebApplication): handle to the Notebook webserver instance.
"""
web_app = nb_server_app.web_app
host_pattern = '.*$'
web_app.add_handlers(host_pattern, [(r'/github%s' % path_regex, GitHubHandler)])
base_url = web_app.settings['base_url']
endpoint = url_path_join(base_url, 'github')
handlers = [(endpoint + "(.*)", GitHubHandler)]
web_app.add_handlers('.*$', handlers)