pull/101/head
xiaojunnuo 2024-07-24 02:11:38 +08:00
parent 6693d1acfb
commit 83d0209775
3 changed files with 28 additions and 8 deletions

View File

@ -33,6 +33,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
vModel: "value", vModel: "value",
options: [ options: [
{ value: "letsencrypt", label: "Let's Encrypt" }, { value: "letsencrypt", label: "Let's Encrypt" },
// { value: "letsencrypt-proxy", label: "Let's Encrypt代理letsencrypt.org无法访问时使用" },
// { value: "buypass", label: "Buypass" }, // { value: "buypass", label: "Buypass" },
{ value: "zerossl", label: "ZeroSSL" }, { value: "zerossl", label: "ZeroSSL" },
], ],

View File

@ -1,3 +1 @@
export const dnsList = [ export const dnsList = [];
]

View File

@ -1,9 +1,9 @@
import { IsTaskPlugin, pluginGroups, RunStrategy, sp, Step, TaskInput } from "@certd/pipeline"; import { IsTaskPlugin, pluginGroups, RunStrategy, sp, Step, TaskInput } from "@certd/pipeline";
import type { CertInfo } from "../acme"; import type { CertInfo } from "../acme.js";
import { CertReader } from "../cert-reader"; import { CertReader } from "../cert-reader.js";
import { CertApplyBasePlugin } from "../base"; import { CertApplyBasePlugin } from "../base.js";
import fs from "fs"; import fs from "fs";
import { EabAccess } from "../../../access"; import { EabAccess } from "../../../access/index.js";
import path from "path"; import path from "path";
export { CertReader }; export { CertReader };
@ -25,6 +25,21 @@ export type { CertInfo };
}, },
}) })
export class CertApplyLegoPlugin extends CertApplyBasePlugin { export class CertApplyLegoPlugin extends CertApplyBasePlugin {
// @TaskInput({
// title: "ACME服务端点",
// default: "https://acme-v02.api.letsencrypt.org/directory",
// component: {
// name: "a-select",
// vModel: "value",
// options: [
// { value: "https://acme-v02.api.letsencrypt.org/directory", label: "Let's Encrypt" },
// { value: "https://letsencrypt.proxy.handsfree.work/directory", label: "Let's Encrypt代理letsencrypt.org无法访问时使用" },
// ],
// },
// required: true,
// })
acmeServer!: string;
@TaskInput({ @TaskInput({
title: "DNS类型", title: "DNS类型",
component: { component: {
@ -110,8 +125,14 @@ export class CertApplyLegoPlugin extends CertApplyBasePlugin {
const savePathArgs = `--path "${saveDir}"`; const savePathArgs = `--path "${saveDir}"`;
const os_type = process.platform === "win32" ? "windows" : "linux"; const os_type = process.platform === "win32" ? "windows" : "linux";
const legoPath = path.resolve("./tools", os_type, "lego"); const legoPath = path.resolve("./tools", os_type, "lego");
let serverArgs = "";
if (this.acmeServer) {
serverArgs = ` --server ${this.acmeServer}`;
}
const cmds = [ const cmds = [
`${legoPath} -a --email "${this.email}" --dns ${this.dnsType} ${keyType} ${domainArgs} ${eabArgs} ${savePathArgs} ${this.customArgs || ""} run`, `${legoPath} -a --email "${this.email}" --dns ${this.dnsType} ${keyType} ${domainArgs} ${serverArgs} ${eabArgs} ${savePathArgs} ${
this.customArgs || ""
} run`,
]; ];
await sp.spawn({ await sp.spawn({