diff --git a/src/shared/components/Sidebar.js b/src/shared/components/Sidebar.js index fa78072bc..d4d356882 100644 --- a/src/shared/components/Sidebar.js +++ b/src/shared/components/Sidebar.js @@ -7,7 +7,7 @@ import { usePathname } from "next/navigation"; import { cn } from "@/shared/utils/cn"; import { APP_CONFIG, UPDATER_CONFIG } from "@/shared/constants/config"; import { MEDIA_PROVIDER_KINDS } from "@/shared/constants/providers"; -import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard"; + import Button from "./Button"; import { ConfirmModal } from "./Modal"; @@ -41,14 +41,7 @@ export default function Sidebar({ onClose }) { const [isShuttingDown, setIsShuttingDown] = useState(false); const [isDisconnected, setIsDisconnected] = useState(false); const [updateInfo, setUpdateInfo] = useState(null); - const [showUpdateModal, setShowUpdateModal] = useState(false); - const [isUpdating, setIsUpdating] = useState(false); - const [updateStatus, setUpdateStatus] = useState(null); - const [enableTranslator, setEnableTranslator] = useState(false); - const { copied, copy } = useCopyToClipboard(2000); - const INSTALL_CMD = UPDATER_CONFIG.installCmd; - const STATUS_URL = `http://localhost:${UPDATER_CONFIG.statusPort}/update/status`; useEffect(() => { fetch("/api/settings") @@ -72,40 +65,7 @@ export default function Sidebar({ onClose }) { return pathname.startsWith(href); }; - const handleUpdate = async () => { - setIsUpdating(true); - setShowUpdateModal(false); - try { - const res = await fetch("/api/version/update", { method: "POST" }); - if (!res.ok) { - const data = await res.json().catch(() => ({})); - alert(data.message || "Update failed. Please run the install command manually."); - setIsUpdating(false); - return; - } - setIsDisconnected(true); - } catch (e) { - setIsDisconnected(true); - } - }; - // Poll updater status server while updating (Next server is dead, updater.js is alive) - useEffect(() => { - if (!isUpdating || !isDisconnected) return; - let stopped = false; - const tick = async () => { - try { - const res = await fetch(STATUS_URL, { cache: "no-store" }); - if (res.ok) { - const data = await res.json(); - if (!stopped) setUpdateStatus(data); - } - } catch { /* updater not ready yet or finished */ } - }; - tick(); - const id = setInterval(tick, UPDATER_CONFIG.statusPollIntervalMs); - return () => { stopped = true; clearInterval(id); }; - }, [isUpdating, isDisconnected, STATUS_URL]); const handleShutdown = async () => { setIsShuttingDown(true); @@ -143,28 +103,18 @@ export default function Sidebar({ onClose }) { {updateInfo && ( -
+ - -
- + + npm install -g 9router@latest + + )}