diff --git a/app/(main)/footer.tsx b/app/(main)/footer.tsx index 5a0ba55..ce8334e 100644 --- a/app/(main)/footer.tsx +++ b/app/(main)/footer.tsx @@ -1,8 +1,6 @@ import pack from "@/package.json"; import { useTranslations } from "next-intl"; -export const experimental_ppr = true; - export default function Footer() { const t = useTranslations("Footer"); const version = pack.version; diff --git a/app/(main)/header.tsx b/app/(main)/header.tsx index a91bf97..d1dc802 100644 --- a/app/(main)/header.tsx +++ b/app/(main)/header.tsx @@ -11,8 +11,6 @@ import Image from "next/image"; import { useRouter } from "next/navigation"; import React, { useEffect, useRef, useState } from "react"; -export const experimental_ppr = true; - function Header() { const t = useTranslations("Header"); const customLogo = getEnv("NEXT_PUBLIC_CustomLogo"); diff --git a/app/(main)/page.tsx b/app/(main)/page.tsx index cf03b85..9950c54 100644 --- a/app/(main)/page.tsx +++ b/app/(main)/page.tsx @@ -3,7 +3,6 @@ import ServerOverview from "@/components/ServerOverview"; export const runtime = "edge"; -export const experimental_ppr = true;; export default function Home() { return (
diff --git a/app/layout.tsx b/app/layout.tsx index fc1eeca..912cdeb 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -48,11 +48,15 @@ export default async function LocaleLayout({ return ( - {!process.env.VERCEL && } + +
+ {fixedTopServerName && ( +
+
+ {host.Platform.includes("Windows") ? ( + + ) : ( +

+ )} +

+
+

{t("System")}

+
+ {host.Platform.includes("Windows") + ? "Windows" + : GetOsName(host.Platform)} +
+
+
+ )}

{t("CPU")}

@@ -104,28 +132,6 @@ export default function ServerCard({ : `${down.toFixed(2)}M/s`}
- {fixedTopServerName && ( - - )} - {fixedTopServerName && ( - - )}
{showNetTransfer && (
-1 + ) { + return platform; + } + if (platform == "darwin") { + return "apple"; + } + if (["openwrt", "linux", "immortalwrt"].indexOf(platform) > -1) { + return "tux"; + } + if (platform == "amazon") { + return "redhat"; + } + if (platform == "arch") { + return "archlinux"; + } + if (platform.toLowerCase().includes("opensuse")) { + return "opensuse"; + } + return "tux"; +} + +export function GetOsName(platform: string): string { + if ( + [ + "almalinux", + "alpine", + "aosc", + "apple", + "archlinux", + "archlabs", + "artix", + "budgie", + "centos", + "coreos", + "debian", + "deepin", + "devuan", + "docker", + "fedora", + "ferris", + "flathub", + "freebsd", + "gentoo", + "gnu-guix", + "illumos", + "linuxmint", + "mageia", + "mandriva", + "manjaro", + "nixos", + "openbsd", + "opensuse", + "pop-os", + "redhat", + "sabayon", + "slackware", + "snappy", + "solus", + "tux", + "ubuntu", + "void", + "zorin", + ].indexOf(platform) > -1 + ) { + return platform.charAt(0).toUpperCase() + platform.slice(1); + } + if (platform == "darwin") { + return "macOS"; + } + if (["openwrt", "linux", "immortalwrt"].indexOf(platform) > -1) { + return "Linux"; + } + if (platform == "amazon") { + return "Redhat"; + } + if (platform == "arch") { + return "Archlinux"; + } + if (platform.toLowerCase().includes("opensuse")) { + return "Opensuse"; + } + return "Linux"; +} + +export function MageMicrosoftWindows(props: SVGProps) { + return ( + + + + ); +} diff --git a/lib/utils.ts b/lib/utils.ts index 17d4186..cb2efe9 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -10,16 +10,16 @@ export function formatNezhaInfo(serverInfo: NezhaAPISafe) { return { ...serverInfo, cpu: serverInfo.status.CPU, - process: serverInfo.status.ProcessCount, - up: serverInfo.status.NetOutSpeed / 1024 / 1024, - down: serverInfo.status.NetInSpeed / 1024 / 1024, + process: serverInfo.status.ProcessCount || 0, + up: serverInfo.status.NetOutSpeed / 1024 / 1024 || 0, + down: serverInfo.status.NetInSpeed / 1024 / 1024 || 0, online: serverInfo.online_status, - tcp: serverInfo.status.TcpConnCount, - udp: serverInfo.status.UdpConnCount, - mem: (serverInfo.status.MemUsed / serverInfo.host.MemTotal) * 100, - swap: (serverInfo.status.SwapUsed / serverInfo.host.SwapTotal) * 100, - disk: (serverInfo.status.DiskUsed / serverInfo.host.DiskTotal) * 100, - stg: (serverInfo.status.DiskUsed / serverInfo.host.DiskTotal) * 100, + tcp: serverInfo.status.TcpConnCount || 0, + udp: serverInfo.status.UdpConnCount || 0, + mem: (serverInfo.status.MemUsed / serverInfo.host.MemTotal) * 100 || 0, + swap: (serverInfo.status.SwapUsed / serverInfo.host.SwapTotal) * 100 || 0, + disk: (serverInfo.status.DiskUsed / serverInfo.host.DiskTotal) * 100 || 0, + stg: (serverInfo.status.DiskUsed / serverInfo.host.DiskTotal) * 100 || 0, country_code: serverInfo.host.CountryCode, }; } diff --git a/messages/en.json b/messages/en.json index 45af1b0..0cd4436 100644 --- a/messages/en.json +++ b/messages/en.json @@ -12,6 +12,7 @@ "defaultTag": "All" }, "ServerCard": { + "System": "System", "CPU": "CPU", "Mem": "Mem", "STG": "STG", diff --git a/messages/ja.json b/messages/ja.json index af68a95..133b746 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -12,6 +12,7 @@ "defaultTag": "すべて" }, "ServerCard": { + "System": "システム", "CPU": "CPU", "Mem": "Mem", "STG": "STG", diff --git a/messages/zh-t.json b/messages/zh-t.json index 53a2e6c..0d9d18b 100644 --- a/messages/zh-t.json +++ b/messages/zh-t.json @@ -12,6 +12,7 @@ "defaultTag": "全部" }, "ServerCard": { + "System": "系統", "CPU": "CPU", "Mem": "記憶體", "STG": "儲存", diff --git a/messages/zh.json b/messages/zh.json index db036df..0a3ec83 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -12,6 +12,7 @@ "defaultTag": "全部" }, "ServerCard": { + "System": "系统", "CPU": "CPU", "Mem": "内存", "STG": "存储", diff --git a/next.config.mjs b/next.config.mjs index 5062cd1..376bd45 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -22,10 +22,6 @@ const withPWA = withPWAInit({ /** @type {import('next').NextConfig} */ const nextConfig = { output: "standalone", - experimental: { - ppr: "incremental", - }, - reactStrictMode: true, logging: { fetches: { fullUrl: true, diff --git a/package.json b/package.json index 520ba39..c9ce57f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nezha-dash", - "version": "1.2.5", + "version": "1.2.6", "private": true, "scripts": { "dev": "next dev -p 3020", @@ -22,8 +22,8 @@ "@radix-ui/react-tooltip": "^1.1.3", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/luxon": "^3.4.2", - "@typescript-eslint/eslint-plugin": "^8.12.2", - "caniuse-lite": "^1.0.30001677", + "@typescript-eslint/eslint-plugin": "^8.13.0", + "caniuse-lite": "^1.0.30001678", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "country-flag-icons": "^1.5.13", @@ -32,7 +32,7 @@ "framer-motion": "^12.0.0-alpha.1", "lucide-react": "^0.454.0", "luxon": "^3.5.0", - "next": "^15.0.3-canary.5", + "next": "^15.0.2", "next-auth": "^5.0.0-beta.25", "next-intl": "^3.24.0", "next-runtime-env": "^3.2.2", @@ -47,13 +47,13 @@ "swr": "^2.2.6-beta.4", "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", - "typescript-eslint": "^8.12.2" + "typescript-eslint": "^8.13.0" }, "devDependencies": { "eslint-plugin-turbo": "^2.2.3", "eslint-plugin-unused-imports": "^4.1.4", "@next/bundle-analyzer": "15.0.2", - "@types/node": "^22.8.7", + "@types/node": "^22.9.0", "@types/react": "npm:types-react@19.0.0-rc.1", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", "autoprefixer": "^10.4.20",