mirror of
https://github.com/community-unscripted/Proxmox.git
synced 2026-07-01 20:44:03 -04:00
refactor(Buttons): reorganize URL transformation function
This commit is contained in:
@@ -11,6 +11,15 @@ export default function Buttons({ item }: { item: Script }) {
|
||||
[],
|
||||
);
|
||||
|
||||
const transformUrlToInstallScript = (url: string): string => {
|
||||
if (url.includes("/pve/")) {
|
||||
return url;
|
||||
} else if (url.includes("/ct/")) {
|
||||
return url.replace("/ct/", "/install/").replace(/\.sh$/, "-install.sh");
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
const sourceUrl = useMemo(() => {
|
||||
if (item.installCommand) {
|
||||
const match = item.installCommand.match(pattern);
|
||||
@@ -19,15 +28,6 @@ export default function Buttons({ item }: { item: Script }) {
|
||||
return null;
|
||||
}, [item.installCommand, pattern]);
|
||||
|
||||
const transformUrlToInstallScript = (url: string): string => {
|
||||
if (url.includes("/pve/")) {
|
||||
return url;
|
||||
} else if (url.includes("/ct/")) {
|
||||
return url.replace("/ct/", "/install/").replace(/\.sh$/, "-install.sh");
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap justify-end gap-2">
|
||||
{item.website && (
|
||||
|
||||
Reference in New Issue
Block a user