WuYongJie ba98bf22cc feat: 添加许可证系统、Agent部署模块和Harbor镜像管理
- 新增许可证服务器 (license-server/)
- 新增 Agent 部署模块 (flnxi-agent/)
- 添加许可证验证和激活页面
- 添加 Harbor 镜像同步脚本
- 更新素材系统支持许可证验证
2025-12-15 21:19:46 +08:00

43 lines
926 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { PrismaClient } from '@prisma/client';
import bcrypt from 'bcryptjs';
const prisma = new PrismaClient();
async function main() {
const username = process.argv[2] || 'admin';
const password = process.argv[3] || 'admin123';
// 检查是否已存在
const existing = await prisma.admin.findUnique({
where: { username },
});
if (existing) {
console.log(`管理员 "${username}" 已存在`);
return;
}
const passwordHash = await bcrypt.hash(password, 10);
await prisma.admin.create({
data: {
username,
passwordHash,
},
});
console.log(`管理员创建成功!`);
console.log(`用户名: ${username}`);
console.log(`密码: ${password}`);
console.log(`\n请登录后立即修改密码!`);
}
main()
.catch((e) => {
console.error('创建管理员失败:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});