From b941628986886ac148f3b37624542815aace0386 Mon Sep 17 00:00:00 2001 From: shinya Date: Wed, 2 Jul 2025 23:48:37 +0800 Subject: [PATCH] feat: check NEXT_PUBLIC_ENABLE_REGISTER in /api/register --- README.md | 10 +++++++--- src/app/api/register/route.ts | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 91e88b2..f048c77 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,10 @@ services: redis: image: redis container_name: moontv-redis - estart: unless-stopped + restart: unless-stopped + # 如需持久化 + # volumes: + # - ./data:/data ``` ## 环境变量 @@ -228,8 +231,9 @@ MoonTV 支持标准的苹果 CMS V10 API 格式。 ## Roadmap -- [ ] DB 存储 -- [ ] 深色模式 +- [x] 深色模式 +- [x] 持久化存储 +- [x] 多账户 ## 安全与隐私提醒 diff --git a/src/app/api/register/route.ts b/src/app/api/register/route.ts index 7751f09..4a214b2 100644 --- a/src/app/api/register/route.ts +++ b/src/app/api/register/route.ts @@ -20,6 +20,11 @@ export async function POST(req: NextRequest) { ); } + // 校验是否开放注册 + if (process.env.NEXT_PUBLIC_ENABLE_REGISTER !== 'true') { + return NextResponse.json({ error: '当前未开放注册' }, { status: 400 }); + } + const { username, password } = await req.json(); if (!username || typeof username !== 'string') {