Merge branch 'hamster1963:main' into main

This commit is contained in:
kuusei 2024-07-27 13:35:24 +08:00 committed by GitHub
commit 221f00527f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -5,13 +5,14 @@
</div>
一键部署到 Vercel
### 一键部署到 Vercel
[部署简易教程](https://buycoffee.top/blog/tech/nezha)
<br>
<br>
填入 nezha 地址 (例如:http://120.5.4.32:8008) 与 token
![get-token](/.github/get-token.png)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fhamster1963%2Fnezha-dash&env=NezhaBaseUrl,NezhaAuth&project-name=nezha-dash&repository-name=nezha-dash)
![screen-shot-one](/.github/shotOne.png)
![screen-shot-two](/.github/shotTwo.png)

View File

@ -4,6 +4,7 @@ import { ServerApi } from "@/app/types/nezha-api";
import ServerCard from "@/components/ServerCard";
import { nezhaFetcher } from "@/lib/utils";
import useSWR from "swr";
import { DateTime } from "luxon";
export default function ServerListClient() {
const { data } = useSWR<ServerApi>('/api/server', nezhaFetcher, {
@ -23,7 +24,7 @@ export default function ServerListClient() {
name={server.name}
up={server.status.NetOutSpeed / 1024 / 1024}
down={server.status.NetInSpeed / 1024 / 1024}
status={server.status.Uptime !== 0 ? "online" : "offline"}
status={DateTime.now().toUnixInteger() - server.last_active > 300 ? "offline" : "online"}
uptime={server.status.Uptime / 86400}
mem={(server.status.MemUsed / server.host.MemTotal) * 100}
stg={server.status.DiskUsed / server.host.DiskTotal}