chore: lego改成从github直接下载

This commit is contained in:
xiaojunnuo
2024-11-04 16:39:02 +08:00
parent 1274f56da8
commit 1b46278f86
54 changed files with 162 additions and 110 deletions
+10 -1
View File
@@ -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,
-1
View File
@@ -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);
}
+3 -1
View File
@@ -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;
//上一次执行结果状态