Update BASE_PATH handling in next.config and fix fetch URLs to ensure correct path structure in API routes

This commit is contained in:
Bram Suurd 2024-11-06 23:34:30 +01:00
parent 306fd8e26c
commit 562ba92ee9
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -6,7 +6,7 @@ export const dynamic = "force-static";
const fetchCategories = async (): Promise<Category[]> => {
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<Category[]> => {
const fetchScripts = async (): Promise<Script[]> => {
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(