Merge branch 'main' into cloudflare

This commit is contained in:
hamster1963 2024-10-13 16:25:16 +08:00
commit 0170e16886
4 changed files with 34 additions and 18 deletions

View File

@ -8,3 +8,6 @@ NEXT_PUBLIC_DisableCartoon=false
NEXT_PUBLIC_ShowTag=true NEXT_PUBLIC_ShowTag=true
NEXT_PUBLIC_ShowNetTransfer=false NEXT_PUBLIC_ShowNetTransfer=false
NEXT_PUBLIC_ForceUseSvgFlag=false NEXT_PUBLIC_ForceUseSvgFlag=false
NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
NEXT_PUBLIC_CustomTitle=NezhaDash
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.

View File

@ -13,7 +13,7 @@
#### 环境变量 #### 环境变量
| 变量名 | 含义 | 示例 | | 变量名 | 含义 | 示例 |
| ------------------------------ | -------------------------------- | -------------------------------- | | ------------------------------ | -------------------------------- | ------------------------------------------------------------- |
| NezhaBaseUrl | nezha 面板地址 | http://120.x.x.x:8008 | | NezhaBaseUrl | nezha 面板地址 | http://120.x.x.x:8008 |
| NezhaAuth | nezha 面板 API Token | 5hAY3QX6Nl9B3Uxxxx26KMvOMyXS1Udi | | NezhaAuth | nezha 面板 API Token | 5hAY3QX6Nl9B3Uxxxx26KMvOMyXS1Udi |
| DefaultLocale | 面板默认显示语言(代码参考下表) | **默认**en | | DefaultLocale | 面板默认显示语言(代码参考下表) | **默认**en |
@ -24,6 +24,9 @@
| NEXT_PUBLIC_ShowTag | 是否显示标签 | **默认**false | | NEXT_PUBLIC_ShowTag | 是否显示标签 | **默认**false |
| NEXT_PUBLIC_ShowNetTransfer | 是否显示流量信息 | **默认**false | | NEXT_PUBLIC_ShowNetTransfer | 是否显示流量信息 | **默认**false |
| NEXT_PUBLIC_ForceUseSvgFlag | 是否强制使用SVG旗帜 | **默认**false | | NEXT_PUBLIC_ForceUseSvgFlag | 是否强制使用SVG旗帜 | **默认**false |
| NEXT_PUBLIC_CustomLogo | 自定义Logo | **示例**https://nezha-cf.buycoffee.top/apple-touch-icon.png |
| NEXT_PUBLIC_CustomTitle | 自定义标题 | |
| NEXT_PUBLIC_CustomDescription | 自定义描述(无多语言支持) | |
#### 多语言支持 #### 多语言支持

View File

@ -3,6 +3,7 @@
import { LanguageSwitcher } from "@/components/LanguageSwitcher"; import { LanguageSwitcher } from "@/components/LanguageSwitcher";
import { ModeToggle } from "@/components/ThemeSwitcher"; import { ModeToggle } from "@/components/ThemeSwitcher";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import getEnv from "@/lib/env-entry";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import Image from "next/image"; import Image from "next/image";
@ -10,6 +11,10 @@ import React, { useEffect, useRef, useState } from "react";
function Header() { function Header() {
const t = useTranslations("Header"); const t = useTranslations("Header");
const customLogo = getEnv("NEXT_PUBLIC_CustomLogo");
const customTitle = getEnv("NEXT_PUBLIC_CustomTitle");
const customDescription = getEnv("NEXT_PUBLIC_CustomDescription");
return ( return (
<div className="mx-auto w-full max-w-5xl"> <div className="mx-auto w-full max-w-5xl">
<section className="flex items-center justify-between"> <section className="flex items-center justify-between">
@ -20,17 +25,19 @@ function Header() {
height={40} height={40}
unoptimized unoptimized
alt="apple-touch-icon" alt="apple-touch-icon"
src={"/apple-touch-icon.png"} src={customLogo ? customLogo : "/apple-touch-icon.png"}
className="relative !m-0 h-6 w-6 border-2 border-white object-cover object-top !p-0 transition duration-500 group-hover:z-30 group-hover:scale-105" className="relative !m-0 border-2 border-transparent h-6 w-6 object-cover object-top !p-0"
/> />
</div> </div>
NezhaDash {customTitle ? customTitle : "NezhaDash"}
<Separator <Separator
orientation="vertical" orientation="vertical"
className="mx-2 hidden h-4 w-[1px] md:block" className="mx-2 hidden h-4 w-[1px] md:block"
/> />
<p className="hidden text-sm font-medium opacity-40 md:block"> <p className="hidden text-sm font-medium opacity-40 md:block">
{t("p_1079-1199_Simpleandbeautifuldashbo")} {customDescription
? customDescription
: t("p_1079-1199_Simpleandbeautifuldashbo")}
</p> </p>
</section> </section>
<section className="flex items-center gap-2"> <section className="flex items-center gap-2">

View File

@ -8,3 +8,6 @@ NEXT_PUBLIC_DisableCartoon=false
NEXT_PUBLIC_ShowTag=true NEXT_PUBLIC_ShowTag=true
NEXT_PUBLIC_ShowNetTransfer=false NEXT_PUBLIC_ShowNetTransfer=false
NEXT_PUBLIC_ForceUseSvgFlag=false NEXT_PUBLIC_ForceUseSvgFlag=false
NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
NEXT_PUBLIC_CustomTitle=NezhaDash
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.