Normalize frontend API host URLs

This commit is contained in:
kosmos committed 2026-08-25 00:50:55 +00:00
1 parent f8fb871bcc
commit fa526eba02
2 files changed
+22

No files matched your search

+4
View File
@@ -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 \
+18
View File
@@ -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']}",