From 551e6a9556c257e22294fe1bd7c094e393af58cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=9F=E4=BA=8C=E8=BF=9C?= Date: Wed, 8 Apr 2026 14:52:15 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=E8=B0=83=E6=95=B4=E9=80=82=E9=85=8D?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=98=BF=E9=87=8C=E4=BA=91=E6=95=88-001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/Dockerfile | 2 +- web/src/api/client.ts | 6 ++++-- web/src/bootstrap.ts | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 14a0dadb..28f88a42 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -12,7 +12,7 @@ FROM jsessh-registry.cn-shanghai.cr.aliyuncs.com/base-images/nginx-skillhub:alpi # 限制 envsubst 只替换 SKILLHUB_ 开头的变量,避免覆盖 nginx 的 $uri $host 等变量 # 设置默认值,部署时通过环境变量覆盖 ENV SKILLHUB_API_UPSTREAM=${SKILLHUB_API_UPSTREAM:-http://skillhub-server-dev:8000} -ENV SKILLHUB_WEB_API_BASE_URL=${SKILLHUB_WEB_API_BASE_URL:-http://sz-api.indusmind.local/skillhub-server} +ENV SKILLHUB_WEB_API_BASE_URL=${SKILLHUB_WEB_API_BASE_URL:-http://sz-api.indusmind.local/skillhub-server/} ENV SKILLHUB_PUBLIC_BASE_URL=${SKILLHUB_PUBLIC_BASE_URL:-http://sz-api.indusmind.local/skillhub-web} COPY --from=build /app/dist /usr/share/nginx/html diff --git a/web/src/api/client.ts b/web/src/api/client.ts index 21ef4019..8b5d4e95 100644 --- a/web/src/api/client.ts +++ b/web/src/api/client.ts @@ -76,7 +76,7 @@ function getRuntimeConfig(): RuntimeConfig { } function getApiBaseUrl(): string { - return getRuntimeConfig().apiBaseUrl || '/skillhub-server' + return getRuntimeConfig().apiBaseUrl || '/skillhub-server/' } function parseBooleanFlag(value: string | undefined): boolean { @@ -253,7 +253,9 @@ function withBaseUrl(input: RequestInfo | URL): RequestInfo | URL { if (!baseUrl || typeof input !== 'string' || !input.startsWith('/')) { return input } - return new URL(input, ensureTrailingSlash(baseUrl)) + const url = new URL(input, ensureTrailingSlash(baseUrl)) + // console.log('url info = ', url) + return url } export function buildApiUrl(path: string): string { diff --git a/web/src/bootstrap.ts b/web/src/bootstrap.ts index a66f3c7a..d00e3f6c 100644 --- a/web/src/bootstrap.ts +++ b/web/src/bootstrap.ts @@ -17,8 +17,8 @@ async function loadRuntimeConfig() { function ensureRuntimeConfigFallback() { window.__SKILLHUB_RUNTIME_CONFIG__ ??= { - apiBaseUrl: '/skillhub-server', - appBaseUrl: '/skillhub-web', + apiBaseUrl: '/skillhub-server/', + appBaseUrl: '/skillhub-web/', authDirectEnabled: 'false', authDirectProvider: '', authSessionBootstrapEnabled: 'false',