From 562ba92ee9ff819da4a448f7bfc9c0240bbe3b40 Mon Sep 17 00:00:00 2001 From: Bram Suurd <78373894+BramSuurdje@users.noreply.github.com> Date: Wed, 6 Nov 2024 23:34:30 +0100 Subject: [PATCH] Update BASE_PATH handling in next.config and fix fetch URLs to ensure correct path structure in API routes --- frontend/next.config.mjs | 4 ++-- frontend/src/app/api/categories/route.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index 5407a9c5..a2529f34 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -15,11 +15,11 @@ const nextConfig = { }, env: { - BASE_PATH: "/ProxmoxVE", + BASE_PATH: "ProxmoxVE", }, output: "export", - basePath: "/ProxmoxVE", + basePath: `/${process.env.BASE_PATH}`, }; export default nextConfig; diff --git a/frontend/src/app/api/categories/route.ts b/frontend/src/app/api/categories/route.ts index 8001ded4..52470a12 100644 --- a/frontend/src/app/api/categories/route.ts +++ b/frontend/src/app/api/categories/route.ts @@ -6,7 +6,7 @@ export const dynamic = "force-static"; const fetchCategories = async (): Promise => { const response = await fetch( - `https://raw.githubusercontent.com/community-scripts${basePath}/refs/heads/main/json/metadata.json`, + `https://raw.githubusercontent.com/community-scripts/${basePath}/refs/heads/main/json/metadata.json`, ); const data = await response.json(); return data.categories; @@ -14,7 +14,7 @@ const fetchCategories = async (): Promise => { const fetchScripts = async (): Promise => { const response = await fetch( - `https://api.github.com/repos/community-scripts${basePath}/contents/json`, + `https://api.github.com/repos/community-scripts/${basePath}/contents/json`, ); const files: { download_url: string }[] = await response.json(); const scripts = await Promise.all(