From 269a1523ff4defa904af042e2eeef99d0a382db5 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sat, 27 Jul 2024 11:36:02 +0800 Subject: [PATCH 1/4] fix: fix status error --- app/(main)/ClientComponents/ServerListClient.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/(main)/ClientComponents/ServerListClient.tsx b/app/(main)/ClientComponents/ServerListClient.tsx index 494aac6..3dbfcfd 100644 --- a/app/(main)/ClientComponents/ServerListClient.tsx +++ b/app/(main)/ClientComponents/ServerListClient.tsx @@ -22,7 +22,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={server.status.Uptime > 0 ? "online" : "offline"} uptime={server.status.Uptime / 86400} mem={(server.status.MemUsed / server.host.MemTotal) * 100} stg={server.status.DiskUsed / server.host.DiskTotal} From 5e8e498be3cfff3c23c898cc7e4af44a2341ef5f Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sat, 27 Jul 2024 12:19:17 +0800 Subject: [PATCH 2/4] fix: fix server status error --- app/(main)/ClientComponents/ServerListClient.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/(main)/ClientComponents/ServerListClient.tsx b/app/(main)/ClientComponents/ServerListClient.tsx index 3dbfcfd..66b72f8 100644 --- a/app/(main)/ClientComponents/ServerListClient.tsx +++ b/app/(main)/ClientComponents/ServerListClient.tsx @@ -3,6 +3,7 @@ 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('/api/server', nezhaFetcher, { @@ -22,7 +23,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} From 62fae212df1e901609dcd4d0ce7e01029e1dbd60 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sat, 27 Jul 2024 12:21:08 +0800 Subject: [PATCH 3/4] doc: add tutorial --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9ede992..93b1d0f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@
填入 nezha 地址 (例如:http://120.5.4.32:8008) 与 token +[部署简易教程](https://buycoffee.top/blog/tech/nezha) ![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) From dd0da9d5736bd28937e01f25e452f360744d70ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=93=E9=BC=A0?= <71394853+hamster1963@users.noreply.github.com> Date: Sat, 27 Jul 2024 12:23:16 +0800 Subject: [PATCH 4/4] doc: Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 93b1d0f..ed1f032 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ -一键部署到 Vercel -
-填入 nezha 地址 (例如:http://120.5.4.32:8008) 与 token - +### 一键部署到 Vercel [部署简易教程](https://buycoffee.top/blog/tech/nezha) -![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)