Initial Release

This commit is contained in:
CanbiZ
2025-03-03 10:10:57 +01:00
parent 123855d477
commit 1c2604bea0
175 changed files with 25348 additions and 1 deletions

10
frontend/src/lib/data.ts Normal file
View File

@@ -0,0 +1,10 @@
import { Category } from "./types";
export const fetchCategories = async () => {
const response = await fetch("api/categories");
if (!response.ok) {
throw new Error(`Failed to fetch categories: ${response.statusText}`);
}
const categories: Category[] = await response.json();
return categories;
};

7
frontend/src/lib/time.ts Normal file
View File

@@ -0,0 +1,7 @@
export function extractDate(dateString: string): string {
const date = new Date(dateString);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}

58
frontend/src/lib/types.ts Normal file
View File

@@ -0,0 +1,58 @@
import { AlertColors } from "@/config/siteConfig";
export type Script = {
name: string;
slug: string;
categories: number[];
date_created: string;
type: "vm" | "ct" | "misc";
updateable: boolean;
privileged: boolean;
interface_port: number | null;
documentation: string | null;
website: string | null;
logo: string | null;
description: string;
install_methods: {
type: "default" | "alpine";
script: string;
resources: {
cpu: number | null;
ram: number | null;
hdd: number | null;
os: string | null;
version: string | null;
};
}[];
default_credentials: {
username: string | null;
password: string | null;
};
notes: [
{
text: string;
type: keyof typeof AlertColors;
},
];
};
export type Category = {
name: string;
id: number;
sort_order: number;
scripts: Script[];
};
export type Metadata = {
categories: Category[];
};
export interface Version {
name: string;
slug: string;
}
export interface OperatingSystem {
name: string;
versions: Version[];
}

View File

@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}