mirror of https://github.com/certd/certd
chore: lego改成从github直接下载
parent
1274f56da8
commit
1b46278f86
|
@ -17,9 +17,12 @@ services:
|
|||
# ↓↓↓↓ ---------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND等错误,可以尝试修改或注释dns配置
|
||||
- 223.5.5.5
|
||||
- 223.6.6.6
|
||||
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器在腾讯云,可以用这个dns地址
|
||||
# - 119.29.29.29
|
||||
# - 182.254.116.116
|
||||
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器部署在国外,可以用8.8.8.8替换上面的dns
|
||||
# - 8.8.8.8
|
||||
# - 8.8.4.4
|
||||
# - 8.8.8.8
|
||||
# - 8.8.4.4
|
||||
# extra_hosts:
|
||||
# ↓↓↓↓ ---------------------------------------------------------- 这里可以配置自定义hosts,外网域名可以指向本地局域网ip地址
|
||||
# - "localdomain.comm:192.168.1.3"
|
||||
|
|
|
@ -50,8 +50,14 @@ class HttpError extends Error {
|
|||
super(error.message);
|
||||
|
||||
this.message = error.message;
|
||||
if (this.message && this.message.indexOf('ssl3_get_record:wrong version number') >= 0) {
|
||||
this.message = 'http协议错误,服务端要求http协议,请检查是否使用了https请求';
|
||||
const { message } = error;
|
||||
if (message && typeof message === 'string') {
|
||||
if (message.indexOf && message.indexOf('ssl3_get_record:wrong version number') >= 0) {
|
||||
this.message = `${message}(http协议错误,服务端要求http协议,请检查是否使用了https请求)`;
|
||||
}
|
||||
else if (message.indexOf('getaddrinfo EAI_AGAIN')) {
|
||||
this.message = `${message}(无法解析域名,请检查网络连接或dns配置)`;
|
||||
}
|
||||
}
|
||||
|
||||
this.name = error.name;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
import { logger } from './util.log.js';
|
||||
import { ILogger, logger } from './util.log.js';
|
||||
import { Logger } from 'log4js';
|
||||
import { HttpProxyAgent } from 'http-proxy-agent';
|
||||
import { HttpsProxyAgent } from 'https-proxy-agent';
|
||||
import nodeHttp from 'http';
|
||||
import * as https from 'node:https';
|
||||
import { merge } from 'lodash-es';
|
||||
import { safePromise } from './util.promise';
|
||||
import { safePromise } from './util.promise.js';
|
||||
import fs from 'fs';
|
||||
export class HttpError extends Error {
|
||||
status?: number;
|
||||
|
@ -21,8 +21,13 @@ export class HttpError extends Error {
|
|||
}
|
||||
super(error.message || error.response?.statusText);
|
||||
|
||||
if (error?.message?.indexOf && error?.message?.indexOf('ssl3_get_record:wrong version number') >= 0) {
|
||||
this.message = 'http协议错误,服务端要求http协议,请检查是否使用了https请求';
|
||||
const message = error?.message;
|
||||
if (message && typeof message === 'string') {
|
||||
if (message.indexOf && message.indexOf('ssl3_get_record:wrong version number') >= 0) {
|
||||
this.message = `${message}(http协议错误,服务端要求http协议,请检查是否使用了https请求)`;
|
||||
} else if (message.indexOf('getaddrinfo EAI_AGAIN')) {
|
||||
this.message = `${message}(无法解析域名,请检查网络连接或dns配置,更换docker-compose.yaml中dns配置)`;
|
||||
}
|
||||
}
|
||||
|
||||
this.name = error.name;
|
||||
|
@ -115,7 +120,12 @@ export function createAxiosService({ logger }: { logger: Logger }) {
|
|||
service.interceptors.response.use(
|
||||
(response: any) => {
|
||||
if (response?.config?.logRes !== false) {
|
||||
logger.info(`http response : status=${response?.status},data=${JSON.stringify(response?.data)}`);
|
||||
let resData = response?.data;
|
||||
try {
|
||||
resData = JSON.stringify(response?.data);
|
||||
} catch (e) {}
|
||||
|
||||
logger.info(`http response : status=${response?.status},data=${resData}`);
|
||||
} else {
|
||||
logger.info('http response status:', response?.status);
|
||||
}
|
||||
|
@ -217,36 +227,42 @@ export function createAgent(opts: CreateAgentOptions = {}) {
|
|||
};
|
||||
}
|
||||
|
||||
export async function download(http: HttpClient, config: HttpRequestConfig, savePath: string) {
|
||||
export async function download(req: { http: HttpClient; config: HttpRequestConfig; savePath: string; logger: ILogger }) {
|
||||
const { http, config, savePath, logger } = req;
|
||||
return safePromise((resolve, reject) => {
|
||||
http
|
||||
.request({
|
||||
...config,
|
||||
logRes: false,
|
||||
responseType: 'stream',
|
||||
...config,
|
||||
})
|
||||
.then(res => {
|
||||
const writer = fs.createWriteStream(savePath);
|
||||
res.data.pipe(writer);
|
||||
res.pipe(writer);
|
||||
writer.on('close', () => {
|
||||
console.log('文件下载成功');
|
||||
logger.info('文件下载成功');
|
||||
resolve(true);
|
||||
});
|
||||
//error
|
||||
writer.on('error', err => {
|
||||
console.error('下载失败', err);
|
||||
logger.error('下载失败', err);
|
||||
reject(err);
|
||||
});
|
||||
//进度条打印
|
||||
const totalLength = res.headers['content-length'];
|
||||
let currentLength = 0;
|
||||
res.data.on('data', (chunk: any) => {
|
||||
// 每5%打印一次
|
||||
const step = (totalLength / 100) * 5;
|
||||
res.on('data', (chunk: any) => {
|
||||
currentLength += chunk.length;
|
||||
const percent = ((currentLength / totalLength) * 100).toFixed(2);
|
||||
console.log(`下载进度:${percent}%`);
|
||||
if (currentLength % step < chunk.length) {
|
||||
const percent = ((currentLength / totalLength) * 100).toFixed(2);
|
||||
logger.info(`下载进度:${percent}%`);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('下载失败', err);
|
||||
logger.info('下载失败', err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ import { RunHistory, RunnableCollection } from "./run-history.js";
|
|||
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext, UserInfo } from "../plugin/index.js";
|
||||
import { ContextFactory, IContext } from "./context.js";
|
||||
import { IStorage } from "./storage.js";
|
||||
import { createAxiosService, hashUtils, logger, utils } from "@certd/basic";
|
||||
import { createAxiosService, hashUtils, HttpRequestConfig, logger, utils } from "@certd/basic";
|
||||
import { Logger } from "log4js";
|
||||
import { IAccessService } from "../access/index.js";
|
||||
import { RegistryItem } from "../registry/index.js";
|
||||
|
@ -290,11 +290,20 @@ export class Executor {
|
|||
}
|
||||
|
||||
const http = createAxiosService({ logger: currentLogger });
|
||||
const download = async (config: HttpRequestConfig, savePath: string) => {
|
||||
await utils.download({
|
||||
http,
|
||||
logger: currentLogger,
|
||||
config,
|
||||
savePath,
|
||||
});
|
||||
};
|
||||
const taskCtx: TaskInstanceContext = {
|
||||
pipeline: this.pipeline,
|
||||
step,
|
||||
lastStatus,
|
||||
http,
|
||||
download,
|
||||
logger: currentLogger,
|
||||
inputChanged,
|
||||
accessService: this.options.accessService,
|
||||
|
|
|
@ -3,6 +3,5 @@ export * from "./run-history.js";
|
|||
export * from "./context.js";
|
||||
export * from "./storage.js";
|
||||
export * from "./file-store.js";
|
||||
export * from "./license.js";
|
||||
export * from "./handler.js";
|
||||
export * from "./exceptions.js";
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import { logger } from "@certd/basic";
|
||||
import { setLogger, isPlus, isComm } from "@certd/plus-core";
|
||||
setLogger(logger);
|
||||
export * from "@certd/plus-core";
|
||||
|
||||
export function checkPlus() {
|
||||
if (!isPlus()) {
|
||||
throw new Error("此为专业版功能,请升级到专业版");
|
||||
}
|
||||
}
|
||||
|
||||
export function checkComm() {
|
||||
if (!isComm()) {
|
||||
throw new Error("此为商业版功能,请升级到商业版");
|
||||
}
|
||||
}
|
|
@ -117,8 +117,8 @@ export class RunHistory {
|
|||
}
|
||||
|
||||
logError(runnable: Runnable, e: Error) {
|
||||
delete e.stack;
|
||||
delete e.cause;
|
||||
// delete e.stack;
|
||||
// delete e.cause;
|
||||
const errorInfo = runnable.runnableType === "step" ? e : e.message;
|
||||
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> :`, errorInfo);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Logger } from "log4js";
|
|||
import { IAccessService } from "../access/index.js";
|
||||
import { ICnameProxyService, IEmailService } from "../service/index.js";
|
||||
import { CancelError, IContext, PluginRequestHandleReq, RunnableCollection } from "../core/index.js";
|
||||
import { ILogger, logger, utils } from "@certd/basic";
|
||||
import { HttpRequestConfig, ILogger, logger, utils } from "@certd/basic";
|
||||
import { HttpClient } from "@certd/basic";
|
||||
import dayjs from "dayjs";
|
||||
import { IPluginConfigService } from "../service/config";
|
||||
|
@ -85,6 +85,8 @@ export type TaskInstanceContext = {
|
|||
userContext: IContext;
|
||||
//http请求客户端
|
||||
http: HttpClient;
|
||||
//下载文件方法
|
||||
download: (config: HttpRequestConfig, savePath: string) => Promise<void>;
|
||||
//文件存储
|
||||
fileStore: FileStore;
|
||||
//上一次执行结果状态
|
||||
|
|
|
@ -127,7 +127,7 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
|
|||
const savePathArgs = `--path "${saveDir}"`;
|
||||
const os_type = process.platform === "win32" ? "windows" : "linux";
|
||||
const legoDir = "./tools/lego";
|
||||
const legoPath = path.resolve(legoDir, "lego");
|
||||
const legoPath = path.resolve(legoDir, os_type === "windows" ? "lego.exe" : "lego");
|
||||
if (!fs.existsSync(legoPath)) {
|
||||
//解压缩
|
||||
const arch = process.arch;
|
||||
|
@ -136,20 +136,21 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
|
|||
platform = "arm64";
|
||||
}
|
||||
const LEGO_VERSION = process.env.LEGO_VERSION;
|
||||
let legoZipFile = `${legoDir}/lego_v${LEGO_VERSION}_windows_${platform}.zip`;
|
||||
let legoZipFileName = `lego_v${LEGO_VERSION}_windows_${platform}.zip`;
|
||||
if (os_type === "linux") {
|
||||
legoZipFile = `${legoDir}/lego_v${LEGO_VERSION}_linux_${platform}.tar.gz`;
|
||||
legoZipFileName = `lego_v${LEGO_VERSION}_linux_${platform}.tar.gz`;
|
||||
}
|
||||
if (!fs.existsSync(legoZipFile)) {
|
||||
this.logger.info(`lego文件不存在:${legoZipFile},准备下载`);
|
||||
const downloadUrl = `https://github.com/go-acme/lego/releases/download/v${LEGO_VERSION}/lego_v${LEGO_VERSION}_${os_type}_${platform}.tar.gz`;
|
||||
await this.ctx.utils.download(
|
||||
this.http,
|
||||
const legoZipFilePath = `${legoDir}/${legoZipFileName}`;
|
||||
if (!fs.existsSync(legoZipFilePath)) {
|
||||
this.logger.info(`lego文件不存在:${legoZipFilePath},准备下载`);
|
||||
const downloadUrl = `https://github.com/go-acme/lego/releases/download/v${LEGO_VERSION}/${legoZipFileName}`;
|
||||
await this.ctx.download(
|
||||
{
|
||||
url: downloadUrl,
|
||||
method: "GET",
|
||||
logRes: false,
|
||||
},
|
||||
legoZipFile
|
||||
legoZipFilePath
|
||||
);
|
||||
this.logger.info("下载lego成功");
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
|
|||
if (os_type === "linux") {
|
||||
//tar是否存在
|
||||
await this.ctx.utils.sp.spawn({
|
||||
cmd: `tar -zxvf ${legoZipFile} -C ${legoDir}/`,
|
||||
cmd: `tar -zxvf ${legoZipFilePath} -C ${legoDir}/`,
|
||||
});
|
||||
await this.ctx.utils.sp.spawn({
|
||||
cmd: `chmod +x ${legoDir}/*`,
|
||||
|
@ -165,12 +166,12 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
|
|||
this.logger.info("解压lego成功");
|
||||
} else {
|
||||
const zip = new JSZip();
|
||||
const data = fs.readFileSync(legoZipFile);
|
||||
const data = fs.readFileSync(legoZipFilePath);
|
||||
const zipData = await zip.loadAsync(data);
|
||||
const files = Object.keys(zipData.files);
|
||||
for (const file of files) {
|
||||
const content = await zipData.files[file].async("nodebuffer");
|
||||
fs.writeFileSync(legoPath, content);
|
||||
fs.writeFileSync(`${legoDir}/${file}`, content);
|
||||
}
|
||||
this.logger.info("解压lego成功");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import path from 'path';
|
|||
import * as _ from 'lodash-es';
|
||||
import yaml from 'js-yaml';
|
||||
import fs from 'fs';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
function parseEnv(defaultConfig: any) {
|
||||
const config = {};
|
||||
|
|
|
@ -12,7 +12,7 @@ import cors from '@koa/cors';
|
|||
import { GlobalExceptionMiddleware } from './middleware/global-exception.js';
|
||||
import { PreviewMiddleware } from './middleware/preview.js';
|
||||
import { AuthorityMiddleware } from './middleware/authority.js';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { ResetPasswdMiddleware } from './middleware/reset-passwd/middleware.js';
|
||||
import DefaultConfig from './config/config.default.js';
|
||||
import * as libServer from '@certd/lib-server';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Controller, Get, Provide } from '@midwayjs/core';
|
||||
import { BaseController, Constants } from '@certd/lib-server';
|
||||
import { http, logger } from '@certd/pipeline';
|
||||
import { http, logger } from '@certd/basic';
|
||||
/**
|
||||
*/
|
||||
@Provide()
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Controller, Fields, Files, Get, Inject, Post, Provide, Query } from '@m
|
|||
import { BaseController, Constants, FileService, UploadFileItem, uploadTmpFileCacheKey } from '@certd/lib-server';
|
||||
import send from 'koa-send';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { cache } from '@certd/pipeline';
|
||||
import { cache } from '@certd/basic';
|
||||
import { UploadFileInfo } from '@midwayjs/upload';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Controller, Get, Inject, MidwayEnvironmentService, Provide } from '@midwayjs/core';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { Constants } from '@certd/lib-server';
|
||||
|
||||
@Provide()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Config, Controller, Get, Inject, Provide } from '@midwayjs/core';
|
||||
import { BaseController, Constants, SysHeaderMenus, SysInstallInfo, SysPublicSettings, SysSettingsService, SysSiteEnv, SysSiteInfo } from '@certd/lib-server';
|
||||
import { AppKey, getPlusInfo } from '@certd/pipeline';
|
||||
import { AppKey, getPlusInfo } from '@certd/plus-core';
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { Constants } from '@certd/lib-server';
|
||||
import {
|
||||
AccessRequestHandleReq,
|
||||
http,
|
||||
ITaskPlugin,
|
||||
logger,
|
||||
mergeUtils,
|
||||
newAccess,
|
||||
pluginRegistry,
|
||||
PluginRequestHandleReq,
|
||||
TaskInstanceContext,
|
||||
utils,
|
||||
} from '@certd/pipeline';
|
||||
import { AccessRequestHandleReq, ITaskPlugin, newAccess, pluginRegistry, PluginRequestHandleReq, TaskInstanceContext } from '@certd/pipeline';
|
||||
import { BaseController } from '@certd/lib-server';
|
||||
import { AccessService } from '../../modules/pipeline/service/access-service.js';
|
||||
import { EmailService } from '../../modules/basic/service/email-service.js';
|
||||
import { AccessGetter } from '../../modules/pipeline/service/access-getter.js';
|
||||
import { http, HttpRequestConfig, logger, mergeUtils, utils } from '@certd/basic';
|
||||
|
||||
@Provide()
|
||||
@Controller('/api/pi/handle')
|
||||
|
@ -64,12 +54,21 @@ export class HandleController extends BaseController {
|
|||
|
||||
const accessGetter = new AccessGetter(userId, this.accessService.getById.bind(this.accessService));
|
||||
|
||||
const download = async (config: HttpRequestConfig, savePath: string) => {
|
||||
await utils.download({
|
||||
http,
|
||||
logger,
|
||||
config,
|
||||
savePath,
|
||||
});
|
||||
};
|
||||
//@ts-ignore
|
||||
const taskCtx: TaskInstanceContext = {
|
||||
pipeline: undefined,
|
||||
step: undefined,
|
||||
lastStatus: undefined,
|
||||
http,
|
||||
download,
|
||||
logger: logger,
|
||||
inputChanged: true,
|
||||
accessService: accessGetter,
|
||||
|
|
|
@ -7,7 +7,7 @@ import { HistoryEntity } from '../../modules/pipeline/entity/history.js';
|
|||
import { HistoryLogEntity } from '../../modules/pipeline/entity/history-log.js';
|
||||
import { PipelineService } from '../../modules/pipeline/service/pipeline-service.js';
|
||||
import * as fs from 'fs';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { AuthService } from '../../modules/sys/authority/service/auth-service.js';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { In } from 'typeorm';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||
import { AccessService } from '../../../modules/pipeline/service/access-service.js';
|
||||
import { AccessController } from '../../pipeline/access-controller.js';
|
||||
import { checkComm } from '@certd/pipeline';
|
||||
import { checkComm } from '@certd/plus-core';
|
||||
|
||||
/**
|
||||
* 授权
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { BaseController, PlusService } from '@certd/lib-server';
|
||||
import { AppKey } from '@certd/pipeline';
|
||||
import { AppKey } from '@certd/plus-core';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { SysInstallInfo } from '@certd/lib-server';
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { BaseController, PlusService, SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
import { AppKey, logger } from '@certd/pipeline';
|
||||
import { AppKey } from '@certd/plus-core';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as _ from 'lodash-es';
|
|||
import { PipelineService } from '../../../modules/pipeline/service/pipeline-service.js';
|
||||
import { UserSettingsService } from '../../../modules/mine/service/user-settings-service.js';
|
||||
import { getEmailSettings } from '../../../modules/sys/settings/fix.js';
|
||||
import { http, logger } from '@certd/pipeline';
|
||||
import { http, logger } from '@certd/basic';
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Init, Inject, MidwayWebRouterService, Provide, Scope, ScopeEnum } from
|
|||
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { Constants } from '@certd/lib-server';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { AuthService } from '../modules/sys/authority/service/auth-service.js';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { SysPrivateSettings } from '@certd/lib-server';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Provide } from '@midwayjs/core';
|
||||
import { IWebMiddleware, IMidwayKoaContext, NextFunction } from '@midwayjs/koa';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { Result } from '@certd/lib-server';
|
||||
|
||||
@Provide()
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Autoload, Config, Init, Inject, Provide, Scope, ScopeEnum } from '@midw
|
|||
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
||||
import { CommonException } from '@certd/lib-server';
|
||||
import { UserService } from '../../modules/sys/authority/service/user-service.js';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
/**
|
||||
* 重置密码模式
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { UserService } from '../sys/authority/service/user-service.js';
|
||||
import { PlusService, SysInstallInfo, SysPrivateSettings, SysSettingsService } from '@certd/lib-server';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { PipelineService } from '../pipeline/service/pipeline-service.js';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
|
||||
@Autoload()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { App, Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { getPlusInfo, isPlus, logger } from '@certd/pipeline';
|
||||
import { getPlusInfo, isPlus } from '@certd/plus-core';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
import { SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
import { getVersion } from '../../utils/version.js';
|
||||
import dayjs from 'dayjs';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import fs from 'fs';
|
||||
// @ts-ignore
|
||||
import forge from 'node-forge';
|
||||
|
|
|
@ -2,7 +2,7 @@ import https from 'node:https';
|
|||
import fs from 'fs';
|
||||
import { Application } from '@midwayjs/koa';
|
||||
import { createSelfCertificate } from './self-certificate.js';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
export type HttpsServerOptions = {
|
||||
enabled: boolean;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import type { EmailSend } from '@certd/pipeline';
|
||||
import { IEmailService, isPlus, logger } from '@certd/pipeline';
|
||||
import { IEmailService } from '@certd/pipeline';
|
||||
|
||||
import { logger } from '@certd/basic';
|
||||
import { isPlus } from '@certd/plus-core';
|
||||
|
||||
import nodemailer from 'nodemailer';
|
||||
import type SMTPConnection from 'nodemailer/lib/smtp-connection';
|
||||
import { UserSettingsService } from '../../mine/service/user-settings-service.js';
|
||||
|
|
|
@ -4,7 +4,9 @@ import { Repository } from 'typeorm';
|
|||
import { BaseService, PlusService, ValidateException } from '@certd/lib-server';
|
||||
import { CnameRecordEntity, CnameRecordStatusType } from '../entity/cname-record.js';
|
||||
import { createDnsProvider, IDnsProvider, parseDomain } from '@certd/plugin-cert';
|
||||
import { cache, CnameProvider, http, logger, utils } from '@certd/pipeline';
|
||||
import { CnameProvider } from '@certd/pipeline';
|
||||
import { cache, http, logger, utils } from '@certd/basic';
|
||||
|
||||
import { AccessService } from '../../pipeline/service/access-service.js';
|
||||
import { isDev } from '../../../utils/env.js';
|
||||
import { walkTxtRecord } from '@certd/acme-client';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import parser from 'cron-parser';
|
||||
import { ILogger } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
|
||||
export type CronTaskReq = {
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,11 @@ import { HistoryEntity } from '../entity/history.js';
|
|||
import { PipelineEntity } from '../entity/pipeline.js';
|
||||
import { HistoryDetail } from '../entity/vo/history-detail.js';
|
||||
import { HistoryLogService } from './history-log-service.js';
|
||||
import { FileItem, FileStore, logger, Pipeline, RunnableCollection } from '@certd/pipeline';
|
||||
import { FileItem, FileStore, Pipeline, RunnableCollection } from '@certd/pipeline';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { DbAdapter } from '../../db/index.js';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
/**
|
||||
* 证书申请
|
||||
|
|
|
@ -4,7 +4,7 @@ import { In, MoreThan, Repository } from 'typeorm';
|
|||
import { BaseService, NeedVIPException, PageReq, SysPublicSettings, SysSettingsService } from '@certd/lib-server';
|
||||
import { PipelineEntity } from '../entity/pipeline.js';
|
||||
import { PipelineDetail } from '../entity/vo/pipeline-detail.js';
|
||||
import { Executor, isPlus, logger, Pipeline, ResultType, RunHistory, UserInfo } from '@certd/pipeline';
|
||||
import { Executor, Pipeline, ResultType, RunHistory, UserInfo } from '@certd/pipeline';
|
||||
import { AccessService } from './access-service.js';
|
||||
import { DbStorage } from './db-storage.js';
|
||||
import { StorageService } from './storage-service.js';
|
||||
|
@ -21,6 +21,8 @@ import { CnameProxyService } from './cname-proxy-service.js';
|
|||
import { PluginConfigGetter } from '../../plugin/service/plugin-config-getter.js';
|
||||
import dayjs from 'dayjs';
|
||||
import { DbAdapter } from '../../db/index.js';
|
||||
import { isPlus } from '@certd/plus-core';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
const runningTasks: Map<string | number, Executor> = new Map();
|
||||
const freeCount = 10;
|
||||
|
|
|
@ -3,7 +3,7 @@ import { BaseService, PageReq } from '@certd/lib-server';
|
|||
import { PluginEntity } from '../entity/plugin.js';
|
||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { isComm } from '@certd/pipeline';
|
||||
import { isComm } from '@certd/plus-core';
|
||||
import { BuiltInPluginService } from '../../pipeline/service/builtin-plugin-service.js';
|
||||
import { merge } from 'lodash-es';
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import bcrypt from 'bcryptjs';
|
|||
import { RandomUtil } from '../../../../utils/random.js';
|
||||
import dayjs from 'dayjs';
|
||||
import { DbAdapter } from '../../../db/index.js';
|
||||
import { utils } from '@certd/pipeline';
|
||||
import { utils } from '@certd/basic';
|
||||
/**
|
||||
* 系统用户
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
|
||||
import { AliyunAccess, AliyunClient } from '@certd/plugin-plus';
|
||||
|
||||
@IsDnsProvider({
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, HttpClient, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { HttpClient, ILogger } from '@certd/basic';
|
||||
|
||||
import { CloudflareAccess } from './access.js';
|
||||
|
||||
export type CloudflareRecord = {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, HttpClient, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { HttpClient, ILogger } from '@certd/basic';
|
||||
|
||||
import { DemoAccess } from './access.js';
|
||||
import { isDev } from "../../utils/env.js";
|
||||
import { isDev } from '../../utils/env.js';
|
||||
|
||||
type DemoRecord = {
|
||||
// 这里定义Record记录的数据结构,跟对应云平台接口返回值一样即可,一般是拿到id就行,用于删除txt解析记录,清理申请痕迹
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import crypto from 'crypto';
|
||||
import querystring from 'querystring';
|
||||
import { DogeCloudAccess } from '../access.js';
|
||||
import { HttpClient } from '@certd/pipeline';
|
||||
import { HttpClient } from '@certd/basic';
|
||||
|
||||
export class DogeClient {
|
||||
accessKey: string;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
|
||||
import { DynadotAccess } from './access.js';
|
||||
import querystring from 'querystring';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import ssh2, { ConnectConfig, ExecOptions } from 'ssh2';
|
||||
import path from 'path';
|
||||
import * as _ from 'lodash-es';
|
||||
import { ILogger } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
import { SshAccess } from '../access/index.js';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import { SocksClient } from 'socks';
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import * as _ from 'lodash-es';
|
||||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
|
||||
import { HuaweiAccess } from '../access/index.js';
|
||||
import { ApiRequestOptions, HuaweiYunClient } from '@certd/lib-huawei';
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, resetLogConfigure, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { HuaweiAccess } from '../../access/index.js';
|
||||
import { CertInfo } from '@certd/plugin-cert';
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-plus';
|
||||
import { resetLogConfigure } from '@certd/basic';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'HauweiDeployCertToCDN',
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
import { JDCloudAccess } from './access.js';
|
||||
function promisfy(func: any) {
|
||||
return (params: any, regionId: string) => {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import { Autowire, HttpClient, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { HttpClient, ILogger } from '@certd/basic';
|
||||
|
||||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import * as _ from 'lodash-es';
|
||||
import { DnspodAccess } from '../access/index.js';
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import { Autowire, HttpClient, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { HttpClient, ILogger } from '@certd/basic';
|
||||
|
||||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { TencentAccess } from '@certd/plugin-plus';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { TencentAccess } from '@certd/plugin-plus';
|
||||
import { CertInfo } from '@certd/plugin-cert';
|
||||
import { ILogger } from '@certd/pipeline';
|
||||
import { ILogger } from '@certd/basic';
|
||||
export class TencentSslClient {
|
||||
access: TencentAccess;
|
||||
logger: ILogger;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, utils } from '@certd/pipeline';
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { TencentAccess } from '@certd/plugin-plus';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
|
@ -131,10 +131,10 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
|||
}
|
||||
|
||||
try {
|
||||
await utils.sleep(2000);
|
||||
await this.ctx.utils.sleep(2000);
|
||||
let newCertId = await this.getCertIdFromProps(client);
|
||||
if ((lastCertId && newCertId === lastCertId) || (!lastCertId && !newCertId)) {
|
||||
await utils.sleep(2000);
|
||||
await this.ctx.utils.sleep(2000);
|
||||
newCertId = await this.getCertIdFromProps(client);
|
||||
}
|
||||
if (newCertId === lastCertId) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { Autowire, HttpClient, ILogger } from '@certd/pipeline';
|
||||
import { Autowire } from '@certd/pipeline';
|
||||
import { HttpClient, ILogger } from '@certd/basic';
|
||||
|
||||
|
||||
import { WestAccess } from './access.js';
|
||||
|
||||
type westRecord = {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { AbstractTaskPlugin, HttpClient, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { CertInfo } from '@certd/plugin-cert';
|
||||
import { WoaiAccess } from '../access.js';
|
||||
import { HttpClient } from '@certd/basic';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'WoaiCDN',
|
||||
|
|
|
@ -1 +1 @@
|
|||
export { isDev } from '@certd/pipeline';
|
||||
export { isDev } from '@certd/basic';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { utils } from '@certd/pipeline';
|
||||
import { utils } from '@certd/basic';
|
||||
|
||||
export async function request(config: any): Promise<any> {
|
||||
try {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { logger } from '@certd/pipeline';
|
||||
import { logger } from '@certd/basic';
|
||||
import fs from 'fs';
|
||||
|
||||
export async function getVersion() {
|
||||
|
|
Loading…
Reference in New Issue