mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
feat: disablePrefetch config
This commit is contained in:
parent
61202b23ec
commit
3c13ff0fef
@ -1,5 +1,6 @@
|
|||||||
NezhaBaseUrl=http://1.1.1.1:8008
|
NezhaBaseUrl=http://1.1.1.1:8008
|
||||||
NezhaAuth=nezha-token
|
NezhaAuth=nezha-token
|
||||||
|
ServerDisablePrefetch=false
|
||||||
NEXT_PUBLIC_NezhaFetchInterval=2000
|
NEXT_PUBLIC_NezhaFetchInterval=2000
|
||||||
NEXT_PUBLIC_ShowFlag=true
|
NEXT_PUBLIC_ShowFlag=true
|
||||||
NEXT_PUBLIC_DisableCartoon=false
|
NEXT_PUBLIC_DisableCartoon=false
|
@ -1,16 +1,23 @@
|
|||||||
import ServerList from "@/components/ServerList";
|
import ServerList from "@/components/ServerList";
|
||||||
import ServerOverview from "@/components/ServerOverview";
|
import ServerOverview from "@/components/ServerOverview";
|
||||||
|
import getEnv from "@/lib/env-entry";
|
||||||
import { GetNezhaData } from "@/lib/serverFetch";
|
import { GetNezhaData } from "@/lib/serverFetch";
|
||||||
|
|
||||||
import { SWRConfig } from "swr";
|
import { SWRConfig } from "swr";
|
||||||
|
|
||||||
|
const disablePrefetch = getEnv("ServerDisablePrefetch") === "true";
|
||||||
|
|
||||||
|
const fallback = disablePrefetch
|
||||||
|
? {}
|
||||||
|
: {
|
||||||
|
"/api/server": GetNezhaData(),
|
||||||
|
};
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<SWRConfig
|
<SWRConfig
|
||||||
value={{
|
value={{
|
||||||
fallback: {
|
fallback: fallback,
|
||||||
"/api/server": GetNezhaData(),
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="mx-auto grid w-full max-w-5xl gap-4 md:gap-6">
|
<div className="mx-auto grid w-full max-w-5xl gap-4 md:gap-6">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
NezhaBaseUrl=http://0.0.0.0:8008
|
NezhaBaseUrl=http://0.0.0.0:8008
|
||||||
NezhaAuth=5hAY3QX6Nl9B3UOQgB26KdsdS1dsdUdM
|
NezhaAuth=5hAY3QX6Nl9B3UOQgB26KdsdS1dsdUdM
|
||||||
|
ServerDisablePrefetch=false
|
||||||
NEXT_PUBLIC_NezhaFetchInterval=5000
|
NEXT_PUBLIC_NezhaFetchInterval=5000
|
||||||
NEXT_PUBLIC_ShowFlag=true
|
NEXT_PUBLIC_ShowFlag=true
|
||||||
NEXT_PUBLIC_DisableCartoon=true
|
NEXT_PUBLIC_DisableCartoon=true
|
Loading…
Reference in New Issue
Block a user