chore: pipeline utils 转移到basic

This commit is contained in:
xiaojunnuo
2024-10-08 19:02:51 +08:00
parent 01b79bbeaf
commit 9498d189e4
31 changed files with 301 additions and 104 deletions
@@ -1,5 +1,6 @@
<template>
<tr v-if="cnameRecord" class="cname-record-info">
<tbody v-if="cnameRecord" class="cname-record-info">
<tr>
<!-- <td class="domain">-->
<!-- {{ props.domain }}-->
<!-- </td>-->
@@ -10,23 +11,24 @@
<fs-copyable v-model="cnameRecord.recordValue"></fs-copyable>
</td>
<td class="status center flex-center">
<fs-values-format v-model="cnameRecord.status" :dict="statusDict" />
<fs-values-format v-model="cnameRecord.status" :dict="statusDict"/>
<fs-icon icon="ion:refresh-outline" class="pointer" @click="doRefresh"></fs-icon>
</td>
</tr>
</tbody>
</template>
<script lang="ts" setup>
import { CnameRecord, GetByDomain } from "/@/components/plugins/cert/domains-verify-plan-editor/api";
import { ref, watch } from "vue";
import { dict } from "@fast-crud/fast-crud";
import {CnameRecord, GetByDomain} from "/@/components/plugins/cert/domains-verify-plan-editor/api";
import {ref, watch} from "vue";
import {dict} from "@fast-crud/fast-crud";
const statusDict = dict({
data: [
{ label: "待设置CNAME", value: "cname", color: "warning" },
{ label: "验证中", value: "validating", color: "primary" },
{ label: "验证成功", value: "valid", color: "success" },
{ label: "验证失败", value: "failed", color: "error" }
{label: "待设置CNAME", value: "cname", color: "warning"},
{label: "验证中", value: "validating", color: "primary"},
{label: "验证成功", value: "valid", color: "success"},
{label: "验证失败", value: "failed", color: "error"}
]
});
@@ -63,13 +65,13 @@ async function doRefresh() {
}
watch(
() => props.domain,
async (value) => {
await doRefresh();
},
{
immediate: true
}
() => props.domain,
async (value) => {
await doRefresh();
},
{
immediate: true
}
);
</script>
@@ -1,10 +1,14 @@
<template>
<table class="cname-verify-plan">
<thead>
<tr>
<td style="width: 160px">主机记录</td>
<td style="width: 250px">请设置CNAME记录</td>
<td style="width: 120px" class="center">状态</td>
</tr>
</thead>
<template v-for="key in domains" :key="key">
<cname-record-info :domain="key" @change="onRecordChange(key, $event)" />
</template>
@@ -7,11 +7,14 @@
<fs-icon :icon="fullscreen ? 'material-symbols:fullscreen' : 'material-symbols:fullscreen-exit'" @click="fullscreen = !fullscreen"></fs-icon>
</div>
<table class="plan-table">
<thead>
<tr>
<th>域名</th>
<th>验证方式</th>
<th>验证计划</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, key) of planRef" :key="key" class="row">
<td>{{ item.domain }}</td>
<td>
@@ -54,6 +57,7 @@
</div>
</td>
</tr>
</tbody>
</table>
<div class="error">
{{ errorMessageRef }}
+1 -1
View File
@@ -44,7 +44,7 @@
"@midwayjs/logger": "^3.1.0",
"@midwayjs/static-file": "^3.16.4",
"@midwayjs/typeorm": "^3.16.4",
"@midwayjs/upload": "3",
"@midwayjs/upload": "~3.16.4",
"@midwayjs/validate": "^3.16.4",
"ali-oss": "^6.21.0",
"axios": "^1.7.2",
@@ -1,7 +1,7 @@
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
import { SysSettingsService } from '@certd/lib-server';
import { ALL, Body, Controller, Get, Inject, Post, Provide } from '@midwayjs/core';
import { Constants, SysSettingsService } from '@certd/lib-server';
import { BaseController } from '@certd/lib-server';
import { AppKey } from '@certd/pipeline';
import { AppKey, http, PlusRequestService, verify } from '@certd/pipeline';
import { SysInstallInfo } from '@certd/lib-server';
import { logger } from '@certd/pipeline';
import { PlusService } from '@certd/lib-server';
@@ -50,6 +50,49 @@ export class SysPlusController extends BaseController {
installInfo.bindUrl = url;
await this.sysSettingsService.saveSetting(installInfo);
//重新验证配置
await this.plusService.verify();
return this.ok(true);
}
@Get('/test', { summary: Constants.per.guest })
async test() {
const subjectId = 'vpyoZb6fDBjzzSZp67OBP';
const license = '';
const timestamps = 1728365013899;
const bindUrl = 'http://89.21.0.171:7001/';
const service = new PlusRequestService({
logger: logger,
http: http,
subjectId: subjectId,
plusServerBaseUrls: ['https://api.ai.handsfree.work'],
});
const body = { subjectId, appKey: 'kQth6FHM71IPV3qdWc', url: bindUrl };
async function test() {
await verify({
subjectId: subjectId,
license: license,
plusRequestService: service,
});
const res = await service.sign(body, timestamps);
console.log('sign:', res);
const res2 = await service.request({
url: '/activation/subject/vip/check',
data: {
url: 'http://127.0.0.1:7001/',
},
});
console.log('res2:', res2);
}
console.log('2222');
await test();
console.log('3333');
return this.ok(true);
}
}