From 0f435ee7c169b90a40b6eb2937368bee6cbaf7e5 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Wed, 12 Mar 2025 09:30:01 +0800 Subject: [PATCH] feat: add boot time display to server details and update localization --- .../ClientComponents/detail/ServerDetailClient.tsx | 9 +++++++++ lib/utils.ts | 4 ++++ messages/en.json | 3 ++- messages/ja.json | 3 ++- messages/zh-t.json | 3 ++- messages/zh.json | 3 ++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/(main)/ClientComponents/detail/ServerDetailClient.tsx b/app/(main)/ClientComponents/detail/ServerDetailClient.tsx index 287905c..079b788 100644 --- a/app/(main)/ClientComponents/detail/ServerDetailClient.tsx +++ b/app/(main)/ClientComponents/detail/ServerDetailClient.tsx @@ -83,6 +83,7 @@ export default function ServerDetailClient({ net_out_transfer, net_in_transfer, last_active_time_string, + boot_time_string, } = formatNezhaInfo(serverData) return ( @@ -251,6 +252,14 @@ export default function ServerDetailClient({
+ + +
+

{t("BootTime")}

+
{boot_time_string ? boot_time_string : "N/A"}
+
+
+
diff --git a/lib/utils.ts b/lib/utils.ts index 84fd4d0..3277b52 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -16,6 +16,10 @@ export function formatNezhaInfo(serverInfo: NezhaAPISafe) { last_active_time_string: serverInfo.last_active ? new Date(serverInfo.last_active * 1000).toLocaleString() : "", + boot_time: serverInfo.host.BootTime, + boot_time_string: serverInfo.host.BootTime + ? new Date(serverInfo.host.BootTime * 1000).toLocaleString() + : "", online: serverInfo.online_status, uptime: serverInfo.status.Uptime || 0, version: serverInfo.host.Version || null, diff --git a/messages/en.json b/messages/en.json index 70fbbe2..dd879db 100644 --- a/messages/en.json +++ b/messages/en.json @@ -86,7 +86,8 @@ "Upload": "Upload", "Download": "Download", "Load": "Load", - "LastActive": "Last Active" + "LastActive": "Last Active", + "BootTime": "Boot Time" }, "ServerDetailChartClient": { "chart_fetch_error_message": "Please check your environment variables and review the server console", diff --git a/messages/ja.json b/messages/ja.json index eaef807..7d1be66 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -86,7 +86,8 @@ "Load": "負荷", "Upload": "Upload", "Download": "Download", - "LastActive": "Last Active" + "LastActive": "Last Active", + "BootTime": "Boot Time" }, "ServerDetailChartClient": { "chart_fetch_error_message": "環境変数を確認し、サーバーコンソールを確認してください", diff --git a/messages/zh-t.json b/messages/zh-t.json index 1712af2..6d67c52 100644 --- a/messages/zh-t.json +++ b/messages/zh-t.json @@ -86,7 +86,8 @@ "Upload": "上傳", "Download": "下載", "Load": "負載", - "LastActive": "最後上報時間" + "LastActive": "最後上報時間", + "BootTime": "啟動時間" }, "ServerDetailChartClient": { "chart_fetch_error_message": "獲取伺服器詳情失敗,請檢查您的環境變數並檢查伺服器控制台", diff --git a/messages/zh.json b/messages/zh.json index 626af6d..14cfc53 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -86,7 +86,8 @@ "Upload": "上传", "Download": "下载", "Load": "负载", - "LastActive": "最后上报时间" + "LastActive": "最后上报时间", + "BootTime": "启动时间" }, "ServerDetailChartClient": { "chart_fetch_error_message": "获取服务器详情失败,请检查您的环境变量并检查服务器控制台",