diff --git a/bun.lockb b/bun.lockb
index 03598c6..fb7b343 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index 371e39b..efecf8b 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.1.0",
+ "@radix-ui/react-tooltip": "^1.1.2",
"@vercel/analytics": "^1.2.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
diff --git a/src/app/api/categories/route.ts b/src/app/api/categories/route.ts
index b8491d4..8890271 100644
--- a/src/app/api/categories/route.ts
+++ b/src/app/api/categories/route.ts
@@ -5,7 +5,7 @@ import { Category } from "@/lib/types";
export async function GET(req: NextRequest) {
try {
const response = await pb.collection("categories").getFullList({
- expand: "items.alpine_script",
+ expand: "items.alerts,items.alpine_script,items.default_login",
sort: "order",
});
diff --git a/src/app/scripts/_components/ScriptItem.tsx b/src/app/scripts/_components/ScriptItem.tsx
index 1149c25..4fde214 100644
--- a/src/app/scripts/_components/ScriptItem.tsx
+++ b/src/app/scripts/_components/ScriptItem.tsx
@@ -18,9 +18,17 @@ import { Category, Script } from "@/lib/types";
import { useSearchParams } from "next/navigation";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { MostViewedScripts, LatestScripts } from "./ScriptInfoBlocks";
+import { Badge } from "@/components/ui/badge";
import { toast } from "sonner";
import CodeCopyButton from "@/components/ui/code-copy-button";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+
function ScriptItem({
items,
@@ -129,6 +137,7 @@ function ScriptItem({
};
const hasAlpineScript = item?.expand?.alpine_script !== undefined;
+ const hasDefaultLogin = item?.expand?.default_login !== undefined;
return (
<>
@@ -277,40 +286,66 @@ function ScriptItem({
-
-
- Description
-
-
- {descriptionCodeBlock(item.description)}
-
-
- {item.alert1 && (
-
-
-
- {descriptionCodeBlock(item.alert1)}
+
+
+
+ Description
+
+
+ {descriptionCodeBlock(item.description)}
- {item.alert2 && (
-
-
- {descriptionCodeBlock(item.alert2)}
-
- )}
- {item.alert3 && (
+
+
+ {item.expand?.alerts?.length > 0 &&
+ item.expand.alerts.map((alert: any, index: number) => (
+
- {descriptionCodeBlock(item.alert3)}
+ {descriptionCodeBlock(alert.content)}
- )}
-
- )}
+
+ ))}
-
- How to {item.item_type ? "install" : "use"}
-
+
+
+ How to {item.item_type ? "install" : "use"}
+
+
+ {item.privileged && (
+
+
+
+
+ Privileged
+
+
+
+
+ This script will be run in a privileged LXC
+
+
+
+
+ )}
+ {item.isUpdateable && (
+
+
+
+ Updateable
+
+
+
+ To Update {item.title}, run the command below
+ (or type update) in the LXC Console.
+
+
+
+
+ )}
+
+
{hasAlpineScript ? (
@@ -332,12 +367,6 @@ function ScriptItem({
{item.item_type}, run the command below in the
Proxmox VE Shell.
- {item.isUpdateable && (
-
- To Update {item.title}, run the command
- below (or type update) in the LXC Console.
-
- )}
>
)}
{installCommand}
@@ -374,12 +403,6 @@ function ScriptItem({
{item.item_type}, run the command below in the
Proxmox VE Shell.
- {item.isUpdateable && (
-
- To Update {item.title}, run the command below
- (or type update) in the LXC Console.
-
- )}
>
)}
{installCommand && (
@@ -390,6 +413,55 @@ function ScriptItem({
+
+ {hasDefaultLogin && (
+
+
+
+ Default Login Credentials
+
+
+
+
+
+ You can use the following credentials to login to the{" "}
+ {""}
+ {item.title} {item.item_type}.
+
+
+ Username:{" "}
+
+ handleCopy(
+ "username",
+ item.expand.default_login.username,
+ )
+ }
+ >
+ {item.expand.default_login.username}
+
+
+
+ Password:{" "}
+
+ handleCopy(
+ "password",
+ item.expand.default_login.password,
+ )
+ }
+ >
+ {item.expand.default_login.password}
+
+
+
+
+ )}
+
diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx
index 4f86d21..8cdf821 100644
--- a/src/components/ui/badge.tsx
+++ b/src/components/ui/badge.tsx
@@ -15,6 +15,7 @@ const badgeVariants = cva(
destructive:
"border-transparent text-destructive-foreground border-destructive-foreground",
outline: "text-foreground",
+ success: "text-green-500 border-green-500"
},
},
defaultVariants: {
diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx
new file mode 100644
index 0000000..30fc44d
--- /dev/null
+++ b/src/components/ui/tooltip.tsx
@@ -0,0 +1,30 @@
+"use client"
+
+import * as React from "react"
+import * as TooltipPrimitive from "@radix-ui/react-tooltip"
+
+import { cn } from "@/lib/utils"
+
+const TooltipProvider = TooltipPrimitive.Provider
+
+const Tooltip = TooltipPrimitive.Root
+
+const TooltipTrigger = TooltipPrimitive.Trigger
+
+const TooltipContent = React.forwardRef<
+ React.ElementRef,
+ React.ComponentPropsWithoutRef
+>(({ className, sideOffset = 4, ...props }, ref) => (
+
+))
+TooltipContent.displayName = TooltipPrimitive.Content.displayName
+
+export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 3983f91..78c8dcb 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -18,6 +18,8 @@ export type Script = {
id: string;
expand: {
alpine_script: alpine_script;
+ alerts: alerts[];
+ default_login: default_login;
}
isUpdateable: boolean;
item_type: string;
@@ -30,6 +32,7 @@ export type Script = {
isMostViewed: boolean;
mostViewedPosition: number;
interface: string;
+ privileged: boolean;
};
type alpine_script = {
@@ -39,6 +42,15 @@ type alpine_script = {
default_ram: string;
};
+type alerts = {
+ content: string;
+}
+
+type default_login = {
+ username: string;
+ password: string;
+}
+
export interface Category {
catagoryName: string;
collectionId: string;
@@ -49,11 +61,3 @@ export interface Category {
items: Script[];
};
}
-
-export type Scripts = {
- page: number;
- perPage: number;
- totalItems: number;
- totalPages: number;
- items: Category[];
-};