mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-12 02:39:17 +00:00
use cleaner basePath
variable around codebase for easier management
This commit is contained in:
parent
49527dde19
commit
1c4321c466
@ -1,17 +1,20 @@
|
|||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
import { Category, Script } from "@/lib/types";
|
import { Category, Script } from "@/lib/types";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export const dynamic = "force-static";
|
export const dynamic = "force-static";
|
||||||
|
|
||||||
const fetchCategories = async () => {
|
const fetchCategories = async () => {
|
||||||
const response = await fetch("https://raw.githubusercontent.com/community-scripts/ProxmoxVE/refs/heads/main/json/metadata.json");
|
const response = await fetch(
|
||||||
|
`https://raw.githubusercontent.com/community-scripts/${basePath}/refs/heads/main/json/metadata.json`,
|
||||||
|
);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
return data.categories;
|
return data.categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchAllMetaDataFiles = async () => {
|
const fetchAllMetaDataFiles = async () => {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"https://api.github.com/repos/community-scripts/ProxmoxVE/contents/json",
|
`https://api.github.com/repos/community-scripts/${basePath}/contents/json`,
|
||||||
);
|
);
|
||||||
const files = await response.json();
|
const files = await response.json();
|
||||||
const scripts: Script[] = [];
|
const scripts: Script[] = [];
|
||||||
|
@ -11,6 +11,7 @@ import { useEffect, useState } from "react";
|
|||||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
import { CardFooter } from "@/components/ui/card";
|
import { CardFooter } from "@/components/ui/card";
|
||||||
import { FaGithub } from "react-icons/fa";
|
import { FaGithub } from "react-icons/fa";
|
||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
|
|
||||||
function CustomArrowRightIcon() {
|
function CustomArrowRightIcon() {
|
||||||
return <ArrowRightIcon className="h-4 w-4" width={1} />;
|
return <ArrowRightIcon className="h-4 w-4" width={1} />;
|
||||||
@ -80,7 +81,7 @@ export default function Page() {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button className="w-full" asChild>
|
<Button className="w-full" asChild>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/community-scripts/ProxmoxVE"
|
href={`https://github.com/community-scripts/${basePath}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="flex items-center justify-center"
|
className="flex items-center justify-center"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
import type { MetadataRoute } from "next";
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
export const dynamic = "force-static";
|
export const dynamic = "force-static";
|
||||||
@ -8,6 +9,6 @@ export default function robots(): MetadataRoute.Robots {
|
|||||||
userAgent: "*",
|
userAgent: "*",
|
||||||
allow: "/",
|
allow: "/",
|
||||||
},
|
},
|
||||||
sitemap: "https://community-scripts.github.io/Proxmox/sitemap.xml",
|
sitemap: `https://community-scripts.github.io/${basePath}/sitemap.xml`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
import { Script } from "@/lib/types";
|
import { Script } from "@/lib/types";
|
||||||
import { BookOpenText, Code, Globe } from "lucide-react";
|
import { BookOpenText, Code, Globe } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
const generateSourceUrl = (slug: string, type: string) => {
|
const generateSourceUrl = (slug: string, type: string) => {
|
||||||
if (type === "ct") {
|
if (type === "ct") {
|
||||||
return `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${slug}-install.sh`;
|
return `https://raw.githubusercontent.com/community-scripts/${basePath}/main/install/${slug}-install.sh`;
|
||||||
} else {
|
} else {
|
||||||
return `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/${type}/${slug}.sh`;
|
return `https://raw.githubusercontent.com/community-scripts/${basePath}/main/${type}/${slug}.sh`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import CodeCopyButton from "@/components/ui/code-copy-button";
|
import CodeCopyButton from "@/components/ui/code-copy-button";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
import { Script } from "@/lib/types";
|
import { Script } from "@/lib/types";
|
||||||
|
|
||||||
const generateInstallCommand = (script?: string) => {
|
const generateInstallCommand = (script?: string) => {
|
||||||
return `bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/${script})"`;
|
return `bash -c "$(wget -qLO - https://github.com/community-scripts/${basePath}/raw/main/${script})"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function InstallCommand({ item }: { item: Script }) {
|
export default function InstallCommand({ item }: { item: Script }) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
@ -7,7 +8,7 @@ export default function Footer() {
|
|||||||
<div className="mx-6 w-full max-w-7xl text-sm text-muted-foreground">
|
<div className="mx-6 w-full max-w-7xl text-sm text-muted-foreground">
|
||||||
Website build by the community. The source code is avaliable on{" "}
|
Website build by the community. The source code is avaliable on{" "}
|
||||||
<Link
|
<Link
|
||||||
href="https://github.com/community-scripts/Proxmox"
|
href={`https://github.com/community-scripts/${basePath}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="font-semibold underline-offset-2 duration-300 hover:underline"
|
className="font-semibold underline-offset-2 duration-300 hover:underline"
|
||||||
|
@ -8,6 +8,7 @@ import * as React from "react";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { Button } from "./button";
|
import { Button } from "./button";
|
||||||
import { Separator } from "./separator";
|
import { Separator } from "./separator";
|
||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
|
|
||||||
const buttonVariants = cva(
|
const buttonVariants = cva(
|
||||||
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
||||||
@ -67,7 +68,7 @@ const handleCopy = (type: string, value: string) => {
|
|||||||
<div>
|
<div>
|
||||||
<Button className="text-white">
|
<Button className="text-white">
|
||||||
<Link
|
<Link
|
||||||
href="https://github.com/community-scripts/ProxmoxVE"
|
href={`https://github.com/community-scripts/${basePath}`}
|
||||||
data-umami-event="Star on Github"
|
data-umami-event="Star on Github"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
|
@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
|
|||||||
import { FaGithub, FaStar } from "react-icons/fa";
|
import { FaGithub, FaStar } from "react-icons/fa";
|
||||||
import NumberTicker from "./number-ticker";
|
import NumberTicker from "./number-ticker";
|
||||||
import { buttonVariants } from "./button";
|
import { buttonVariants } from "./button";
|
||||||
|
import { basePath } from "@/config/siteConfig";
|
||||||
|
|
||||||
export default function StarOnGithubButton() {
|
export default function StarOnGithubButton() {
|
||||||
const [stars, setStars] = useState(0);
|
const [stars, setStars] = useState(0);
|
||||||
@ -11,7 +12,7 @@ export default function StarOnGithubButton() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchStars = async () => {
|
const fetchStars = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch("https://api.github.com/repos/community-scripts/ProxmoxVE", {
|
const res = await fetch(`https://api.github.com/repos/community-scripts/${basePath}`, {
|
||||||
next: { revalidate: 60 * 60 * 24 },
|
next: { revalidate: 60 * 60 * 24 },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ export default function StarOnGithubButton() {
|
|||||||
"group relative justify-center gap-2 rounded-md transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",
|
"group relative justify-center gap-2 rounded-md transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",
|
||||||
)}
|
)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/community-scripts/ProxmoxVE"
|
href={`https://github.com/community-scripts/${basePath}`}
|
||||||
>
|
>
|
||||||
<span className="absolute right-0 -mt-12 h-32 translate-x-12 rotate-12 bg-white opacity-10 transition-all duration-1000 ease-out group-hover:-translate-x-40" />
|
<span className="absolute right-0 -mt-12 h-32 translate-x-12 rotate-12 bg-white opacity-10 transition-all duration-1000 ease-out group-hover:-translate-x-40" />
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
import { MessagesSquare, Scroll } from "lucide-react";
|
import { MessagesSquare, Scroll } from "lucide-react";
|
||||||
import { FaGithub } from "react-icons/fa";
|
import { FaGithub } from "react-icons/fa";
|
||||||
|
|
||||||
|
export const basePath = "ProxmoxVE";
|
||||||
|
|
||||||
export const navbarLinks = [
|
export const navbarLinks = [
|
||||||
{
|
{
|
||||||
href: "https://github.com/community-scripts/ProxmoxVE",
|
href: `https://github.com/community-scripts/${basePath}`,
|
||||||
event: "Github",
|
event: "Github",
|
||||||
icon: <FaGithub className="h-4 w-4" />,
|
icon: <FaGithub className="h-4 w-4" />,
|
||||||
text: "Github",
|
text: "Github",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: "https://github.com/community-scripts/ProxmoxVE/blob/main/CHANGELOG.md",
|
href: `https://github.com/community-scripts/${basePath}/blob/main/CHANGELOG.md`,
|
||||||
event: "Change Log",
|
event: "Change Log",
|
||||||
icon: <Scroll className="h-4 w-4" />,
|
icon: <Scroll className="h-4 w-4" />,
|
||||||
text: "Change Log",
|
text: "Change Log",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: "https://github.com/community-scripts/ProxmoxVE/discussions",
|
href: `https://github.com/community-scripts/${basePath}/discussions`,
|
||||||
event: "Discussions",
|
event: "Discussions",
|
||||||
icon: <MessagesSquare className="h-4 w-4" />,
|
icon: <MessagesSquare className="h-4 w-4" />,
|
||||||
text: "Discussions",
|
text: "Discussions",
|
||||||
@ -32,5 +34,3 @@ export const analytics = {
|
|||||||
url: "analytics.proxmoxve-scripts.com",
|
url: "analytics.proxmoxve-scripts.com",
|
||||||
token: "b60d3032-1a11-4244-a100-81d26c5c49a7",
|
token: "b60d3032-1a11-4244-a100-81d26c5c49a7",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const basePath = "ProxmoxVE"
|
|
Loading…
Reference in New Issue
Block a user