diff --git a/.github/workflows/get-versions-from-newreleases.yaml b/.github/workflows/get-versions-from-newreleases.yaml index ad8574c..c375b4a 100644 --- a/.github/workflows/get-versions-from-newreleases.yaml +++ b/.github/workflows/get-versions-from-newreleases.yaml @@ -63,9 +63,10 @@ jobs: jq -r '.projects[] | "\(.id) \(.name)"' "$projects_file" | while read -r id name; do version=$(curl -s -H "X-Key: $token" "https://api.newreleases.io/v1/projects/$id/latest-release") version_data=$(echo "$version" | jq -r '.version // empty') + version_date=$(echo "$version" | jq -r '.date // empty') if [ -n "$version_data" ]; then jq --arg name "$name" --arg version "$version_data" \ - '. += [{"name": $name, "version": $version}]' "$output_file" > "$output_file.tmp" && mv "$output_file.tmp" "$output_file" + '. += [{"name": $name, "version": $version, "date": $version_date}]' "$output_file" > "$output_file.tmp" && mv "$output_file.tmp" "$output_file" fi done ((page++)) diff --git a/frontend/src/app/scripts/_components/ScriptItem.tsx b/frontend/src/app/scripts/_components/ScriptItem.tsx index 67e8b84..5ab26cd 100644 --- a/frontend/src/app/scripts/_components/ScriptItem.tsx +++ b/frontend/src/app/scripts/_components/ScriptItem.tsx @@ -20,126 +20,128 @@ import { basePath } from "@/config/siteConfig"; import { useEffect, useState } from "react"; interface ScriptItemProps { - item: Script; - setSelectedScript: (script: string | null) => void; + item: Script; + setSelectedScript: (script: string | null) => void; } function ScriptItem({ - item, - setSelectedScript, + item, + setSelectedScript, }: ScriptItemProps) { - const closeScript = () => { - window.history.pushState({}, document.title, window.location.pathname); - setSelectedScript(null); -}; + const closeScript = () => { + window.history.pushState({}, document.title, window.location.pathname); + setSelectedScript(null); + }; - const [versions, setVersions] = useState([]); + const [versions, setVersions] = useState([]); -useEffect(() => { - fetchVersions() - .then((fetchedVersions) => { - console.log("Fetched Versions: ", fetchedVersions); - if (Array.isArray(fetchedVersions)) { - setVersions(fetchedVersions); - } else if (fetchedVersions && typeof fetchedVersions === "object") { - setVersions([fetchedVersions]); - } else { - setVersions([]); - } - }) - .catch((error) => console.error("Error fetching versions:", error)); -}, []); + useEffect(() => { + fetchVersions() + .then((fetchedVersions) => { + console.log("Fetched Versions: ", fetchedVersions); + if (Array.isArray(fetchedVersions)) { + setVersions(fetchedVersions); + } else if (fetchedVersions && typeof fetchedVersions === "object") { + setVersions([fetchedVersions]); + } else { + setVersions([]); + } + }) + .catch((error) => console.error("Error fetching versions:", error)); + }, []); -const defaultInstallMethod = item.install_methods?.[0]; -const os = defaultInstallMethod?.resources?.os || "Proxmox Node"; -const version = defaultInstallMethod?.resources?.version || ""; + const defaultInstallMethod = item.install_methods?.[0]; + const os = defaultInstallMethod?.resources?.os || "Proxmox Node"; + const version = defaultInstallMethod?.resources?.version || ""; - return ( -
-
-
-
-

Selected Script

- -
-
-
-
- - ((e.currentTarget as HTMLImageElement).src = - `/${basePath}/logo.png`) - } - height={400} - alt={item.name} - unoptimized - /> -
-
-
-

- {item.name} {getDisplayValueFromType(item.type)} -

-

- Date added: {extractDate(item.date_created)} -

-

- Default OS: {os} {version} -

+ return ( +
+
+
+
+

Selected Script

+
-
- +
+
+
+ + ((e.currentTarget as HTMLImageElement).src = + `/${basePath}/logo.png`) + } + height={400} + alt={item.name} + unoptimized + /> +
+
+
+

+ {item.name} {getDisplayValueFromType(item.type)} +

+

+ Date added: {extractDate(item.date_created)} +

+

+ Default OS: {os} {version} +

+
+
+ +
+
+ {versions.length === 0 ? ( +

Loading versions...

+ ) : ( +

Version: { versions.find((v) => + v.name === item.slug.replace(/[^a-z0-9]/g, '') || + v.name.includes(item.slug.replace(/[^a-z0-9]/g, '')) || + v.name.replace(/[^a-z0-9]/g, '') === item.slug.replace(/[^a-z0-9]/g, '') + + )?.version || "Not found" + }

+ )} + +
+
+
+
+
+ + +
+
+ +
+
+ + +
+
+
+

+ How to {item.type == "misc" ? "use" : "install"} +

+ +
+ + +
+
+
-
- - - {versions.length === 0 ? ( -

Loading versions...

- ) : ( -

Version: { - versions.find((v) => v.name === item.slug.replace(/[^a-z0-9]/g, ''))?.version || "Not found" - }

- )} - -
-
-
-
- - -
- -
-
- - -
-
-
-

- How to {item.type == "misc" ? "use" : "install"} -

- -
- - -
-
- -
-
-
- ); + ); } export default ScriptItem;