From fa526eba026410e7bdd38cbad086a48f4b121024 Mon Sep 17 00:00:00 2001 From: Kosmos Date: Tue, 25 Aug 2026 00:50:55 +0000 Subject: [PATCH] Normalize frontend API host URLs --- Dockerfile | 4 ++++ docker/client-config.patch | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 docker/client-config.patch diff --git a/Dockerfile b/Dockerfile index 9839eab..9333e43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update \ g++ \ libmariadb-dev \ make \ + patch \ patchelf \ python3-dev \ && rm -rf /var/lib/apt/lists/* @@ -18,6 +19,9 @@ RUN apt-get update \ COPY upstream/HubBackend/requirements.txt upstream/HubBackend/makefile ./ COPY upstream/HubBackend/src ./src COPY upstream/HubBackend/config_sample.json upstream/HubBackend/openapi.json ./ +COPY docker/client-config.patch ./docker/client-config.patch + +RUN patch -p1 < docker/client-config.patch # Compile the binaries from the backend source code. Cache the build data. RUN --mount=type=cache,target=/root/.cache/pip \ diff --git a/docker/client-config.patch b/docker/client-config.patch new file mode 100644 index 0000000..a323ea5 --- /dev/null +++ b/docker/client-config.patch @@ -0,0 +1,18 @@ +--- a/src/external_plugins/client-config.py ++++ b/src/external_plugins/client-config.py +@@ -17,0 +18,6 @@ ++def normalize_client_config(config): ++ if not config["api_host"].startswith(("http://", "https://")): ++ config["api_host"] = f"https://{config['api_host']}" ++ return config ++ ++ +@@ -24 +30 @@ +- return json.loads(config) ++ return normalize_client_config(json.loads(config)) +@@ -37 +43 @@ +- config = json.loads(t[0][0]) ++ config = normalize_client_config(json.loads(t[0][0])) +@@ -298 +304 @@ +- "api_host": config["domain"], ++ "api_host": f"https://{config['domain']}",