mirror of https://github.com/certd/certd
chore: 1
parent
41b9837582
commit
c28f3cdcf7
|
@ -3,8 +3,8 @@ import { logger } from "../utils/index.js";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const SecreteKey =
|
const SecreteKey =
|
||||||
"LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJDZ0tDQVFFQXY3TGtMaUp1dGM0NzhTU3RaTExjajVGZXh1YjJwR2NLMGxwa0hwVnlZWjhMY29rRFhuUlAKUGQ5UlJSTVRTaGJsbFl2Mzd4QUhOV1ZIQ0ZsWHkrQklVU001bUlBU1NDQTV0azlJNmpZZ2F4bEFDQm1BY0lGMwozKzBjeGZIYVkrVW9YdVluMkZ6YUt2Ym5GdFZIZ0lkMDg4a3d4clZTZzlCT3BDRVZIR1pxR2I5TWN5MXVHVXhUClFTVENCbmpoTWZlZ0p6cXVPYWVOY0ZPSE5tbmtWRWpLTythbTBPeEhNS1lyS3ZnQnVEbzdoVnFENlBFMUd6V3AKZHdwZUV4QXZDSVJxL2pWTkdRK3FtMkRWOVNJZ3U5bmF4MktmSUtFeU50dUFFS1VpekdqL0VmRFhDM1cxMExhegpKaGNYNGw1SUFZU1o3L3JWVmpGbExWSVl0WDU1T054L1Z3SURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K";
|
"LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJDZ0tDQVFFQW9VWE1EWUhjdi82WFROWEZFSUI2RlpuR2FER0cwZnR5bTV1dVhPck9NaVl0UkxSb1lvSGMKNVZxenE0N00rdEFqRFBhaTBlOFhWS1c3aytUQUw3MUs0N2JCQVEyWTBxNU5Ya3lYcE5PTVdueVFMYXBwb0tWNgpPMkFJMnpFVURWMVJVa0ZtMFZTVjU0VXNzMDcrdjI2aW5aQU1CWitDMU42eWFDc2tZL3grNnVlNkVRNVcyZXdFCjZOWEhJcUU1bHdEUmU2SXJtdEpnU2doSnlHTS91azIyejN6NGEraFVPVUlWMy9DbEhYV0VhRHBBRFFsakt3NSsKeHR0dURiTHZyUmdzdWp6czB0dEI2OE1SbXE0R0FJL0JtNWVPWkhlNGxFQjBFVVhFUXdVWE1jV1N1VFZSMUE2cApUM21LRGo5MGcwVDFZUlNOdE5TMm9aRzgvRWIwOVlxK3Z3SURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K";
|
||||||
export const appKey = "z4nXOeTeSnnpUpnmsV";
|
export const appKey = "kQth6FHM71IPV3qdWc";
|
||||||
export type LicenseVerifyReq = {
|
export type LicenseVerifyReq = {
|
||||||
subjectId: string;
|
subjectId: string;
|
||||||
license: string;
|
license: string;
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
import PiContainer from "./container.vue";
|
import PiContainer from "./container.vue";
|
||||||
import PiAccessSelector from "../views/certd/access/access-selector/index.vue";
|
import PiAccessSelector from "../views/certd/access/access-selector/index.vue";
|
||||||
import PiDnsProviderSelector from "./dns-provider-selector/index.vue";
|
import PiDnsProviderSelector from "./dns-provider-selector/index.vue";
|
||||||
import PiOutputSelector from "../views/certd/pipeline/pipeline/component/output-selector/index.vue";import PiEditable from "./editable.vue";
|
import PiOutputSelector from "../views/certd/pipeline/pipeline/component/output-selector/index.vue";
|
||||||
|
import PiEditable from "./editable.vue";
|
||||||
|
import VipButton from "./vip-button/index.vue";
|
||||||
import { CheckCircleOutlined, InfoCircleOutlined, UndoOutlined } from "@ant-design/icons-vue";
|
import { CheckCircleOutlined, InfoCircleOutlined, UndoOutlined } from "@ant-design/icons-vue";
|
||||||
export default {
|
export default {
|
||||||
install(app:any) {
|
install(app: any) {
|
||||||
app.component("PiContainer", PiContainer);
|
app.component("PiContainer", PiContainer);
|
||||||
app.component("PiAccessSelector", PiAccessSelector);
|
app.component("PiAccessSelector", PiAccessSelector);
|
||||||
app.component("PiEditable", PiEditable);
|
app.component("PiEditable", PiEditable);
|
||||||
app.component("PiOutputSelector", PiOutputSelector);
|
app.component("PiOutputSelector", PiOutputSelector);
|
||||||
app.component("PiDnsProviderSelector", PiDnsProviderSelector);
|
app.component("PiDnsProviderSelector", PiDnsProviderSelector);
|
||||||
|
app.component("VipButton", VipButton);
|
||||||
|
|
||||||
app.component("CheckCircleOutlined", CheckCircleOutlined);
|
app.component("CheckCircleOutlined", CheckCircleOutlined);
|
||||||
app.component("InfoCircleOutlined", InfoCircleOutlined);
|
app.component("InfoCircleOutlined", InfoCircleOutlined);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { request } from "/@/api/service";
|
import { request } from "/src/api/service";
|
||||||
|
|
||||||
export async function doActive(form: any) {
|
export async function doActive(form: any) {
|
||||||
return await request({
|
return await request({
|
|
@ -15,7 +15,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { ref, reactive } from "vue";
|
import { ref, reactive } from "vue";
|
||||||
import { useUserStore } from "/@/store/modules/user";
|
import { useUserStore } from "/src/store/modules/user";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { message, Modal } from "ant-design-vue";
|
import { message, Modal } from "ant-design-vue";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
|
@ -18,7 +18,7 @@
|
||||||
<MenuFoldOutlined v-else />
|
<MenuFoldOutlined v-else />
|
||||||
</div>
|
</div>
|
||||||
<fs-menu class="header-menu" mode="horizontal" :expand-selected="false" :selectable="false" :menus="frameworkMenus" />
|
<fs-menu class="header-menu" mode="horizontal" :expand-selected="false" :selectable="false" :menus="frameworkMenus" />
|
||||||
<vip-info class="flex-center header-btn"></vip-info>
|
<vip-button class="flex-center header-btn"></vip-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-right header-buttons">
|
<div class="header-right header-buttons">
|
||||||
<!-- <button-->
|
<!-- <button-->
|
||||||
|
@ -83,11 +83,11 @@ import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons-vue";
|
||||||
import FsThemeSet from "/@/layout/components/theme/index.vue";
|
import FsThemeSet from "/@/layout/components/theme/index.vue";
|
||||||
import { env } from "../utils/util.env";
|
import { env } from "../utils/util.env";
|
||||||
import FsThemeModeSet from "./components/theme/mode-set.vue";
|
import FsThemeModeSet from "./components/theme/mode-set.vue";
|
||||||
import VipInfo from "./components/vip-info/index.vue";
|
import VipButton from "/@/components/vip-button/index.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "LayoutFramework",
|
name: "LayoutFramework",
|
||||||
// eslint-disable-next-line vue/no-unused-components
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
components: { FsThemeSet, MenuFoldOutlined, MenuUnfoldOutlined, FsMenu, FsLocale, FsSourceLink, FsUserInfo, FsTabs, FsThemeModeSet, VipInfo },
|
components: { FsThemeSet, MenuFoldOutlined, MenuUnfoldOutlined, FsMenu, FsLocale, FsSourceLink, FsUserInfo, FsTabs, FsThemeModeSet, VipButton },
|
||||||
setup() {
|
setup() {
|
||||||
const resourceStore = useResourceStore();
|
const resourceStore = useResourceStore();
|
||||||
const frameworkMenus = computed(() => {
|
const frameworkMenus = computed(() => {
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
<a-form-item label="使用邮件代理" name="usePlus">
|
<a-form-item label="使用邮件代理" name="usePlus">
|
||||||
<a-switch v-model:checked="formState.usePlus" :disabled="!userStore.isPlus" />
|
<a-switch v-model:checked="formState.usePlus" :disabled="!userStore.isPlus" />
|
||||||
<div class="helper">专业版功能,免除繁琐的邮件配置,直接发邮件</div>
|
<div class="helper">专业版功能,免除繁琐的邮件配置,直接发邮件</div>
|
||||||
|
<div>
|
||||||
|
<vip-button></vip-button>
|
||||||
|
</div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<template v-if="!formState.usePlus">
|
<template v-if="!formState.usePlus">
|
||||||
<a-form-item label="SMTP域名" name="host" :rules="[{ required: true, message: '请输入smtp域名或ip' }]">
|
<a-form-item label="SMTP域名" name="host" :rules="[{ required: true, message: '请输入smtp域名或ip' }]">
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
koa:
|
koa:
|
||||||
port: 7001
|
port: 7001
|
||||||
|
|
||||||
|
plus:
|
||||||
|
server:
|
||||||
|
baseUrl: 'http://127.0.0.1:11007'
|
||||||
|
|
|
@ -11,3 +11,6 @@ typeorm:
|
||||||
password: root
|
password: root
|
||||||
database: postgres
|
database: postgres
|
||||||
|
|
||||||
|
plus:
|
||||||
|
server:
|
||||||
|
baseUrl: 'https://api.ai.handsfree.work'
|
||||||
|
|
|
@ -8,4 +8,5 @@ typeorm:
|
||||||
|
|
||||||
|
|
||||||
plus:
|
plus:
|
||||||
serverBaseUrl: 'https://api.ai.handsfree.work/'
|
server:
|
||||||
|
baseUrl: 'https://api.ai.handsfree.work'
|
||||||
|
|
|
@ -42,10 +42,13 @@ export class EmailService implements IEmailService {
|
||||||
* receivers: string[];
|
* receivers: string[];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
await this.plusService.request('/activation/emailSend', {
|
await this.plusService.request({
|
||||||
subject: email.subject,
|
url: '/activation/emailSend',
|
||||||
text: email.content,
|
data: {
|
||||||
to: email.receivers,
|
subject: email.subject,
|
||||||
|
text: email.content,
|
||||||
|
to: email.receivers,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
||||||
import { SysInstallInfo } from '../../system/service/models.js';
|
import { SysInstallInfo } from '../../system/service/models.js';
|
||||||
import { appKey, getPlusInfo } from '@certd/pipeline';
|
import { appKey, getPlusInfo } from '@certd/pipeline';
|
||||||
|
@ -11,8 +11,16 @@ import { logger } from '../../../utils/logger.js';
|
||||||
export class PlusService {
|
export class PlusService {
|
||||||
@Inject()
|
@Inject()
|
||||||
sysSettingsService: SysSettingsService;
|
sysSettingsService: SysSettingsService;
|
||||||
|
@Config('plus.server.baseUrl')
|
||||||
|
plusServerBaseUrl;
|
||||||
|
|
||||||
async request(url: string, data: any) {
|
async requestWithoutSign(config: any) {
|
||||||
|
config.baseURL = this.plusServerBaseUrl;
|
||||||
|
return await request(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
async request(config: any) {
|
||||||
|
const { url, data } = config;
|
||||||
const timestamps = Date.now();
|
const timestamps = Date.now();
|
||||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||||
const sign = await this.sign(data, timestamps);
|
const sign = await this.sign(data, timestamps);
|
||||||
|
@ -29,10 +37,9 @@ export class PlusService {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Plus-Subject': requestHeaderStr,
|
'X-Plus-Subject': requestHeaderStr,
|
||||||
};
|
};
|
||||||
const baseUrl = 'http://127.0.0.1:11007';
|
|
||||||
return await request({
|
return await request({
|
||||||
url: url,
|
url: url,
|
||||||
baseURL: baseUrl,
|
baseURL: this.plusServerBaseUrl,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: data,
|
data: data,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
|
@ -51,4 +58,12 @@ export class PlusService {
|
||||||
logger.info('content:', content, 'sign:', sign);
|
logger.info('content:', content, 'sign:', sign);
|
||||||
return sign;
|
return sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async active(formData: { code: any; appKey: string; subjectId: string }) {
|
||||||
|
return await this.requestWithoutSign({
|
||||||
|
url: '/activation/active',
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { BaseController } from '../../../basic/base-controller.js';
|
||||||
import { appKey, verify } from '@certd/pipeline';
|
import { appKey, verify } from '@certd/pipeline';
|
||||||
import { SysInstallInfo, SysLicenseInfo } from '../service/models.js';
|
import { SysInstallInfo, SysLicenseInfo } from '../service/models.js';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '../../../utils/logger.js';
|
||||||
import { request } from '../../../utils/http.js';
|
import { PlusService } from '../../basic/service/plus-service.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +14,9 @@ export class SysPlusController extends BaseController {
|
||||||
@Inject()
|
@Inject()
|
||||||
sysSettingsService: SysSettingsService;
|
sysSettingsService: SysSettingsService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
plusService: PlusService;
|
||||||
|
|
||||||
@Post('/active', { summary: 'sys:settings:edit' })
|
@Post('/active', { summary: 'sys:settings:edit' })
|
||||||
async active(@Body(ALL) body) {
|
async active(@Body(ALL) body) {
|
||||||
const { code } = body;
|
const { code } = body;
|
||||||
|
@ -24,11 +27,7 @@ export class SysPlusController extends BaseController {
|
||||||
subjectId: installInfo.siteId,
|
subjectId: installInfo.siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
const res: any = await request({
|
const res: any = await this.plusService.active(formData);
|
||||||
url: 'http://localhost:11007/activation/active',
|
|
||||||
method: 'post',
|
|
||||||
data: formData,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (res.code > 0) {
|
if (res.code > 0) {
|
||||||
logger.error('激活失败', res.message);
|
logger.error('激活失败', res.message);
|
||||||
|
|
Loading…
Reference in New Issue