mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Compare commits
7 Commits
ea7b8969ee
...
c4196eec83
Author | SHA1 | Date | |
---|---|---|---|
|
c4196eec83 | ||
|
f7b081fad4 | ||
|
527bf45f43 | ||
|
9f6fa51c5a | ||
|
4a3c88c681 | ||
|
1b00cd7bf0 | ||
|
d7f9e378fe |
@ -28,7 +28,7 @@ export async function GET(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!getEnv("NEXT_PUBLIC_ShowIpInfo")) {
|
if (!getEnv("NEXT_PUBLIC_ShowIpInfo")) {
|
||||||
return NextResponse.json({ error: "NEXT_PUBLIC_ShowIpInfo is disable" }, { status: 400 })
|
return NextResponse.json({ error: "ip info is disabled" }, { status: 400 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const { searchParams } = new URL(req.url)
|
const { searchParams } = new URL(req.url)
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
import { localeItems } from "@/i18n-metadata"
|
import { localeItems } from "@/i18n-metadata"
|
||||||
import { setUserLocale } from "@/i18n/locale"
|
import { setUserLocale } from "@/i18n/locale"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
import { CheckCircleIcon } from "@heroicons/react/20/solid"
|
import { CheckCircleIcon, LanguageIcon } from "@heroicons/react/20/solid"
|
||||||
import { useLocale } from "next-intl"
|
import { useLocale } from "next-intl"
|
||||||
|
|
||||||
export function LanguageSwitcher() {
|
export function LanguageSwitcher() {
|
||||||
@ -29,7 +29,7 @@ export function LanguageSwitcher() {
|
|||||||
size="sm"
|
size="sm"
|
||||||
className="rounded-full px-[9px] bg-white dark:bg-black cursor-pointer hover:bg-accent/50 dark:hover:bg-accent/50"
|
className="rounded-full px-[9px] bg-white dark:bg-black cursor-pointer hover:bg-accent/50 dark:hover:bg-accent/50"
|
||||||
>
|
>
|
||||||
{localeItems.find((item) => item.code === locale)?.name}
|
<LanguageIcon className="size-4" />
|
||||||
<span className="sr-only">Change language</span>
|
<span className="sr-only">Change language</span>
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
@ -164,12 +164,19 @@ const ChartTooltipContent = React.forwardRef<
|
|||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"grid min-w-[8rem] items-start gap-1.5 rounded-sm border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
"grid min-w-[8rem] items-start overflow-hidden gap-1.5 rounded-sm border border-border/50 bg-stone-100 dark:bg-stone-900 text-xs shadow-xl",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{!nestLabel ? tooltipLabel : null}
|
{!nestLabel && (
|
||||||
<div className="grid gap-1.5">
|
<p className="px-2.5 pt-1 mx-auto -mb-1">{!nestLabel ? tooltipLabel : null}</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={cn("grid gap-1.5 bg-white dark:bg-black px-2.5 py-1.5", {
|
||||||
|
"border-t-[1px]": !nestLabel,
|
||||||
|
})}
|
||||||
|
>
|
||||||
{payload.map((item, index) => {
|
{payload.map((item, index) => {
|
||||||
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
||||||
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
import type { NezhaAPI, ServerApi } from "@/app/types/nezha-api"
|
import type { NezhaAPI, ServerApi } from "@/app/types/nezha-api"
|
||||||
import type { MakeOptional } from "@/app/types/utils"
|
import type { MakeOptional } from "@/app/types/utils"
|
||||||
import getEnv from "@/lib/env-entry"
|
import getEnv from "@/lib/env-entry"
|
||||||
import { unstable_noStore as noStore } from "next/cache"
|
import { connection } from "next/server"
|
||||||
|
|
||||||
export async function GetNezhaData() {
|
export async function GetNezhaData() {
|
||||||
noStore()
|
await connection()
|
||||||
|
|
||||||
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
||||||
if (!nezhaBaseUrl) {
|
if (!nezhaBaseUrl) {
|
||||||
@ -87,6 +87,8 @@ export async function GetNezhaData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function GetServerMonitor({ server_id }: { server_id: number }) {
|
export async function GetServerMonitor({ server_id }: { server_id: number }) {
|
||||||
|
await connection()
|
||||||
|
|
||||||
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
||||||
if (!nezhaBaseUrl) {
|
if (!nezhaBaseUrl) {
|
||||||
console.error("NezhaBaseUrl is not set")
|
console.error("NezhaBaseUrl is not set")
|
||||||
@ -131,6 +133,8 @@ export async function GetServerIP({
|
|||||||
}: {
|
}: {
|
||||||
server_id: number
|
server_id: number
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
|
await connection()
|
||||||
|
|
||||||
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
||||||
if (!nezhaBaseUrl) {
|
if (!nezhaBaseUrl) {
|
||||||
console.error("NezhaBaseUrl is not set")
|
console.error("NezhaBaseUrl is not set")
|
||||||
@ -178,6 +182,7 @@ export async function GetServerIP({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function GetServerDetail({ server_id }: { server_id: number }) {
|
export async function GetServerDetail({ server_id }: { server_id: number }) {
|
||||||
|
await connection()
|
||||||
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
|
||||||
if (!nezhaBaseUrl) {
|
if (!nezhaBaseUrl) {
|
||||||
console.error("NezhaBaseUrl is not set")
|
console.error("NezhaBaseUrl is not set")
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import withPWAInit from "@ducanh2912/next-pwa"
|
import withPWAInit from "@ducanh2912/next-pwa"
|
||||||
import withBundleAnalyzer from "@next/bundle-analyzer"
|
import withBundleAnalyzer from "@next/bundle-analyzer"
|
||||||
import createNextIntlPlugin from "next-intl/plugin"
|
import createNextIntlPlugin from "next-intl/plugin"
|
||||||
import { env } from "next-runtime-env"
|
|
||||||
|
|
||||||
const bundleAnalyzer = withBundleAnalyzer({
|
const bundleAnalyzer = withBundleAnalyzer({
|
||||||
enabled: process.env.ANALYZE === "true",
|
enabled: process.env.ANALYZE === "true",
|
||||||
@ -29,7 +28,6 @@ const nextConfig = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
poweredByHeader: false,
|
|
||||||
eslint: {
|
eslint: {
|
||||||
// Warning: This allows production builds to successfully complete even if
|
// Warning: This allows production builds to successfully complete even if
|
||||||
// your project has ESLint errors.
|
// your project has ESLint errors.
|
||||||
|
17
package.json
17
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nezha-dash",
|
"name": "nezha-dash",
|
||||||
"version": "2.4.0",
|
"version": "2.5.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 3040",
|
"dev": "next dev -p 3040",
|
||||||
@ -10,9 +10,7 @@
|
|||||||
"format": "biome format --write .",
|
"format": "biome format --write .",
|
||||||
"check": "biome check",
|
"check": "biome check",
|
||||||
"check:fix": "biome check --fix",
|
"check:fix": "biome check --fix",
|
||||||
"build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/",
|
"build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/"
|
||||||
"build-dev": "next build",
|
|
||||||
"start-dev": "next start"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ducanh2912/next-pwa": "^10.2.9",
|
"@ducanh2912/next-pwa": "^10.2.9",
|
||||||
@ -28,10 +26,8 @@
|
|||||||
"@radix-ui/react-switch": "^1.1.2",
|
"@radix-ui/react-switch": "^1.1.2",
|
||||||
"@radix-ui/react-tooltip": "^1.1.7",
|
"@radix-ui/react-tooltip": "^1.1.7",
|
||||||
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
||||||
"@turf/turf": "^7.2.0",
|
|
||||||
"@types/d3-geo": "^3.1.0",
|
"@types/d3-geo": "^3.1.0",
|
||||||
"@types/luxon": "^3.4.2",
|
"@types/luxon": "^3.4.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
|
||||||
"caniuse-lite": "^1.0.30001695",
|
"caniuse-lite": "^1.0.30001695",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
@ -39,7 +35,6 @@
|
|||||||
"country-flag-icons": "^1.5.14",
|
"country-flag-icons": "^1.5.14",
|
||||||
"d3-geo": "^3.1.1",
|
"d3-geo": "^3.1.1",
|
||||||
"d3-selection": "^3.0.0",
|
"d3-selection": "^3.0.0",
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
||||||
"flag-icons": "^7.3.2",
|
"flag-icons": "^7.3.2",
|
||||||
"i18n-iso-countries": "^7.13.0",
|
"i18n-iso-countries": "^7.13.0",
|
||||||
"lucide-react": "^0.454.0",
|
"lucide-react": "^0.454.0",
|
||||||
@ -59,19 +54,15 @@
|
|||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"swr": "^2.3.0",
|
"swr": "^2.3.0",
|
||||||
"tailwind-merge": "^2.6.0",
|
"tailwind-merge": "^2.6.0",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7"
|
||||||
"typescript-eslint": "^8.21.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@next/bundle-analyzer": "^15.1.6",
|
"@next/bundle-analyzer": "^15.1.6",
|
||||||
"@tailwindcss/postcss": "^4.0.0",
|
"@tailwindcss/postcss": "^4.0.0",
|
||||||
"@types/node": "^22.10.9",
|
"@types/node": "^22.10.10",
|
||||||
"@types/react": "^19.0.8",
|
"@types/react": "^19.0.8",
|
||||||
"@types/react-dom": "^19.0.3",
|
"@types/react-dom": "^19.0.3",
|
||||||
"eslint-config-next": "^15.1.6",
|
|
||||||
"eslint-plugin-turbo": "^2.3.4",
|
|
||||||
"eslint-plugin-unused-imports": "^4.1.4",
|
|
||||||
"postcss": "^8.5.1",
|
"postcss": "^8.5.1",
|
||||||
"tailwindcss": "^4.0.0",
|
"tailwindcss": "^4.0.0",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user