mirror of
https://github.com/andrey271192/Domain_web.git
synced 2026-09-20 14:41:58 +00:00
feat: monitors worker, auth register, scan polish
Add background DNS/SSL monitor checks, registration API, smoother SSE with stage labels, improved CDN/WAF detection, light-theme UI polish, and README roadmap updates. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
28
scripts/seed-admin.ts
Normal file
28
scripts/seed-admin.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import bcrypt from "bcryptjs";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const email = process.env.SEED_ADMIN_EMAIL?.toLowerCase();
|
||||
const password = process.env.SEED_ADMIN_PASSWORD;
|
||||
if (!email || !password) {
|
||||
console.log("[seed-admin] SEED_ADMIN_EMAIL / SEED_ADMIN_PASSWORD not set — skip");
|
||||
return;
|
||||
}
|
||||
|
||||
const passwordHash = await bcrypt.hash(password, 12);
|
||||
await prisma.user.upsert({
|
||||
where: { email },
|
||||
create: { email, passwordHash, role: "ADMIN", name: "Admin" },
|
||||
update: { passwordHash, role: "ADMIN" },
|
||||
});
|
||||
console.log(`[seed-admin] admin ready: ${email}`);
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(() => prisma.$disconnect());
|
||||
Reference in New Issue
Block a user