Skip to content

Commit

Permalink
Remove forward-user-info, query-user-info and remains of `present…
Browse files Browse the repository at this point in the history
…ation-path`
  • Loading branch information
jwindgassen committed Sep 12, 2024
1 parent 0878fd0 commit 24b5864
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 82 deletions.
16 changes: 0 additions & 16 deletions jupyter_server_proxy/standalone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def run(
request_timeout=300,
last_activity_interval=300,
force_alive=True,
forward_user_info=False,
query_user_info=False,
progressive=False,
websocket_max_message_size=0,
):
Expand All @@ -54,8 +52,6 @@ def run(
request_timeout,
debug,
logs,
forward_user_info,
query_user_info,
progressive,
websocket_max_message_size,
)
Expand Down Expand Up @@ -132,18 +128,6 @@ def main():
default=True,
help="Always report, that there has been activity (force keep alive) - only if last-activity-interval > 0.",
)
parser.add_argument(
"--forward-user-info",
action="store_true",
default=False,
help="Forward a 'X-CDSDASHBOARDS-JH-USER' HTTP header to process containing JupyterHub user data.",
)
parser.add_argument(
"--query-user-info",
action="store_true",
default=False,
help="Add a 'CDSDASHBOARDS_JH_USER GET' query arg in HTTP request to process containing JupyterHub user data.",
)
parser.add_argument(
"--progressive",
action="store_true",
Expand Down
68 changes: 2 additions & 66 deletions jupyter_server_proxy/standalone/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,60 +54,11 @@ def process_args(self):
return {
"port": self.port,
"base_url": self.base_url,
# "presentation_path": self.presentation_path,
# "presentation_basename": self.presentation_basename,
# "presentation_dirname": self.presentation_dirname,
"origin_host": self.request.host, # ToDo!
"-": "-",
"--": "--",
}

@property
def base_url(self):
return self.settings.get("base_url", "/")

# @property
# def presentation_path(self):
# return self.settings.get("presentation_path", ".")
#
# @property
# def presentation_basename(self):
# return self.settings.get("presentation_basename", "")
#
# @property
# def presentation_dirname(self):
# return self.settings.get("presentation_dirname", ".")

@property
def hub_users(self):
return {self.settings["user"]}

@property
def hub_groups(self):
if self.settings["group"]:
return {self.settings["group"]}
return set()

@property
def allow_all(self):
if "anyone" in self.settings:
return self.settings["anyone"] == "1"
return super().allow_all

def _render_template(self, value):
args = self.process_args
if type(value) is str:
return value.format(**args)
elif type(value) is list:
return [self._render_template(v) for v in value]
elif type(value) is dict:
return {
self._render_template(k): self._render_template(v)
for k, v in value.items()
}
else:
raise ValueError(f"Value of unrecognized type {type(value)}")

def get_env(self):
if callable(environment):
raise Exception(
Expand Down Expand Up @@ -142,21 +93,9 @@ def make_app(
request_timeout,
debug,
logs,
forward_user_info,
query_user_info,
progressive,
websocket_max_message_size,
):
# ToDo: Presentation_path?
# presentation_basename = ""
# presentation_dirname = ""
#
# if presentation_path:
# if not os.path.isabs(presentation_path):
# presentation_path = os.path.join(os.getcwd(), presentation_path)
# presentation_basename = os.path.basename(presentation_path)
# presentation_dirname = os.path.dirname(presentation_path)

patch_default_headers()

proxy_handler = _make_native_proxy_handler(command, {}, destport, {})
Expand All @@ -169,9 +108,6 @@ def make_app(
group=os.environ.get("JUPYTERHUB_GROUP") or "",
anyone=os.environ.get("JUPYTERHUB_ANYONE") or "",
base_url=prefix, # This is a confusing name, sorry
# presentation_path=presentation_path,
# presentation_basename=presentation_basename,
# presentation_dirname=presentation_dirname,
request_timeout=request_timeout,
)

Expand All @@ -189,7 +125,7 @@ def make_app(
proxy_handler,
dict(
state={},
# ToDo: authtype=authtype, forward_user_info=forward_user_info, query_user_info=query_user_info, progressive=progressive
# ToDo: authtype=authtype, progressive=progressive
),
),
(
Expand Down Expand Up @@ -260,7 +196,7 @@ def start_keep_alive(last_activity_interval, force_alive, settings):
print(
"The following env vars are required to report activity back to the hub for keep alive: "
"JUPYTERHUB_ACTIVITY_URL ({}), JUPYTERHUB_SERVER_NAME({})".format(
hub_activity_url, server_name, api_token
hub_activity_url, server_name
)
)
return
Expand Down

0 comments on commit 24b5864

Please sign in to comment.