feat: export client activation files and add Windows local launcher
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-10-12 10:13:39 +08:00
parent 099878dbba
commit fad1fba710
11 changed files with 298 additions and 2 deletions

View File

@@ -2,9 +2,17 @@
import { ref } from 'vue'
import { ElMessageBox } from 'element-plus'
import { getLicense, provisionLicenseInstance } from '../api'
import { downloadLicenseFile } from '../license-file'
const props = defineProps<{licenseId:number;hasInstance:boolean;ready:boolean}>()
const emit = defineEmits<{created:[]}>()
const busy = ref(false), error = ref('')
const exportError = ref(''), baseURL = ref('https://license.yihuiyong.cn')
function exportFile() {
if (!credentials.value) return
exportError.value = ''
try { downloadLicenseFile(credentials.value, baseURL.value) }
catch (e) { exportError.value = e instanceof Error ? e.message : '导出失败,请重试' }
}
const credentials = ref<{instance_id:string;license_key:string;secret:string}|null>(null)
async function create() {
if(busy.value || props.hasInstance || !props.ready || credentials.value || error.value) return
@@ -29,6 +37,11 @@ async function create() {
<template v-if="credentials">
<p role="status">实例已创建。请立即安全保存下列凭据,关闭窗口后不再显示激活密钥。</p>
<dl class="license-detail"><dt>实例 ID(instance_id)</dt><dd class="license-code">{{credentials.instance_id}}</dd><dt>授权码(license_key)</dt><dd class="license-code">{{credentials.license_key}}</dd><dt>激活密钥(secret)</dt><dd class="license-code">{{credentials.secret}}</dd></dl>
<label for="license-export-base-url">授权文件中的授权中心地址</label>
<el-input id="license-export-base-url" v-model="baseURL" placeholder="https://license.yihuiyong.cn" />
<el-button type="primary" @click="exportFile">导出授权文件</el-button>
<p v-if="exportError" class="error" role="alert">{{ exportError }}</p>
<p>导出的 .license.json 含激活密钥,请安全交付。客户端需支持本文件格式,导入后在线激活并获取运行租约;文件本身不代表授权有效。关闭此窗口后无法再次导出包含密钥的文件。</p>
<p>默认授权中心:https://license.yihuiyong.cn;私有部署填写实际 HTTPS 根地址。密钥仅首次展示,但客户端激活后仍需安全保存用于心跳和下载;不要放入日志、截图或普通工单。生产验签公钥应由开发团队预置。</p>
</template>
</section>