mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Merge branch 'main' into cloudflare
This commit is contained in:
commit
8e4545f72a
55
.github/workflows/Deploy.yml
vendored
55
.github/workflows/Deploy.yml
vendored
@ -10,33 +10,6 @@ env:
|
|||||||
ALIYUN_REGISTRY_IMAGE: registry.cn-guangzhou.aliyuncs.com/hamster-home/nezha-dash
|
ALIYUN_REGISTRY_IMAGE: registry.cn-guangzhou.aliyuncs.com/hamster-home/nezha-dash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changelog:
|
|
||||||
name: Generate Changelog
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
release_body: ${{ steps.git-cliff.outputs.content }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Generate a changelog
|
|
||||||
uses: orhun/git-cliff-action@v4
|
|
||||||
id: git-cliff
|
|
||||||
with:
|
|
||||||
config: git-cliff-config/cliff.toml
|
|
||||||
args: -vv --latest --strip 'footer'
|
|
||||||
env:
|
|
||||||
OUTPUT: CHANGES.md
|
|
||||||
- name: Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
|
||||||
body: ${{ steps.git-cliff.outputs.content }}
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
env:
|
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
name: Build and push Docker image
|
name: Build and push Docker image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -76,3 +49,31 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
name: Generate Changelog
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-and-push
|
||||||
|
outputs:
|
||||||
|
release_body: ${{ steps.git-cliff.outputs.content }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Generate a changelog
|
||||||
|
uses: orhun/git-cliff-action@v4
|
||||||
|
id: git-cliff
|
||||||
|
with:
|
||||||
|
config: git-cliff-config/cliff.toml
|
||||||
|
args: -vv --latest --strip 'footer'
|
||||||
|
env:
|
||||||
|
OUTPUT: CHANGES.md
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
with:
|
||||||
|
body: ${{ steps.git-cliff.outputs.content }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
env:
|
||||||
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
|
@ -47,12 +47,20 @@ export function NetworkChartClient({ server_id }: { server_id: number }) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (error)
|
if (error) {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<div className="flex flex-col items-center justify-center">
|
<div className="flex flex-col items-center justify-center">
|
||||||
<p className="text-sm font-medium opacity-40">{error.message}</p>
|
<p className="text-sm font-medium opacity-40">{error.message}</p>
|
||||||
|
<p className="text-sm font-medium opacity-40">
|
||||||
|
{t("chart_fetch_error_message")}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<NetworkChartLoading />
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!data) return <NetworkChartLoading />;
|
if (!data) return <NetworkChartLoading />;
|
||||||
|
|
||||||
function transformData(data: NezhaAPIMonitor[]) {
|
function transformData(data: NezhaAPIMonitor[]) {
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
import { BackIcon } from "@/components/Icon";
|
import { BackIcon } from "@/components/Icon";
|
||||||
import { Loader } from "@/components/loading/Loader";
|
import { Loader } from "@/components/loading/Loader";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
|
import { useLocale } from "next-intl";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function NetworkChartLoading() {
|
export default function NetworkChartLoading() {
|
||||||
|
const router = useRouter();
|
||||||
|
const locale = useLocale();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
|
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
|
||||||
<div className="flex flex-1 flex-col justify-center gap-1 px-6 py-5">
|
<div className="flex flex-1 flex-col justify-center gap-1 px-6 py-5">
|
||||||
<CardTitle className="flex items-center gap-0.5 text-xl">
|
<CardTitle
|
||||||
|
onClick={() => {
|
||||||
|
router.push(`/${locale}/`);
|
||||||
|
}}
|
||||||
|
className="flex items-center cursor-pointer gap-0.5 text-xl"
|
||||||
|
>
|
||||||
<BackIcon />
|
<BackIcon />
|
||||||
<div className="aspect-auto h-[20px] w-24 bg-muted"></div>
|
<div className="aspect-auto h-[20px] w-24 bg-muted"></div>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useTranslations } from "next-intl";
|
import { ServerApi } from "@/app/[locale]/types/nezha-api";
|
||||||
import Image from "next/image";
|
|
||||||
import useSWR from "swr";
|
|
||||||
|
|
||||||
import { Loader } from "@/components/loading/Loader";
|
import { Loader } from "@/components/loading/Loader";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { formatBytes, nezhaFetcher } from "@/lib/utils";
|
import { formatBytes, nezhaFetcher } from "@/lib/utils";
|
||||||
import blogMan from "@/public/blog-man.webp";
|
import blogMan from "@/public/blog-man.webp";
|
||||||
import { ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { useTranslations } from "next-intl";
|
||||||
|
import Image from "next/image";
|
||||||
|
import useSWR from "swr";
|
||||||
|
|
||||||
export default function ServerOverviewClient() {
|
export default function ServerOverviewClient() {
|
||||||
const t = useTranslations("ServerOverviewClient");
|
const t = useTranslations("ServerOverviewClient");
|
||||||
|
@ -39,7 +39,7 @@ export const viewport: Viewport = {
|
|||||||
// optimization: force static for vercel
|
// optimization: force static for vercel
|
||||||
export const dynamic = process.env.VERCEL ? "force-static" : "auto";
|
export const dynamic = process.env.VERCEL ? "force-static" : "auto";
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = "edge";
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
return locales.map((locale) => ({ locale }));
|
return locales.map((locale) => ({ locale }));
|
||||||
|
@ -2,8 +2,7 @@ import { useTranslations } from "next-intl";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = "edge";
|
||||||
|
|
||||||
|
|
||||||
export default function NotFoundPage() {
|
export default function NotFoundPage() {
|
||||||
const t = useTranslations("NotFoundPage");
|
const t = useTranslations("NotFoundPage");
|
||||||
|
@ -2,7 +2,7 @@ import { ServerMonitorChart } from "@/app/[locale]/types/nezha-api";
|
|||||||
import { GetServerMonitor } from "@/lib/serverFetch";
|
import { GetServerMonitor } from "@/lib/serverFetch";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = "edge";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { NezhaAPI, ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPI, ServerApi } from "@/app/[locale]/types/nezha-api";
|
||||||
import { MakeOptional } from "@/app/[locale]/types/utils";
|
import { MakeOptional } from "@/app/[locale]/types/utils";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
@ -6,14 +5,13 @@ import { NextResponse } from "next/server";
|
|||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = "edge";
|
||||||
|
|
||||||
interface NezhaDataResponse {
|
interface NezhaDataResponse {
|
||||||
error?: string;
|
error?: string;
|
||||||
data?: ServerApi;
|
data?: ServerApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function GET(_: Request) {
|
export async function GET(_: Request) {
|
||||||
const response = (await GetNezhaData()) as NezhaDataResponse;
|
const response = (await GetNezhaData()) as NezhaDataResponse;
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
@ -24,7 +22,6 @@ export async function GET(_: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function GetNezhaData() {
|
async function GetNezhaData() {
|
||||||
|
|
||||||
var nezhaBaseUrl = getEnv("NezhaBaseUrl");
|
var nezhaBaseUrl = getEnv("NezhaBaseUrl");
|
||||||
if (!nezhaBaseUrl) {
|
if (!nezhaBaseUrl) {
|
||||||
console.log("NezhaBaseUrl is not set");
|
console.log("NezhaBaseUrl is not set");
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
||||||
|
import ServerCardPopover from "@/components/ServerCardPopover";
|
||||||
|
import ServerFlag from "@/components/ServerFlag";
|
||||||
import ServerUsageBar from "@/components/ServerUsageBar";
|
import ServerUsageBar from "@/components/ServerUsageBar";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import {
|
import {
|
||||||
@ -10,10 +13,6 @@ import { useLocale, useTranslations } from "next-intl";
|
|||||||
import { env } from "next-runtime-env";
|
import { env } from "next-runtime-env";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
|
||||||
import ServerCardPopover from "@/components/ServerCardPopover";
|
|
||||||
import ServerFlag from "@/components/ServerFlag";
|
|
||||||
|
|
||||||
export default function ServerCard({
|
export default function ServerCard({
|
||||||
serverInfo,
|
serverInfo,
|
||||||
}: {
|
}: {
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
||||||
import { cn, formatBytes } from "@/lib/utils";
|
import { cn, formatBytes } from "@/lib/utils";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
|
||||||
|
|
||||||
export function ServerCardPopoverCard({
|
export function ServerCardPopoverCard({
|
||||||
className,
|
className,
|
||||||
title,
|
title,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
import ServerListClient from "@/app/[locale]/(main)/ClientComponents/ServerListClient";
|
import ServerListClient from "@/app/[locale]/(main)/ClientComponents/ServerListClient";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default async function ServerList() {
|
export default async function ServerList() {
|
||||||
return <ServerListClient />;
|
return <ServerListClient />;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { unstable_noStore as noStore } from "next/cache";
|
|
||||||
|
|
||||||
import { NezhaAPI, ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPI, ServerApi } from "@/app/[locale]/types/nezha-api";
|
||||||
import { MakeOptional } from "@/app/[locale]/types/utils";
|
import { MakeOptional } from "@/app/[locale]/types/utils";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
|
import { unstable_noStore as noStore } from "next/cache";
|
||||||
|
|
||||||
export async function GetNezhaData() {
|
export async function GetNezhaData() {
|
||||||
noStore();
|
noStore();
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
||||||
import { type ClassValue, clsx } from "clsx";
|
import { type ClassValue, clsx } from "clsx";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
|
||||||
|
|
||||||
export function cn(...inputs: ClassValue[]) {
|
export function cn(...inputs: ClassValue[]) {
|
||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
"Offline": "Offline"
|
"Offline": "Offline"
|
||||||
},
|
},
|
||||||
"NetworkChartClient": {
|
"NetworkChartClient": {
|
||||||
"avg_delay": "Latency"
|
"avg_delay": "Latency",
|
||||||
|
"chart_fetch_error_message": "Failed to fetch network data, please check if the server monitoring is enabled"
|
||||||
},
|
},
|
||||||
"NetworkChart": {
|
"NetworkChart": {
|
||||||
"ServerMonitorCount": "Services"
|
"ServerMonitorCount": "Services"
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
"Offline": "オフライン"
|
"Offline": "オフライン"
|
||||||
},
|
},
|
||||||
"NetworkChartClient": {
|
"NetworkChartClient": {
|
||||||
"avg_delay": "遅延"
|
"avg_delay": "遅延",
|
||||||
|
"chart_fetch_error_message": "ネットワークデータの取得に失敗しました。サーバーの監視が有効になっているかどうかを確認してください"
|
||||||
},
|
},
|
||||||
"NetworkChart": {
|
"NetworkChart": {
|
||||||
"ServerMonitorCount": "サービス"
|
"ServerMonitorCount": "サービス"
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
"Offline": "離線"
|
"Offline": "離線"
|
||||||
},
|
},
|
||||||
"NetworkChartClient": {
|
"NetworkChartClient": {
|
||||||
"avg_delay": "延遲"
|
"avg_delay": "延遲",
|
||||||
|
"chart_fetch_error_message": "獲取網絡數據失敗,請檢查是否開啟服務端監控"
|
||||||
},
|
},
|
||||||
"NetworkChart": {
|
"NetworkChart": {
|
||||||
"ServerMonitorCount": "個監測服務"
|
"ServerMonitorCount": "個監測服務"
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
"Offline": "离线"
|
"Offline": "离线"
|
||||||
},
|
},
|
||||||
"NetworkChartClient": {
|
"NetworkChartClient": {
|
||||||
"avg_delay": "延迟"
|
"avg_delay": "延迟",
|
||||||
|
"chart_fetch_error_message": "获取网络数据失败,请检查是否开启服务端监控"
|
||||||
},
|
},
|
||||||
"NetworkChart": {
|
"NetworkChart": {
|
||||||
"ServerMonitorCount": "个监控服务"
|
"ServerMonitorCount": "个监控服务"
|
||||||
|
Loading…
Reference in New Issue
Block a user