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
64f6bb9f01
@ -16,7 +16,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 |
|
||||||
| Site_Password | 页面密码 | 123456 |
|
| SitePassword | 页面密码 | 123456 |
|
||||||
| DefaultLocale | 面板默认显示语言 | **默认**:en [简中:zh 繁中:zh-t 英语:en 日语:ja] |
|
| DefaultLocale | 面板默认显示语言 | **默认**:en [简中:zh 繁中:zh-t 英语:en 日语:ja] |
|
||||||
| ForceShowAllServers | 是否强制显示所有服务器 | **默认**:false |
|
| ForceShowAllServers | 是否强制显示所有服务器 | **默认**:false |
|
||||||
| NEXT_PUBLIC_NezhaFetchInterval | 获取数据间隔(毫秒) | **默认**:2000 |
|
| NEXT_PUBLIC_NezhaFetchInterval | 获取数据间隔(毫秒) | **默认**:2000 |
|
||||||
|
@ -12,7 +12,7 @@ type DashboardProps = {
|
|||||||
export default async function MainLayout({ children }: DashboardProps) {
|
export default async function MainLayout({ children }: DashboardProps) {
|
||||||
const session = await auth();
|
const session = await auth();
|
||||||
|
|
||||||
if (!session && getEnv("Site_Password")) {
|
if (!session && getEnv("SitePassword")) {
|
||||||
if (getEnv("CF_PAGES")) {
|
if (getEnv("CF_PAGES")) {
|
||||||
redirect("/api/auth/signin");
|
redirect("/api/auth/signin");
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,7 +14,7 @@ interface NezhaDataResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GET = auth(async function GET(req) {
|
export const GET = auth(async function GET(req) {
|
||||||
if (!req.auth && getEnv("Site_Password")) {
|
if (!req.auth && getEnv("SitePassword")) {
|
||||||
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
|
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ interface NezhaDataResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GET = auth(async function GET(req) {
|
export const GET = auth(async function GET(req) {
|
||||||
if (!req.auth && getEnv("Site_Password")) {
|
if (!req.auth && getEnv("SitePassword")) {
|
||||||
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
|
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ interface NezhaDataResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GET = auth(async function GET(req) {
|
export const GET = auth(async function GET(req) {
|
||||||
if (!req.auth && getEnv("Site_Password")) {
|
if (!req.auth && getEnv("SitePassword")) {
|
||||||
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
|
return NextResponse.json({ message: "Not authenticated" }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
auth.ts
2
auth.ts
@ -11,7 +11,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth({
|
|||||||
password: {},
|
password: {},
|
||||||
},
|
},
|
||||||
authorize: async (credentials) => {
|
authorize: async (credentials) => {
|
||||||
if (credentials.password === getEnv("Site_Password")) {
|
if (credentials.password === getEnv("SitePassword")) {
|
||||||
return { id: "0" };
|
return { id: "0" };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user