本仓库为远程超声诊断平台的统一代码仓库,包含前端、后端、AI质控模块以及专网实时通信中间件。 采用 Monorepo 结构管理,方便统一版本控制,支持针对不同医院/客户进行定制化开发。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
1.2 KiB

const crypto = require('crypto');
const colors = require('colors');
// 必须与 src/licenseManager.js 中的 SECRET_SALT 完全一致
const SECRET_SALT = 'Medical_SFU_Secure_Salt_2024';
const args = process.argv.slice(2);
if (args.length < 1) {
console.log('\n使用方法: node genLicense.js <服务器机器码>\n'.yellow);
process.exit(0);
}
const machineId = args[0];
// 设置有效期为 1 年 (365天)
const expiry = Date.now() + (365 * 24 * 60 * 60 * 1000);
// 生成签名: machineId + expiry + SALT
const signature = crypto
.createHmac('sha256', SECRET_SALT)
.update(`${machineId}.${expiry}`)
.digest('hex');
const licenseCode = `${machineId}.${expiry}.${signature}`;
console.log('========================================'.blue);
console.log(' 远程超声 SFU 授权码生成成功 '.bold.white);
console.log('========================================'.blue);
console.log('[机器码]: '.cyan + machineId);
console.log('[到期日]: '.cyan + new Date(expiry).toLocaleString());
console.log('[激活码]: '.green.bold);
console.log('\n' + licenseCode + '\n');
console.log('========================================'.blue);
console.log('请将上方红色文字拷贝到服务器根目录的 license.txt 文件中。'.grey);