From 7bf73208eef41d5d3e9212d52030b726bc55c669 Mon Sep 17 00:00:00 2001 From: xream Date: Fri, 1 Aug 2025 13:13:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E5=8E=BB=E9=99=A4=20?= =?UTF-8?q?api=20=E5=8F=82=E6=95=B0=E6=9C=AB=E5=B0=BE=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/App.vue | 2 +- src/hooks/useHostAPI.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index dc78134fd..d63a391d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-store-front-end", - "version": "2.15.63", + "version": "2.15.64", "private": true, "scripts": { "dev": "vite --host", diff --git a/src/App.vue b/src/App.vue index b25d294ca..bcd4d028b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -94,7 +94,7 @@ const processUrlApiConfig = async () => { .find(i => i[0] === 'magicpath'); if (hasApiParam) { - const apiValue = decodeURIComponent(hasApiParam[1]); + const apiValue = decodeURIComponent(hasApiParam[1]).replace(/\/$/, ''); // 去除末尾斜杠; urlApiValue.value = apiValue; urlApiError.value = '通过 URL 参数指定的 API 地址连接失败,请检查地址是否正确'; hasUrlParams = true; diff --git a/src/hooks/useHostAPI.ts b/src/hooks/useHostAPI.ts index ae59d6fce..eea4d3054 100644 --- a/src/hooks/useHostAPI.ts +++ b/src/hooks/useHostAPI.ts @@ -25,7 +25,7 @@ export const getHostAPIUrl = (): string => { apis.find(api => api.name === current)?.url || import.meta.env.VITE_API_URL || 'https://sub.store' - ); + ).replace(/\/$/, ''); // 去除末尾斜杠; }; const setHostAPI = (hostAPI: HostAPIStorage) => { @@ -167,7 +167,7 @@ export const useHostAPI = () => { // 优先处理api参数 if (apiUrl) { - const url = decodeURIComponent(apiUrl[1]); + const url = decodeURIComponent(apiUrl[1]).replace(/\/$/, ''); // 去除末尾斜杠; if (!url) return await errorCb?.(); // 检查是否已存在相同URL的API