diff --git a/.env.example b/.env.example index 735293d..dc0f887 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ NezhaBaseUrl=http://0.0.0.0:8008 -NezhaAuth=5hAY3QX6Nl9B3UOQgB26KdsdS1dsdUdM \ No newline at end of file +NezhaAuth=5hAY3QX6Nl9B3UOQgB26KdsdS1dsdUdM +NEXT_PUBLIC_NezhaFetchInterval=2 \ No newline at end of file diff --git a/app/(main)/ClientComponents/ServerListClient.tsx b/app/(main)/ClientComponents/ServerListClient.tsx index 0d3186b..192885b 100644 --- a/app/(main)/ClientComponents/ServerListClient.tsx +++ b/app/(main)/ClientComponents/ServerListClient.tsx @@ -7,7 +7,9 @@ import useSWR from "swr"; export default function ServerListClient() { const { data } = useSWR("/api/server", nezhaFetcher, { - refreshInterval: 3000, + refreshInterval: process.env.NEXT_PUBLIC_NezhaFetchInterval + ? Number(process.env.NEXT_PUBLIC_NezhaFetchInterval) + : 2000, }); if (!data) return null; const sortedResult = data.result.sort((a, b) => a.id - b.id); diff --git a/app/(main)/ClientComponents/ServerOverviewClient.tsx b/app/(main)/ClientComponents/ServerOverviewClient.tsx index d64c1d5..a919b53 100644 --- a/app/(main)/ClientComponents/ServerOverviewClient.tsx +++ b/app/(main)/ClientComponents/ServerOverviewClient.tsx @@ -9,9 +9,7 @@ import { Loader } from "@/components/loading/Loader"; import { ServerApi } from "@/app/types/nezha-api"; export default function ServerOverviewClient() { - const { data } = useSWR("/api/server", nezhaFetcher, { - refreshInterval: 30000, - }); + const { data } = useSWR("/api/server", nezhaFetcher); return (
diff --git a/app/(main)/layout.tsx b/app/(main)/layout.tsx index dcb0983..5e163b0 100644 --- a/app/(main)/layout.tsx +++ b/app/(main)/layout.tsx @@ -13,8 +13,6 @@ export default function MainLayout({ children }: DashboardProps) {
- {/* */} - {/*