diff --git a/jupyterhub_announcement/announcement.py b/jupyterhub_announcement/announcement.py index add135b..4a189a0 100644 --- a/jupyterhub_announcement/announcement.py +++ b/jupyterhub_announcement/announcement.py @@ -161,6 +161,7 @@ def initialize(self, argv=None): queue=self.queue, fixed_message=self.fixed_message, loader=loader, + service_prefix=self.service_prefix, ), "view", ), diff --git a/jupyterhub_announcement/handlers.py b/jupyterhub_announcement/handlers.py index d1834cf..940269f 100644 --- a/jupyterhub_announcement/handlers.py +++ b/jupyterhub_announcement/handlers.py @@ -23,18 +23,20 @@ def log(self): class AnnouncementViewHandler(AnnouncementHandler): """View announcements page""" - def initialize(self, queue, fixed_message, loader): + def initialize(self, queue, fixed_message, loader, service_prefix): super().initialize(queue) self.fixed_message = fixed_message self.loader = loader self.env = Environment(loader=self.loader) self.template = self.env.get_template("index.html") + self.service_prefix = service_prefix @web.authenticated def get(self): user = self.get_current_user() prefix = self.hub_auth.hub_prefix logout_url = url_path_join(prefix, "logout") + update_url = url_path_join(self.service_prefix, "update") self.write( self.template.render( user=user, @@ -47,6 +49,7 @@ def get(self): no_spawner_check=True, parsed_scopes=user.get("hub_scopes") or [], xsrf_form_html=self.xsrf_form_html, + update_url=update_url, ) ) diff --git a/templates/index.html b/templates/index.html index d23319c..92ea6d3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -14,7 +14,7 @@ {% if user.admin %}
-
+ {{ xsrf_form_html() | safe }}