navidrome
This commit is contained in:
parent
31c0ec74d5
commit
c5f2b84acd
72
ct/navidrome.sh
Normal file
72
ct/navidrome.sh
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/navidrome/navidrome
|
||||||
|
|
||||||
|
APP="Navidrome"
|
||||||
|
var_tags="${var_tags:-music}"
|
||||||
|
var_disk="${var_disk:-7}"
|
||||||
|
var_cpu="${var_cpu:-4}"
|
||||||
|
var_ram="${var_ram:-2048}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-12}"
|
||||||
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
if [[ ! -d /var/lib/navidrome ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/hudikhq/hoodik/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
|
msg_info "Stopping Services"
|
||||||
|
systemctl stop hoodik
|
||||||
|
msg_ok "Services Stopped"
|
||||||
|
|
||||||
|
msg_info "Updating ${APP} to ${RELEASE}"
|
||||||
|
cd /opt
|
||||||
|
if [ -d hoodik_bak ]; then
|
||||||
|
rm -rf hoodik_bak
|
||||||
|
fi
|
||||||
|
mv hoodik hoodik_bak
|
||||||
|
curl -fsSL "https://github.com/hudikhq/hoodik/archive/refs/tags/${RELEASE}.zip"
|
||||||
|
unzip -q ${RELEASE}.zip
|
||||||
|
mv hoodik-${RELEASE} /opt/hoodik
|
||||||
|
cd /opt/hoodik
|
||||||
|
cargo update -q
|
||||||
|
cargo build -q --release
|
||||||
|
msg_ok "Updated Hoodik"
|
||||||
|
|
||||||
|
msg_info "Starting Services"
|
||||||
|
systemctl start hoodik
|
||||||
|
msg_ok "Started Services"
|
||||||
|
|
||||||
|
msg_info "Cleaning Up"
|
||||||
|
rm -R /opt/${RELEASE}.zip
|
||||||
|
rm -R /opt/hoodik_bak
|
||||||
|
msg_ok "Cleaned"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
build_container
|
||||||
|
description
|
||||||
|
|
||||||
|
msg_ok "Completed Successfully!\n"
|
||||||
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8088${CL}"
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from "@/components/ui/command";
|
} from "@/components/ui/command";
|
||||||
import { basePath } from "@/config/siteConfig";
|
import { basePath } from "@/config/siteConfig";
|
||||||
import { fetchCategories } from "@/lib/data";
|
import { fetchCategories } from "@/lib/data";
|
||||||
import { Category } from "@/lib/types";
|
import { Category, Script } from "@/lib/types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@ -16,6 +16,7 @@ import React from "react";
|
|||||||
import { Badge } from "./ui/badge";
|
import { Badge } from "./ui/badge";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
import { DialogTitle } from "./ui/dialog";
|
import { DialogTitle } from "./ui/dialog";
|
||||||
|
import { Sparkles } from "lucide-react"; // <- Hinzugefügt
|
||||||
|
|
||||||
export const formattedBadge = (type: string) => {
|
export const formattedBadge = (type: string) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -31,11 +32,19 @@ export const formattedBadge = (type: string) => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// random Script
|
||||||
|
function getRandomScript(categories: Category[]): Script | null {
|
||||||
|
const allScripts = categories.flatMap((cat) => cat.scripts || []);
|
||||||
|
if (allScripts.length === 0) return null;
|
||||||
|
const idx = Math.floor(Math.random() * allScripts.length);
|
||||||
|
return allScripts[idx];
|
||||||
|
}
|
||||||
|
|
||||||
export default function CommandMenu() {
|
export default function CommandMenu() {
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
const [links, setLinks] = React.useState<Category[]>([]);
|
const [links, setLinks] = React.useState<Category[]>([]);
|
||||||
const router = useRouter();
|
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const down = (e: KeyboardEvent) => {
|
const down = (e: KeyboardEvent) => {
|
||||||
@ -45,7 +54,6 @@ export default function CommandMenu() {
|
|||||||
setOpen((open) => !open);
|
setOpen((open) => !open);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("keydown", down);
|
document.addEventListener("keydown", down);
|
||||||
return () => document.removeEventListener("keydown", down);
|
return () => document.removeEventListener("keydown", down);
|
||||||
}, []);
|
}, []);
|
||||||
@ -63,8 +71,30 @@ export default function CommandMenu() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openRandomScript = async () => {
|
||||||
|
if (links.length === 0) {
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const categories = await fetchCategories();
|
||||||
|
setLinks(categories);
|
||||||
|
const randomScript = getRandomScript(categories);
|
||||||
|
if (randomScript) {
|
||||||
|
router.push(`/scripts?id=${randomScript.slug}`);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const randomScript = getRandomScript(links);
|
||||||
|
if (randomScript) {
|
||||||
|
router.push(`/scripts?id=${randomScript.slug}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -80,6 +110,19 @@ export default function CommandMenu() {
|
|||||||
<span className="text-xs">⌘</span>K
|
<span className="text-xs">⌘</span>K
|
||||||
</kbd>
|
</kbd>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="icon"
|
||||||
|
onClick={openRandomScript}
|
||||||
|
title="Open random script"
|
||||||
|
disabled={isLoading}
|
||||||
|
className="h-9 w-9"
|
||||||
|
>
|
||||||
|
<Sparkles className="h-5 w-5" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<CommandDialog open={open} onOpenChange={setOpen}>
|
<CommandDialog open={open} onOpenChange={setOpen}>
|
||||||
<DialogTitle className="sr-only">Search scripts</DialogTitle>
|
<DialogTitle className="sr-only">Search scripts</DialogTitle>
|
||||||
<CommandInput placeholder="Search for a script..." />
|
<CommandInput placeholder="Search for a script..." />
|
||||||
|
36
install/navidrome-install.sh
Normal file
36
install/navidrome-install.sh
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: MickLesk (CanbiZ)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/navidrome/navidrome
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies (Patience)"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
ffmpeg
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Installing Navidrome"
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/navidrome/navidrome/releases/latest | grep "tag_name" | awk -F '"' '{print $4}')
|
||||||
|
TMP_DEB=$(mktemp --suffix=.deb)
|
||||||
|
curl -fsSL -o "${TMP_DEB}" "https://github.com/navidrome/navidrome/releases/download/${RELEASE}/navidrome_${RELEASE#v}_linux_amd64.deb"
|
||||||
|
systemctl enable -q --now navidrome.service
|
||||||
|
$STD apt-get install -y "${TMP_DEB}"
|
||||||
|
msg_ok "Installed hoodik"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -f "${TMP_DEB}"
|
||||||
|
$STD apt-get autoremove
|
||||||
|
$STD apt-get autoclean
|
||||||
|
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user