From 162ddc1bf5dd6094ac069c8fd6199931fca030a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 22 Nov 2025 18:31:42 +0800 Subject: [PATCH] fix: #1392 & Remove update functionality from VersionInfo component Eliminated the update button and related logic from the VersionInfo component in the about page. This includes removing the useRequest hook for updating, the toast notifications, and the Button component, simplifying the component to only display version information. --- .../src/pages/dashboard/about.tsx | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/packages/napcat-webui-frontend/src/pages/dashboard/about.tsx b/packages/napcat-webui-frontend/src/pages/dashboard/about.tsx index aaa3c412..ddbed919 100644 --- a/packages/napcat-webui-frontend/src/pages/dashboard/about.tsx +++ b/packages/napcat-webui-frontend/src/pages/dashboard/about.tsx @@ -1,5 +1,4 @@ import { Card, CardBody } from '@heroui/card'; -import { Button } from '@heroui/button'; import { Image } from '@heroui/image'; import { Link } from '@heroui/link'; import { Skeleton } from '@heroui/skeleton'; @@ -8,7 +7,6 @@ import { useRequest } from 'ahooks'; import { useMemo } from 'react'; import { BsTelegram, BsTencentQq } from 'react-icons/bs'; import { IoDocument } from 'react-icons/io5'; -import toast from 'react-hot-toast'; import HoverTiltedCard from '@/components/hover_titled_card'; import NapCatRepoInfo from '@/components/napcat_repo_info'; @@ -23,40 +21,6 @@ import WebUIManager from '@/controllers/webui_manager'; function VersionInfo () { const { data, loading, error } = useRequest(WebUIManager.GetNapCatVersion); - // 更新NapCat - const { run: updateNapCat, loading: updating } = useRequest( - WebUIManager.UpdateNapCat, - { - manual: true, - onSuccess: (response) => { - console.log('UpdateNapCat onSuccess response:', response); - console.log('response.code:', response.code); - console.log('response.data:', response.data); - console.log('response.message:', response.message); - - if (response.code === 0) { - const message = response.data?.message || '更新完成'; - console.log('显示消息:', message); - toast.success(message, { - duration: 5000, - }); - } else { - console.log('显示错误消息:', response.message || '更新失败'); - toast.error(response.message || '更新失败'); - } - }, - onError: (error) => { - toast.error('更新失败: ' + error.message); - }, - } - ); - - const handleUpdate = () => { - if (!updating) { - updateNapCat(); - } - }; - return (
@@ -84,16 +48,6 @@ function VersionInfo () { /> )}
-
); }