feat: check NEXT_PUBLIC_ENABLE_REGISTER in /api/register

This commit is contained in:
shinya
2025-07-02 23:48:37 +08:00
parent 373268a83b
commit b941628986
2 changed files with 12 additions and 3 deletions

View File

@@ -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] 多账户
## 安全与隐私提醒

View File

@@ -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') {