fix: save config when register

This commit is contained in:
shinya
2025-07-06 22:37:38 +08:00
parent 85163964c6
commit 63a2948651

View File

@@ -49,6 +49,14 @@ export async function POST(req: NextRequest) {
}
await db.registerUser(username, password);
// 添加到配置中并保存
config.UserConfig.Users.push({
username,
role: 'user',
});
await db.saveAdminConfig(config);
return NextResponse.json({ ok: true });
} catch (err) {
console.error('数据库注册失败', err);