chore: 优化图标

This commit is contained in:
xiaojunnuo
2025-12-27 02:20:01 +08:00
parent e61daaee2d
commit 91e19bbdd3
22 changed files with 380 additions and 46 deletions

View File

@@ -11,7 +11,7 @@ import { CmccClient } from "./cmcc-client.js";
name: "cmcc",
title: "中国移动CND授权",
desc: "",
icon: "clarity:plugin-line"
icon: "svg:cmcc"
})
export class CmccAccess extends BaseAccess {

View File

@@ -15,7 +15,7 @@ import { CmccAccess } from "./access.js";
name: "CmccDeployCertToCdn",
title: "中国移动-部署证书到CDN",
desc: "中国移动自动部署证书到CDN",
icon: "svg:icon-lucky",
icon: "svg:icon-cmcc",
//插件分组
group: pluginGroups.cdn.key,
needPlus: true,

View File

@@ -11,7 +11,7 @@ import {
//命名规范,插件类型+功能就是目录plugin-demo中的demo大写字母开头驼峰命名
name: "FnOSDeployToNAS",
title: "飞牛NAS-部署证书",
icon: "svg:icon-lucky",
icon: "svg:icon-fnos",
//插件分组
group: pluginGroups.panel.key,
needPlus: false,

View File

@@ -16,7 +16,7 @@ import {KsyunAccess} from "../access.js";
name: "KsyunRefreshCert",
title: "金山云-更新CDN证书",
desc: "金山云自动更新CDN证书",
icon: "svg:icon-lucky",
icon: "svg:icon-ksyun",
//插件分组
group: pluginGroups.cdn.key,
needPlus: false,

View File

@@ -8,7 +8,7 @@ import { CertInfo, CertReader } from '@certd/plugin-cert';
@IsAccess({
name: 'ucloud',
title: 'UCloud授权',
icon: 'lsicon:badge-new-filled',
icon: 'svg:icon-ucloud',
desc: '优刻得授权',
})
export class UCloudAccess extends BaseAccess {

View File

@@ -8,9 +8,9 @@ import { UCloudAccess } from "../access.js";
name: "UCloudDeployToCDN",
title: "UCloud-部署到CDN",
desc: "将证书部署到UCloud CDN",
icon: "svg:icon-lucky",
icon: "svg:icon-ucloud",
//插件分组
group: pluginGroups.cdn.key,
group: pluginGroups.ucloud.key,
needPlus: false,
default: {
//默认值配置照抄即可

View File

@@ -0,0 +1,189 @@
import { AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
import { UCloudAccess } from "../access.js";
@IsTaskPlugin({
//命名规范,插件类型+功能就是目录plugin-demo中的demo大写字母开头驼峰命名
name: "UCloudDeployToWaf",
title: "UCloud-部署到WAF",
desc: "将证书部署到UCloud WAF",
icon: "svg:icon-ucloud",
//插件分组
group: pluginGroups.ucloud.key,
needPlus: false,
default: {
//默认值配置照抄即可
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed
}
}
})
//类名规范跟上面插件名称name一致
export class UCloudDeployToCDN extends AbstractTaskPlugin {
//证书选择,此项必须要有
@TaskInput({
title: "域名证书",
helper: "请选择前置任务输出的域名证书",
component: {
name: "output-selector",
from: [...CertApplyPluginNames, ":UCloudCertId:"]
}
// required: true, // 必填
})
cert!: CertInfo | { type: string, id: number, name: string };
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
certDomains!: string[];
//授权选择框
@TaskInput({
title: "UCloud授权",
component: {
name: "access-selector",
type: "ucloud" //固定授权类型
},
required: true //必填
})
accessId!: string;
//
@TaskInput(
createRemoteSelectInputDefine({
title: "域名列表",
helper: "要更新的UCloud域名列表",
action: UCloudDeployToCDN.prototype.onGetDomainList.name
})
)
domainList!: string[];
//插件实例化时执行的方法
async onInstance() {
}
//插件执行方法
async execute(): Promise<void> {
const access = await this.getAccess<UCloudAccess>(this.accessId);
let certType = "ussl"
let certId = 0
let certName = this.appendTimeSuffix("certd")
// @ts-ignore
if (this.cert?.id) {
//从上一步传过来的ssl证书
// @ts-ignore
certId = this.cert.id
// @ts-ignore
certName = this.cert.name
} else {
const cert = await access.SslUploadCert({
cert: this.cert as CertInfo
});
certId = cert.id
certName = cert.name
}
for (const item of this.domainList) {
this.logger.info(`----------- 开始更新域名:${item}`);
await this.deployToCdn({
access: access,
certName: certName,
domain: item,
certId: certId,
certType: certType
});
this.logger.info(`----------- 更新域名证书${item}成功`);
}
this.logger.info("部署完成");
}
async deployToCdn(req: { access: any, domain: string, certId: number, certType: string, certName: string }) {
const { access, domain, certId, certType, certName } = req
const domainsRes = await access.invoke({
"Action": "GetUcdnDomainConfig",
"ProjectId": access.projectId,
"Domain": [
domain
]
});
const domainList = domainsRes.DomainList || [];
const domainConf = domainList.find((item: any) => item.Domain === domain);
if (!domainConf) {
throw new Error(`没有找到CDN域名${domain}`);
}
const domainId = domainConf.DomainId;
const httpsStatusAbroad = domainConf.HttpsStatusAbroad;
let httpsStatusCn = domainConf.HttpsStatusCn;
if (httpsStatusAbroad === "disable" && httpsStatusCn === "disable") {
this.logger.info(`原CDN域名HTTPS未开启将开启国内加速`);
httpsStatusCn = "enable"
}
const body: any = {
"Action": "UpdateUcdnDomainHttpsConfigV2",
"DomainId": domainId,
"CertName": certName,
"CertId": certId,
"CertType": certType,
EnableHttp2: domainConf.EnableHttp2 ||"0",
RedirectHttp2Https: domainConf.RedirectHttp2Https || "0",
TlsVersion: domainConf.TlsVersion || "tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3"
}
if (httpsStatusAbroad === "enable") {
body.HttpsStatusAbroad = httpsStatusAbroad;
}
if (httpsStatusCn === "enable") {
body.HttpsStatusCn = httpsStatusCn;
}
this.logger.info(`----------- 更新CDN域名HTTPS配置${domainId}${JSON.stringify(body)}`);
const resp = await access.invoke(body);
this.logger.info(`----------- 部署CDN证书${domainId}成功,${JSON.stringify(resp)}`);
}
async onGetDomainList(req: PageSearch = {}) {
const access = await this.getAccess<UCloudAccess>(this.accessId);
const pageNo = req.pageNo ?? 1;
const pageSize = req.pageSize ?? 100;
const res = await access.CdnDominList(
{
PageNo: pageNo,
PageSize: pageSize
}
);
const total = res.TotalCount;
const list = res.DomainInfoList || [];
if (!list || list.length === 0) {
throw new Error("没有找到CDN域名请先在控制台创建CDN域名");
}
/**
* "Domain": "ucloud.certd.handsfree.work",
"DomainId": "ucdn-1kwdtph5ygbb"
*/
const options = list.map((item: any) => {
return {
label: `${item.Domain}<${item.DomainId}>`,
value: `${item.Domain}`,
domain: item.Domain
};
});
return {
list: this.ctx.utils.options.buildGroupOptions(options, this.certDomains),
total: total,
pageNo: pageNo,
pageSize: pageSize
};
}
}
//实例化一下,注册插件
new UCloudDeployToCDN();

View File

@@ -7,9 +7,9 @@ import { UCloudAccess } from "../access.js";
name: "UCloudUploadToUSSL",
title: "UCloud-上传到USSL",
desc: "将证书上传到UCloud USSL",
icon: "svg:icon-lucky",
icon: "svg:icon-ucloud",
//插件分组
group: pluginGroups.cdn.key,
group: pluginGroups.ucloud.key,
needPlus: false,
default: {
//默认值配置照抄即可

View File

@@ -10,7 +10,7 @@ import { CertInfo } from "@certd/plugin-cert";
name: "wangsu",
title: "网宿授权",
desc: "",
icon: "svg:icon-lucky"
icon: "svg:icon-wangsu"
})
export class WangsuAccess extends BaseAccess {

View File

@@ -15,7 +15,7 @@ import { WangsuAccess } from "../access.js";
name: "WangsuRefreshCert",
title: "网宿-更新证书",
desc: "网宿证书自动更新",
icon: "svg:icon-lucky",
icon: "svg:icon-wangsu",
//插件分组
group: pluginGroups.cdn.key,
needPlus: false,

View File

@@ -7,7 +7,7 @@ import crypto from "crypto";
@IsAccess({
name: "xinnetagent",
title: "新网授权(代理方式)",
icon: "lsicon:badge-new-filled",
icon: "svg:icon-xinnet",
desc: ""
})
export class XinnetAgentAccess extends BaseAccess {

View File

@@ -8,7 +8,7 @@ import { XinnetClient } from "@certd/plugin-plus";
@IsAccess({
name: "xinnet",
title: "新网授权",
icon: "lsicon:badge-new-filled",
icon: "svg:icon-xinnet",
desc: ""
})
export class XinnetAccess extends BaseAccess {

View File

@@ -11,7 +11,7 @@ export type XinnetAgentRecord = {
name: "xinnetagent",
title: "新网(代理方式)",
desc: "新网域名解析(代理方式)",
icon: "lsicon:badge-new-filled",
icon: "svg:icon-xinnet",
// 这里是对应的 cloudflare的access类型名称
accessType: "xinnetagent",
order: 7

View File

@@ -16,7 +16,7 @@ export type XinnetRecord = {
name: "xinnet",
title: "新网",
desc: "新网域名解析",
icon: "lsicon:badge-new-filled",
icon: "svg:icon-xinnet",
// 这里是对应的 cloudflare的access类型名称
accessType: "xinnet",
order: 7

View File

@@ -7,7 +7,7 @@ import { IsAccess, AccessInput, BaseAccess } from '@certd/pipeline';
@IsAccess({
name: 'xinnetconnect',
title: '新网互联授权',
icon: 'lsicon:badge-new-filled',
icon: 'svg:icon-xinnet',
desc: '仅支持代理账号ip需要加入白名单',
})
export class XinnetConnectAccess extends BaseAccess {

View File

@@ -14,7 +14,7 @@ export type XinnetConnectRecord = {
name: 'xinnetconnect',
title: '新网互联',
desc: '新网互联',
icon: 'lsicon:badge-new-filled',
icon: 'svg:icon-xinnet',
// 这里是对应的 cloudflare的access类型名称
accessType: 'xinnetconnect',
order:999,