refactor: 调整系统初始化模块位置

This commit is contained in:
2026-07-28 13:40:44 +08:00
parent d719a0ca3f
commit 095efa4e64
41 changed files with 941 additions and 381 deletions
+12
View File
@@ -37,6 +37,7 @@ interface GenerateResult {
jti: string;
edition: string;
machineFingerprint: string;
maxCompanies: number | null;
expiresAt: string;
status: string;
}
@@ -114,6 +115,14 @@ async function licenseGenerate() {
validate: (v) => v.startsWith('FP-') || v === '*' || '格式应为 FP-...',
});
const defaultMaxCompanies = fingerprint === '*' ? 100 : 2;
const maxCompaniesInput = await input({
message: `最大公司数量(默认 ${defaultMaxCompanies})`,
default: String(defaultMaxCompanies),
validate: (v) => /^\d+$/.test(v) || '请输入正整数',
});
const maxCompanies = Number(maxCompaniesInput);
const edition = await select({
message: '版本类型',
choices: [
@@ -157,6 +166,7 @@ async function licenseGenerate() {
`客户 ID: ${customerId}`,
`公司: ${company}`,
`指纹: ${fingerprint}`,
`最大公司数: ${maxCompanies}`,
`版本: ${edition}`,
`过期: ${expiresAt}`,
`功能: ${features.join(', ')}`,
@@ -171,6 +181,7 @@ async function licenseGenerate() {
edition,
expiresAt: new Date(expiresAt).toISOString(),
features,
maxCompanies,
});
printBox(
@@ -178,6 +189,7 @@ async function licenseGenerate() {
[
`ID: ${result.id}`,
`JTI: ${result.jti}`,
`最大公司数: ${result.maxCompanies ?? (fingerprint === '*' ? 100 : 2)}`,
`过期: ${result.expiresAt?.slice(0, 10)}`,
'',
result.licenseKey,