mirror of https://github.com/certd/certd
chore: pipeline utils 转移到basic
parent
01b79bbeaf
commit
9498d189e4
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:prettier/recommended",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"mocha": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-var-requires": "off",
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/ban-ts-ignore": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
// "no-unused-expressions": "off",
|
||||||
|
"max-len": [0, 160, 2, { "ignoreUrls": true }]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
test/user.secret.*
|
||||||
|
test/**/*.js
|
||||||
|
src/**/*.spec.ts
|
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
src
|
||||||
|
dist/**/*.spec.*
|
|
@ -0,0 +1,2 @@
|
||||||
|
link-workspace-packages=true
|
||||||
|
prefer-workspace-packages=true
|
|
@ -1,10 +0,0 @@
|
||||||
# Change Log
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
||||||
|
|
||||||
## [1.25.9](https://github.com/certd/certd/compare/v1.25.8...v1.25.9) (2024-10-01)
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 修复西部数码账户级别apikey不可用的bug ([f8f3e8b](https://github.com/certd/certd/commit/f8f3e8b43fd5d815887bcb53b95f46dc96424b79))
|
|
|
@ -1,12 +1,68 @@
|
||||||
{
|
{
|
||||||
"name": "@certd/basic",
|
"name": "@certd/basic",
|
||||||
|
"private": false,
|
||||||
"version": "1.25.9",
|
"version": "1.25.9",
|
||||||
"main": "src/index.js",
|
"type": "module",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "echo 'basic'"
|
"dev": "vite",
|
||||||
|
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
|
||||||
|
"build": "npm run before-build && tsc --skipLibCheck",
|
||||||
|
"build3": "rollup -c",
|
||||||
|
"build2": "vue-tsc --noEmit && vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"test": "mocha --loader=ts-node/esm"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"nanoid": "^5.0.7",
|
||||||
|
"axios": "^1.7.2",
|
||||||
|
"fix-path": "^4.0.0",
|
||||||
|
"http-proxy-agent": "^7.0.2",
|
||||||
|
"https-proxy-agent": "^7.0.5",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
|
"lru-cache": "^10.0.0",
|
||||||
|
"node-forge": "^1.3.1",
|
||||||
|
"nodemailer": "^6.9.3",
|
||||||
|
"proxy-agent": "^6.4.0",
|
||||||
|
"qs": "^6.11.2",
|
||||||
|
"dayjs": "^1.11.7"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
|
"@types/lodash-es": "^4.17.12",
|
||||||
|
"@types/node-forge": "^1.3.2",
|
||||||
|
"@types/uuid": "^9.0.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
|
"@types/mocha": "^10.0.1",
|
||||||
|
"@types/chai": "^4.3.10",
|
||||||
|
"chai": "4.3.10",
|
||||||
|
"mocha": "^10.2.0",
|
||||||
|
"dayjs": "^1.11.7",
|
||||||
|
"eslint": "^8.41.0",
|
||||||
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
"eslint-plugin-import": "^2.27.5",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"iconv-lite": "^0.6.3",
|
||||||
|
"log4js": "^6.9.1",
|
||||||
|
"prettier": "^2.8.8",
|
||||||
|
"reflect-metadata": "^0.1.13",
|
||||||
|
"rimraf": "^5.0.5",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-typescript2": "^0.34.1",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"tsc-esm-fix": "^3.0.0",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
|
"typescript": "^5.4.2",
|
||||||
|
"vite": "^4.3.8",
|
||||||
|
"vue-tsc": "^1.6.5"
|
||||||
},
|
},
|
||||||
"author": "",
|
|
||||||
"license": "MIT",
|
|
||||||
"description": "",
|
|
||||||
"gitHead": "afa8155fda10f9a32427b351454b460897295a2c"
|
"gitHead": "afa8155fda10f9a32427b351454b460897295a2c"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './utils/index.js'
|
|
@ -0,0 +1,33 @@
|
||||||
|
import sleep from "./util.sleep.js";
|
||||||
|
import { http } from "./util.request.js";
|
||||||
|
export * from "./util.request.js";
|
||||||
|
export * from "./util.log.js";
|
||||||
|
export * from "./util.file.js";
|
||||||
|
export * from "./util.sp.js";
|
||||||
|
export * from "./util.promise.js";
|
||||||
|
export * from "./util.hash.js";
|
||||||
|
export * from "./util.merge.js";
|
||||||
|
export * from "./util.cache.js";
|
||||||
|
import { nanoid } from "nanoid";
|
||||||
|
import { mergeUtils } from "./util.merge.js";
|
||||||
|
import { sp } from "./util.sp.js";
|
||||||
|
import { hashUtils } from "./util.hash.js";
|
||||||
|
import { promises } from "./util.promise.js";
|
||||||
|
import { fileUtils } from "./util.file.js";
|
||||||
|
import _ from "lodash-es";
|
||||||
|
import { cache } from "./util.cache.js";
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
export const utils = {
|
||||||
|
sleep,
|
||||||
|
http,
|
||||||
|
sp,
|
||||||
|
hash: hashUtils,
|
||||||
|
promises,
|
||||||
|
file: fileUtils,
|
||||||
|
_,
|
||||||
|
mergeUtils,
|
||||||
|
cache,
|
||||||
|
nanoid,
|
||||||
|
dayjs
|
||||||
|
};
|
|
@ -1,10 +1,10 @@
|
||||||
import axios, { AxiosRequestConfig } from "axios";
|
import axios, { AxiosRequestConfig } from 'axios';
|
||||||
import { logger } from "./util.log.js";
|
import { logger } from './util.log.js';
|
||||||
import { Logger } from "log4js";
|
import { Logger } from 'log4js';
|
||||||
import { HttpProxyAgent } from "http-proxy-agent";
|
import { HttpProxyAgent } from 'http-proxy-agent';
|
||||||
import { HttpsProxyAgent } from "https-proxy-agent";
|
import { HttpsProxyAgent } from 'https-proxy-agent';
|
||||||
import nodeHttp from "http";
|
import nodeHttp from 'http';
|
||||||
import * as https from "node:https";
|
import * as https from 'node:https';
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
status?: number;
|
status?: number;
|
||||||
statusText?: string;
|
statusText?: string;
|
||||||
|
@ -18,8 +18,8 @@ export class HttpError extends Error {
|
||||||
}
|
}
|
||||||
super(error.message);
|
super(error.message);
|
||||||
|
|
||||||
if (error?.message?.indexOf("ssl3_get_record:wrong version number") >= 0) {
|
if (error?.message?.indexOf('ssl3_get_record:wrong version number') >= 0) {
|
||||||
this.message = "http协议错误,服务端要求http协议,请检查是否使用了https请求";
|
this.message = 'http协议错误,服务端要求http协议,请检查是否使用了https请求';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.name = error.name;
|
this.name = error.name;
|
||||||
|
@ -64,7 +64,7 @@ export function createAxiosService({ logger }: { logger: Logger }) {
|
||||||
}
|
}
|
||||||
let agents = defaultAgents;
|
let agents = defaultAgents;
|
||||||
if (config.skipSslVerify) {
|
if (config.skipSslVerify) {
|
||||||
logger.info("跳过SSL验证");
|
logger.info('跳过SSL验证');
|
||||||
agents = createAgent({ rejectUnauthorized: false } as any);
|
agents = createAgent({ rejectUnauthorized: false } as any);
|
||||||
}
|
}
|
||||||
delete config.skipSslVerify;
|
delete config.skipSslVerify;
|
||||||
|
@ -75,51 +75,51 @@ export function createAxiosService({ logger }: { logger: Logger }) {
|
||||||
},
|
},
|
||||||
(error: Error) => {
|
(error: Error) => {
|
||||||
// 发送失败
|
// 发送失败
|
||||||
logger.error("接口请求失败:", error);
|
logger.error('接口请求失败:', error);
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// 响应拦截
|
// 响应拦截
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
(response: any) => {
|
(response: any) => {
|
||||||
logger.info("http response:", JSON.stringify(response?.data));
|
logger.info('http response:', JSON.stringify(response?.data));
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
(error: any) => {
|
(error: any) => {
|
||||||
const status = error.response?.status;
|
const status = error.response?.status;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 400:
|
case 400:
|
||||||
error.message = "请求错误";
|
error.message = '请求错误';
|
||||||
break;
|
break;
|
||||||
case 401:
|
case 401:
|
||||||
error.message = "未授权,请登录";
|
error.message = '未授权,请登录';
|
||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
error.message = "拒绝访问";
|
error.message = '拒绝访问';
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
error.message = `请求地址出错: ${error.response.config.url}`;
|
error.message = `请求地址出错: ${error.response.config.url}`;
|
||||||
break;
|
break;
|
||||||
case 408:
|
case 408:
|
||||||
error.message = "请求超时";
|
error.message = '请求超时';
|
||||||
break;
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
error.message = "服务器内部错误";
|
error.message = '服务器内部错误';
|
||||||
break;
|
break;
|
||||||
case 501:
|
case 501:
|
||||||
error.message = "服务未实现";
|
error.message = '服务未实现';
|
||||||
break;
|
break;
|
||||||
case 502:
|
case 502:
|
||||||
error.message = "网关错误";
|
error.message = '网关错误';
|
||||||
break;
|
break;
|
||||||
case 503:
|
case 503:
|
||||||
error.message = "服务不可用";
|
error.message = '服务不可用';
|
||||||
break;
|
break;
|
||||||
case 504:
|
case 504:
|
||||||
error.message = "网关超时";
|
error.message = '网关超时';
|
||||||
break;
|
break;
|
||||||
case 505:
|
case 505:
|
||||||
error.message = "HTTP版本不受支持";
|
error.message = 'HTTP版本不受支持';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -127,12 +127,12 @@ export function createAxiosService({ logger }: { logger: Logger }) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`请求出错:status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}。`
|
`请求出错:status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}。`
|
||||||
);
|
);
|
||||||
logger.error("返回数据:", JSON.stringify(error.response?.data));
|
logger.error('返回数据:', JSON.stringify(error.response?.data));
|
||||||
if (error.response?.data) {
|
if (error.response?.data) {
|
||||||
error.message = error.response.data.message || error.response.data.msg || error.response.data.error || error.response.data;
|
error.message = error.response.data.message || error.response.data.msg || error.response.data.error || error.response.data;
|
||||||
}
|
}
|
||||||
if (error instanceof AggregateError) {
|
if (error instanceof AggregateError) {
|
||||||
logger.error("AggregateError", error);
|
logger.error('AggregateError', error);
|
||||||
}
|
}
|
||||||
const err = new HttpError(error);
|
const err = new HttpError(error);
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
|
@ -155,14 +155,14 @@ export function createAgent(opts: nodeHttp.AgentOptions = {}) {
|
||||||
let httpAgent, httpsAgent;
|
let httpAgent, httpsAgent;
|
||||||
const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
|
const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
|
||||||
if (httpProxy) {
|
if (httpProxy) {
|
||||||
logger.info("use httpProxy:", httpProxy);
|
logger.info('use httpProxy:', httpProxy);
|
||||||
httpAgent = new HttpProxyAgent(httpProxy, opts as any);
|
httpAgent = new HttpProxyAgent(httpProxy, opts as any);
|
||||||
} else {
|
} else {
|
||||||
httpAgent = new nodeHttp.Agent(opts);
|
httpAgent = new nodeHttp.Agent(opts);
|
||||||
}
|
}
|
||||||
const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
|
const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
|
||||||
if (httpsProxy) {
|
if (httpsProxy) {
|
||||||
logger.info("use httpsProxy:", httpsProxy);
|
logger.info('use httpsProxy:', httpsProxy);
|
||||||
httpsAgent = new HttpsProxyAgent(httpsProxy, opts as any);
|
httpsAgent = new HttpsProxyAgent(httpsProxy, opts as any);
|
||||||
} else {
|
} else {
|
||||||
httpsAgent = new https.Agent(opts);
|
httpsAgent = new https.Agent(opts);
|
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
"compileOnSave": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"inlineSourceMap":true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"stripInternal": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"pretty": true,
|
||||||
|
"declaration": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"typeRoots": [ "./typings", "./node_modules/@types"],
|
||||||
|
"outDir": "dist",
|
||||||
|
"rootDir": "src",
|
||||||
|
"composite": true,
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"strict": true,
|
||||||
|
// "sourceMap": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": false,
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.d.ts",
|
||||||
|
"src/**/*.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"*.js",
|
||||||
|
"*.ts",
|
||||||
|
"*.spec.ts",
|
||||||
|
"dist",
|
||||||
|
"node_modules",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
}
|
|
@ -36,14 +36,15 @@
|
||||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
"@rollup/plugin-terser": "^0.4.3",
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
"@rollup/plugin-typescript": "^11.0.0",
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
"@types/chai": "^4.3.10",
|
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/mocha": "^10.0.1",
|
|
||||||
"@types/node-forge": "^1.3.2",
|
"@types/node-forge": "^1.3.2",
|
||||||
"@types/uuid": "^9.0.2",
|
"@types/uuid": "^9.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
"@typescript-eslint/parser": "^5.59.7",
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
|
"@types/mocha": "^10.0.1",
|
||||||
|
"@types/chai": "^4.3.10",
|
||||||
"chai": "4.3.10",
|
"chai": "4.3.10",
|
||||||
|
"mocha": "^10.2.0",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
"eslint": "^8.41.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
@ -52,7 +53,6 @@
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"iconv-lite": "^0.6.3",
|
"iconv-lite": "^0.6.3",
|
||||||
"log4js": "^6.9.1",
|
"log4js": "^6.9.1",
|
||||||
"mocha": "^10.2.0",
|
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^5.0.5",
|
"rimraf": "^5.0.5",
|
||||||
|
|
|
@ -4,16 +4,15 @@ import { RunHistory, RunnableCollection } from "./run-history.js";
|
||||||
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext, UserInfo } from "../plugin/index.js";
|
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext, UserInfo } from "../plugin/index.js";
|
||||||
import { ContextFactory, IContext } from "./context.js";
|
import { ContextFactory, IContext } from "./context.js";
|
||||||
import { IStorage } from "./storage.js";
|
import { IStorage } from "./storage.js";
|
||||||
import { logger } from "../utils/util.log.js";
|
import { logger } from "../utils/index.js";
|
||||||
import { Logger } from "log4js";
|
import { Logger } from "log4js";
|
||||||
import { createAxiosService } from "../utils/util.request.js";
|
import { createAxiosService } from "../utils/index.js";
|
||||||
import { IAccessService } from "../access/index.js";
|
import { IAccessService } from "../access/index.js";
|
||||||
import { RegistryItem } from "../registry/index.js";
|
import { RegistryItem } from "../registry/index.js";
|
||||||
import { Decorator } from "../decorator/index.js";
|
import { Decorator } from "../decorator/index.js";
|
||||||
import { ICnameProxyService, IEmailService } from "../service/index.js";
|
import { ICnameProxyService, IEmailService } from "../service/index.js";
|
||||||
import { FileStore } from "./file-store.js";
|
import { FileStore } from "./file-store.js";
|
||||||
import { hashUtils, utils } from "../utils/index.js";
|
import { hashUtils, utils } from "../utils/index.js";
|
||||||
// import { TimeoutPromise } from "../utils/util.promise.js";
|
|
||||||
|
|
||||||
export type ExecutorOptions = {
|
export type ExecutorOptions = {
|
||||||
pipeline: Pipeline;
|
pipeline: Pipeline;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { HistoryResult, Pipeline, ResultType, Runnable, RunnableMap, Stage, Step, Task } from "../dt/index.js";
|
import { HistoryResult, Pipeline, ResultType, Runnable, RunnableMap, Stage, Step, Task } from "../dt/index.js";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
import { buildLogger } from "../utils/util.log.js";
|
import { buildLogger } from "../utils/index.js";
|
||||||
import { Logger } from "log4js";
|
import { Logger } from "log4js";
|
||||||
|
|
||||||
export type HistoryStatus = {
|
export type HistoryStatus = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileUtils } from "../utils/util.file.js";
|
import { fileUtils } from "../utils/index.js";
|
||||||
|
|
||||||
export interface IStorage {
|
export interface IStorage {
|
||||||
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
get(scope: string, namespace: string, version: string, key: string): Promise<string | null>;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { IAccessService } from "../access/index.js";
|
||||||
import { ICnameProxyService, IEmailService } from "../service/index.js";
|
import { ICnameProxyService, IEmailService } from "../service/index.js";
|
||||||
import { IContext, PluginRequestHandleReq, RunnableCollection } from "../core/index.js";
|
import { IContext, PluginRequestHandleReq, RunnableCollection } from "../core/index.js";
|
||||||
import { ILogger, logger, utils } from "../utils/index.js";
|
import { ILogger, logger, utils } from "../utils/index.js";
|
||||||
import { HttpClient } from "../utils/util.request.js";
|
import { HttpClient } from "../utils/index.js";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
export type UserInfo = {
|
export type UserInfo = {
|
||||||
|
|
|
@ -1,33 +1 @@
|
||||||
import sleep from "./util.sleep.js";
|
export * from "@certd/basic";
|
||||||
import { http } from "./util.request.js";
|
|
||||||
export * from "./util.request.js";
|
|
||||||
export * from "./util.log.js";
|
|
||||||
export * from "./util.file.js";
|
|
||||||
export * from "./util.sp.js";
|
|
||||||
export * from "./util.promise.js";
|
|
||||||
export * from "./util.hash.js";
|
|
||||||
export * from "./util.merge.js";
|
|
||||||
export * from "./util.cache.js";
|
|
||||||
import { nanoid } from "nanoid";
|
|
||||||
import { mergeUtils } from "./util.merge.js";
|
|
||||||
import { sp } from "./util.sp.js";
|
|
||||||
import { hashUtils } from "./util.hash.js";
|
|
||||||
import { promises } from "./util.promise.js";
|
|
||||||
import { fileUtils } from "./util.file.js";
|
|
||||||
import _ from "lodash-es";
|
|
||||||
import { cache } from "./util.cache.js";
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
export const utils = {
|
|
||||||
sleep,
|
|
||||||
http,
|
|
||||||
sp,
|
|
||||||
hash: hashUtils,
|
|
||||||
promises,
|
|
||||||
file: fileUtils,
|
|
||||||
_,
|
|
||||||
mergeUtils,
|
|
||||||
cache,
|
|
||||||
nanoid,
|
|
||||||
dayjs
|
|
||||||
};
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
"typeorm": "^0.3.20",
|
"typeorm": "^0.3.20",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
"@midwayjs/upload": "3"
|
"@midwayjs/upload": "^3.16.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mwts": "^1.3.0",
|
"mwts": "^1.3.0",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<tr v-if="cnameRecord" class="cname-record-info">
|
<tbody v-if="cnameRecord" class="cname-record-info">
|
||||||
|
<tr>
|
||||||
<!-- <td class="domain">-->
|
<!-- <td class="domain">-->
|
||||||
<!-- {{ props.domain }}-->
|
<!-- {{ props.domain }}-->
|
||||||
<!-- </td>-->
|
<!-- </td>-->
|
||||||
|
@ -10,23 +11,24 @@
|
||||||
<fs-copyable v-model="cnameRecord.recordValue"></fs-copyable>
|
<fs-copyable v-model="cnameRecord.recordValue"></fs-copyable>
|
||||||
</td>
|
</td>
|
||||||
<td class="status center flex-center">
|
<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>
|
<fs-icon icon="ion:refresh-outline" class="pointer" @click="doRefresh"></fs-icon>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { CnameRecord, GetByDomain } from "/@/components/plugins/cert/domains-verify-plan-editor/api";
|
import {CnameRecord, GetByDomain} from "/@/components/plugins/cert/domains-verify-plan-editor/api";
|
||||||
import { ref, watch } from "vue";
|
import {ref, watch} from "vue";
|
||||||
import { dict } from "@fast-crud/fast-crud";
|
import {dict} from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
const statusDict = dict({
|
const statusDict = dict({
|
||||||
data: [
|
data: [
|
||||||
{ label: "待设置CNAME", value: "cname", color: "warning" },
|
{label: "待设置CNAME", value: "cname", color: "warning"},
|
||||||
{ label: "验证中", value: "validating", color: "primary" },
|
{label: "验证中", value: "validating", color: "primary"},
|
||||||
{ label: "验证成功", value: "valid", color: "success" },
|
{label: "验证成功", value: "valid", color: "success"},
|
||||||
{ label: "验证失败", value: "failed", color: "error" }
|
{label: "验证失败", value: "failed", color: "error"}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -63,13 +65,13 @@ async function doRefresh() {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.domain,
|
() => props.domain,
|
||||||
async (value) => {
|
async (value) => {
|
||||||
await doRefresh();
|
await doRefresh();
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<table class="cname-verify-plan">
|
<table class="cname-verify-plan">
|
||||||
|
<thead>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 160px">主机记录</td>
|
<td style="width: 160px">主机记录</td>
|
||||||
<td style="width: 250px">请设置CNAME记录</td>
|
<td style="width: 250px">请设置CNAME记录</td>
|
||||||
<td style="width: 120px" class="center">状态</td>
|
<td style="width: 120px" class="center">状态</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
<template v-for="key in domains" :key="key">
|
<template v-for="key in domains" :key="key">
|
||||||
<cname-record-info :domain="key" @change="onRecordChange(key, $event)" />
|
<cname-record-info :domain="key" @change="onRecordChange(key, $event)" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -7,11 +7,14 @@
|
||||||
<fs-icon :icon="fullscreen ? 'material-symbols:fullscreen' : 'material-symbols:fullscreen-exit'" @click="fullscreen = !fullscreen"></fs-icon>
|
<fs-icon :icon="fullscreen ? 'material-symbols:fullscreen' : 'material-symbols:fullscreen-exit'" @click="fullscreen = !fullscreen"></fs-icon>
|
||||||
</div>
|
</div>
|
||||||
<table class="plan-table">
|
<table class="plan-table">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>域名</th>
|
<th>域名</th>
|
||||||
<th>验证方式</th>
|
<th>验证方式</th>
|
||||||
<th>验证计划</th>
|
<th>验证计划</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<tr v-for="(item, key) of planRef" :key="key" class="row">
|
<tr v-for="(item, key) of planRef" :key="key" class="row">
|
||||||
<td>{{ item.domain }}</td>
|
<td>{{ item.domain }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -54,6 +57,7 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="error">
|
<div class="error">
|
||||||
{{ errorMessageRef }}
|
{{ errorMessageRef }}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
"@midwayjs/logger": "^3.1.0",
|
"@midwayjs/logger": "^3.1.0",
|
||||||
"@midwayjs/static-file": "^3.16.4",
|
"@midwayjs/static-file": "^3.16.4",
|
||||||
"@midwayjs/typeorm": "^3.16.4",
|
"@midwayjs/typeorm": "^3.16.4",
|
||||||
"@midwayjs/upload": "3",
|
"@midwayjs/upload": "~3.16.4",
|
||||||
"@midwayjs/validate": "^3.16.4",
|
"@midwayjs/validate": "^3.16.4",
|
||||||
"ali-oss": "^6.21.0",
|
"ali-oss": "^6.21.0",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
import { ALL, Body, Controller, Get, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { SysSettingsService } from '@certd/lib-server';
|
import { Constants, SysSettingsService } from '@certd/lib-server';
|
||||||
import { BaseController } 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 { SysInstallInfo } from '@certd/lib-server';
|
||||||
import { logger } from '@certd/pipeline';
|
import { logger } from '@certd/pipeline';
|
||||||
import { PlusService } from '@certd/lib-server';
|
import { PlusService } from '@certd/lib-server';
|
||||||
|
@ -50,6 +50,49 @@ export class SysPlusController extends BaseController {
|
||||||
installInfo.bindUrl = url;
|
installInfo.bindUrl = url;
|
||||||
await this.sysSettingsService.saveSetting(installInfo);
|
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);
|
return this.ok(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue