perf: 调整静态资源到static目录
10
README.md
|
@ -29,11 +29,11 @@ https://certd.handsfree.work/
|
|||
## 三、使用教程
|
||||
本案例演示,如何配置自动申请证书,并部署到阿里云CDN,然后快要到期前自动更新证书并重新部署
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
|
||||
-------> [点我查看详细使用步骤演示](./step.md) <--------
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export * from "./access/index.js";
|
||||
export * from "./plugin/index.js";
|
||||
export * from "./dns-provider/index.js";
|
||||
export * from "./access/index.js";
|
||||
|
|
|
@ -6,6 +6,6 @@ VITE_APP_SLOGAN=让你的证书永不过期
|
|||
VITE_APP_COPYRIGHT_YEAR=2021-2024
|
||||
VITE_APP_COPYRIGHT_NAME=handsfree.work
|
||||
VITE_APP_COPYRIGHT_URL=https://certd.handsfree.work
|
||||
VITE_APP_LOGO=./assets/images/logo/logo.svg
|
||||
VITE_APP_LOGO=/statics/images/logo/logo.svg
|
||||
VITE_APP_PROJECT_PATH=https://github.com/certd/certd
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<link rel="icon" href="/logo.svg"/>
|
||||
<link rel="icon" href="/static/logo.svg"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Certd-让你的证书永不过期</title>
|
||||
<script src="/assets/icons/iconfont.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/index.css"/>
|
||||
<script src="/static/icons/iconfont.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/static/index.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
|
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
@ -6,9 +6,9 @@
|
|||
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/>
|
||||
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/>
|
||||
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<link rel="stylesheet" href="iconfont.css">
|
||||
<script src="iconfont.js"></script>
|
||||
<link rel="stylesheet" href='demo.css'>
|
||||
<link rel="stylesheet" href='iconfont.css'>
|
||||
<script src='iconfont.js'></script>
|
||||
<!-- jQuery -->
|
||||
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
|
||||
<!-- 代码高亮 -->
|
||||
|
@ -38,7 +38,7 @@
|
|||
<div class="main">
|
||||
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
|
||||
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
|
||||
|
||||
|
||||
</a></h1>
|
||||
<div class="nav-tabs">
|
||||
<ul id="tabs" class="dib-box">
|
||||
|
@ -46,44 +46,44 @@
|
|||
<li class="dib"><span>Font class</span></li>
|
||||
<li class="dib"><span>Symbol</span></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=4688792" target="_blank" class="nav-more">查看项目</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="tab-container">
|
||||
<div class="content unicode" style="display: block;">
|
||||
<ul class="icon_lists dib-box">
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">qiniuyun</div>
|
||||
<div class="code-name">&#xe603;</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">aliyun</div>
|
||||
<div class="code-name">&#xe601;</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">腾讯云</div>
|
||||
<div class="code-name">&#xe747;</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">doge</div>
|
||||
<div class="code-name">&#xe605;</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont"></span>
|
||||
<div class="name">bt</div>
|
||||
<div class="code-name">&#xe600;</div>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="article markdown">
|
||||
<h2 id="unicode-">Unicode 引用</h2>
|
||||
|
@ -127,7 +127,7 @@
|
|||
</div>
|
||||
<div class="content font-class">
|
||||
<ul class="icon_lists dib-box">
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-qiniuyun"></span>
|
||||
<div class="name">
|
||||
|
@ -136,7 +136,7 @@
|
|||
<div class="code-name">.icon-qiniuyun
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-aliyun"></span>
|
||||
<div class="name">
|
||||
|
@ -145,7 +145,7 @@
|
|||
<div class="code-name">.icon-aliyun
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-tencentcloud"></span>
|
||||
<div class="name">
|
||||
|
@ -154,7 +154,7 @@
|
|||
<div class="code-name">.icon-tencentcloud
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-dogecloud"></span>
|
||||
<div class="name">
|
||||
|
@ -163,7 +163,7 @@
|
|||
<div class="code-name">.icon-dogecloud
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<span class="icon iconfont icon-bt"></span>
|
||||
<div class="name">
|
||||
|
@ -172,7 +172,7 @@
|
|||
<div class="code-name">.icon-bt
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="article markdown">
|
||||
<h2 id="font-class-">font-class 引用</h2>
|
||||
|
@ -199,7 +199,7 @@
|
|||
</div>
|
||||
<div class="content symbol">
|
||||
<ul class="icon_lists dib-box">
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-qiniuyun"></use>
|
||||
|
@ -207,7 +207,7 @@
|
|||
<div class="name">qiniuyun</div>
|
||||
<div class="code-name">#icon-qiniuyun</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-aliyun"></use>
|
||||
|
@ -215,7 +215,7 @@
|
|||
<div class="name">aliyun</div>
|
||||
<div class="code-name">#icon-aliyun</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-tencentcloud"></use>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<div class="name">腾讯云</div>
|
||||
<div class="code-name">#icon-tencentcloud</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-dogecloud"></use>
|
||||
|
@ -231,7 +231,7 @@
|
|||
<div class="name">doge</div>
|
||||
<div class="code-name">#icon-dogecloud</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="dib">
|
||||
<svg class="icon svg-icon" aria-hidden="true">
|
||||
<use xlink:href="#icon-bt"></use>
|
||||
|
@ -239,7 +239,7 @@
|
|||
<div class="name">bt</div>
|
||||
<div class="code-name">#icon-bt</div>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="article markdown">
|
||||
<h2 id="symbol-">Symbol 引用</h2>
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 6.7 KiB |
|
@ -43,27 +43,27 @@ const steps = ref<Step[]>([
|
|||
description: "演示证书申请任务如何配置",
|
||||
items: [
|
||||
{
|
||||
image: "/assets/doc/images/1-add.png",
|
||||
image: "/static/doc/images/1-add.png",
|
||||
title: "创建证书流水线",
|
||||
descriptions: ["点击添加流水线,选择证书申请"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/2-access-provider.png",
|
||||
image: "/static/doc/images/2-access-provider.png",
|
||||
title: "DNS授权",
|
||||
descriptions: ["证书申请需要给域名添加TXT解析记录来验证域名所有权"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/3-add-access.png",
|
||||
image: "/static/doc/images/3-add-access.png",
|
||||
title: "第一次使用,需要添加DNS授权",
|
||||
descriptions: ["选择DNS授权,确认创建"]
|
||||
},
|
||||
// {
|
||||
// image: "/assets/doc/images/3-add-access.png",
|
||||
// image: "/static/doc/images/3-add-access.png",
|
||||
// title: "确定创建流水线",
|
||||
// descriptions: ["选择DNS授权,信息填写无误,确认创建"]
|
||||
// },
|
||||
{
|
||||
image: "/assets/doc/images/4-add-success.png",
|
||||
image: "/static/doc/images/4-add-success.png",
|
||||
title: "流水线创建成功",
|
||||
descriptions: ["此时证书申请任务已经建好,点击手动触发即可测试证书申请", "接下来演示如何添加部署任务"]
|
||||
}
|
||||
|
@ -74,52 +74,52 @@ const steps = ref<Step[]>([
|
|||
description: "演示部署到阿里云CDN和Nginx",
|
||||
items: [
|
||||
{
|
||||
image: "/assets/doc/images/6-1-add-task.png",
|
||||
image: "/static/doc/images/6-1-add-task.png",
|
||||
title: "添加部署任务",
|
||||
descriptions: ["演示第一个部署任务,部署到阿里云CDN"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/6-2-add-task.png",
|
||||
image: "/static/doc/images/6-2-add-task.png",
|
||||
title: "选择任务插件",
|
||||
descriptions: ["可以搜索插件,这里选择阿里云CDN插件"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/6-3-add-task.png",
|
||||
image: "/static/doc/images/6-3-add-task.png",
|
||||
title: "配置任务参数",
|
||||
descriptions: ["填写CDN的域名和证书ID", "任务保存之后,阿里云CDN的部署任务就配置好了"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/7-1-add-host-task.png",
|
||||
image: "/static/doc/images/7-1-add-host-task.png",
|
||||
title: "添加主机部署任务",
|
||||
descriptions: ["接下来演示配置第二个部署任务,部署到主机", "部署到主机分两步: 1. 上传证书到主机 2. 运行主机命令"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/7-2-add-host-task.png",
|
||||
image: "/static/doc/images/7-2-add-host-task.png",
|
||||
title: "配置上传到主机任务",
|
||||
descriptions: ["填写上传到主机任务参数", "比如证书保存路径"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/7-3-add-host-task.png",
|
||||
image: "/static/doc/images/7-3-add-host-task.png",
|
||||
title: "添加主机ssh登录授权",
|
||||
descriptions: ["填写主机ip、用户名、密码,授权只需添加一次,后续其他任务可以复用"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/8-1-add-host-task.png",
|
||||
image: "/static/doc/images/8-1-add-host-task.png",
|
||||
title: "上传到主机任务配置完成",
|
||||
descriptions: ["接下来配置主机执行脚本,去部署证书"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/8-2-add-host-task.png",
|
||||
image: "/static/doc/images/8-2-add-host-task.png",
|
||||
title: "选择添加主机远程命令任务",
|
||||
descriptions: ["选择主机远程命令任务"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/8-4-add-host-task.png",
|
||||
image: "/static/doc/images/8-4-add-host-task.png",
|
||||
title: "填写证书部署脚本",
|
||||
descriptions: ["选择主机授权,编写部署脚本,这里演示部署到nginx,需要重启nginx,让证书生效"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/8-5-add-host-task.png",
|
||||
image: "/static/doc/images/8-5-add-host-task.png",
|
||||
title: "上传到主机任务的两个步骤配置完成",
|
||||
descriptions: ["接下来测试运行"]
|
||||
}
|
||||
|
@ -130,47 +130,47 @@ const steps = ref<Step[]>([
|
|||
description: "演示流水线运行,查看日志,成功后跳过等",
|
||||
items: [
|
||||
{
|
||||
image: "/assets/doc/images/9-start.png",
|
||||
image: "/static/doc/images/9-start.png",
|
||||
title: "运行测试一下",
|
||||
descriptions: ["之前是把证书上传到主机,接下来要运行命令,去部署证书"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/10-1-log.png",
|
||||
image: "/static/doc/images/10-1-log.png",
|
||||
title: "查看日志",
|
||||
descriptions: ["点击任务可以查看状态和日志"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/11-1-error.png",
|
||||
image: "/static/doc/images/11-1-error.png",
|
||||
title: "执行失败如何排查",
|
||||
descriptions: ["查看错误日志"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/11-2-error.png",
|
||||
image: "/static/doc/images/11-2-error.png",
|
||||
title: "执行失败如何排查",
|
||||
descriptions: ["查看错误日志,这里报的是nginx容器不存在,修改命令改成正确的nginx容器名称"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/12-1-log-success.png",
|
||||
image: "/static/doc/images/12-1-log-success.png",
|
||||
title: "执行成功",
|
||||
descriptions: ["修改正确后,重新点击手动触发,重新运行一次,执行成功"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/12-2-skip-log.png",
|
||||
image: "/static/doc/images/12-2-skip-log.png",
|
||||
title: "成功后自动跳过",
|
||||
descriptions: ["可以看到成功过的将会自动跳过,不会重复执行,只有当参数变更或者证书更新了,才会重新运行"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/13-1-result.png",
|
||||
image: "/static/doc/images/13-1-result.png",
|
||||
title: "查看证书部署成功",
|
||||
descriptions: ["访问nginx上的网站,可以看到证书已经部署成功"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/13-2-result.png",
|
||||
image: "/static/doc/images/13-2-result.png",
|
||||
title: "阿里云CDN也部署成功",
|
||||
descriptions: ["阿里云CDN上已经更新证书,证书名称已certd开头"]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/13-3-download.png",
|
||||
image: "/static/doc/images/13-3-download.png",
|
||||
title: "还可以下载证书,手动部署",
|
||||
descriptions: ["如果还没有好用的部署插件,没办法自动部署,你还可以下载证书,手动部署"]
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ const steps = ref<Step[]>([
|
|||
description: "自动运行",
|
||||
items: [
|
||||
{
|
||||
image: "/assets/doc/images/14-timer.png",
|
||||
image: "/static/doc/images/14-timer.png",
|
||||
title: "设置定时执行",
|
||||
descriptions: [
|
||||
"流水线测试成功,接下来配置定时触发,以后每天定时执行就不用管了",
|
||||
|
@ -189,7 +189,7 @@ const steps = ref<Step[]>([
|
|||
]
|
||||
},
|
||||
{
|
||||
image: "/assets/doc/images/15-1-email.png",
|
||||
image: "/static/doc/images/15-1-email.png",
|
||||
title: "设置邮件通知",
|
||||
descriptions: ["建议选择监听'错误时'和'错误转成功'两种即可,在意外失败时可以尽快去排查问题,(免费版需要配置邮件服务器)"]
|
||||
}
|
||||
|
|
|
@ -85,8 +85,11 @@ export const useSettingStore = defineStore({
|
|||
const settings = await basicApi.getSysPublicSettings();
|
||||
_.merge(this.sysPublic, settings);
|
||||
|
||||
const siteInfo = await basicApi.getSiteInfo();
|
||||
_.merge(this.siteInfo, siteInfo);
|
||||
const userStore = useUserStore();
|
||||
if (userStore.isComm) {
|
||||
const siteInfo = await basicApi.getSiteInfo();
|
||||
_.merge(this.siteInfo, siteInfo);
|
||||
}
|
||||
|
||||
await this.loadInstallInfo();
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ export const useUserStore = defineStore({
|
|||
vipLabel(): string {
|
||||
const vipLabelMap: any = {
|
||||
free: "免费版",
|
||||
vip: "专业版",
|
||||
plus: "专业版",
|
||||
comm: "商业版"
|
||||
};
|
||||
return vipLabelMap[this.plusInfo?.vipType];
|
||||
return vipLabelMap[this.plusInfo?.vipType || "free"];
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -100,7 +100,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
column: {
|
||||
show: computed(() => {
|
||||
return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
|
||||
})
|
||||
}),
|
||||
width: 100
|
||||
}
|
||||
},
|
||||
pipelineId: {
|
||||
|
@ -111,6 +112,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 100
|
||||
}
|
||||
},
|
||||
pipelineTitle: {
|
||||
|
@ -123,7 +127,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
}
|
||||
},
|
||||
column: {
|
||||
width: 200
|
||||
width: 300
|
||||
}
|
||||
},
|
||||
createTime: {
|
||||
|
@ -134,7 +138,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 125,
|
||||
width: 160,
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,43 +1,20 @@
|
|||
// @ts-ignore
|
||||
import { request } from "/src/api/service";
|
||||
const apiPrefix = "/sys/settings";
|
||||
const apiPrefix = "/sys/site";
|
||||
|
||||
export const SettingKeys = {
|
||||
SysPublic: "sys.public",
|
||||
SysPrivate: "sys.private"
|
||||
};
|
||||
export async function SettingsGet(key: string) {
|
||||
return await request({
|
||||
url: apiPrefix + "/get",
|
||||
method: "post",
|
||||
params: {
|
||||
key
|
||||
}
|
||||
method: "post"
|
||||
});
|
||||
}
|
||||
|
||||
export async function SettingsSave(key: string, setting: any) {
|
||||
export async function SettingsSave(setting: any) {
|
||||
await request({
|
||||
url: apiPrefix + "/save",
|
||||
method: "post",
|
||||
data: {
|
||||
key,
|
||||
setting: JSON.stringify(setting)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export async function PublicSettingsSave(setting: any) {
|
||||
await request({
|
||||
url: apiPrefix + "/savePublicSettings",
|
||||
method: "post",
|
||||
data: setting
|
||||
});
|
||||
}
|
||||
|
||||
export async function stopOtherUserTimer() {
|
||||
await request({
|
||||
url: apiPrefix + "/stopOtherUserTimer",
|
||||
method: "post"
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { BaseController } from '@certd/lib-server';
|
||||
import { PlusService } from '../basic/service/plus-service.js';
|
||||
import { BaseController, PlusService } from '@certd/lib-server';
|
||||
import { AppKey } from '@certd/pipeline';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { SysInstallInfo } from '@certd/lib-server';
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { UserService } from '../authority/service/user-service.js';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { PlusService, SysSettingsService } from '@certd/lib-server';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { SysInstallInfo, SysPrivateSettings } from '@certd/lib-server';
|
||||
import crypto from 'crypto';
|
||||
import { PlusService } from '../basic/service/plus-service.js';
|
||||
|
||||
export type InstallInfo = {
|
||||
installTime: number;
|
||||
|
|
|
@ -23,7 +23,6 @@ export class AutoRegisterCron {
|
|||
@Init()
|
||||
async init() {
|
||||
logger.info('加载定时trigger开始');
|
||||
|
||||
await this.pipelineService.onStartup(this.immediateTriggerOnce, this.onlyAdminUser);
|
||||
logger.info('加载定时trigger完成');
|
||||
//
|
||||
|
|
|
@ -10,6 +10,7 @@ import * as fs from 'fs';
|
|||
import { logger } from '@certd/pipeline';
|
||||
import { AuthService } from '../../authority/service/auth-service.js';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { In } from 'typeorm';
|
||||
|
||||
/**
|
||||
* 证书
|
||||
|
@ -35,16 +36,34 @@ export class HistoryController extends CrudController<HistoryService> {
|
|||
}
|
||||
|
||||
@Post('/page', { summary: Constants.per.authOnly })
|
||||
async page(@Body(ALL) body) {
|
||||
async page(@Body(ALL) body: any) {
|
||||
const isAdmin = await this.authService.isAdmin(this.ctx);
|
||||
const publicSettings = await this.sysSettingsService.getPublicSettings();
|
||||
const pipelineQuery: any = {};
|
||||
if (!(publicSettings.managerOtherUserPipeline && isAdmin)) {
|
||||
body.query.userId = this.ctx.user.id;
|
||||
pipelineQuery.userId = this.ctx.user.id;
|
||||
}
|
||||
|
||||
const res = await super.page(body);
|
||||
let pipelineIds: any = null;
|
||||
const pipelineTitle = body.query?.pipelineTitle;
|
||||
if (pipelineTitle) {
|
||||
const pipelines = await this.pipelineService.list(pipelineQuery, null, qb => {
|
||||
qb.where('title like :title', { title: `%${pipelineTitle}%` });
|
||||
});
|
||||
pipelineIds = pipelines.map(p => p.id);
|
||||
}
|
||||
|
||||
return res;
|
||||
const buildQuery = qb => {
|
||||
if (pipelineIds) {
|
||||
qb.where({
|
||||
pipelineId: In(pipelineIds),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const res = await this.service.page(body?.query, body?.page, body?.sort, buildQuery);
|
||||
return this.ok(res);
|
||||
}
|
||||
|
||||
@Post('/list', { summary: Constants.per.authOnly })
|
||||
|
|
|
@ -18,6 +18,9 @@ import { logger } from '@certd/pipeline';
|
|||
export class HistoryService extends BaseService<HistoryEntity> {
|
||||
@InjectEntityModel(HistoryEntity)
|
||||
repository: Repository<HistoryEntity>;
|
||||
|
||||
@InjectEntityModel(PipelineEntity)
|
||||
pipelineRepository: Repository<PipelineEntity>;
|
||||
@Inject()
|
||||
logService: HistoryLogService;
|
||||
|
||||
|
|
|
@ -26,13 +26,5 @@
|
|||
"dist",
|
||||
"node_modules",
|
||||
"test"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../../libs/midway-flyway-js" },
|
||||
{ "path": "../../libs/lib-k8s" },
|
||||
{ "path": "../../libs/lib-huawei" },
|
||||
{ "path": "../../plugins/plugin-cert" },
|
||||
{ "path": "../../core/acme-client" },
|
||||
{ "path": "../../core/pipeline" }
|
||||
]
|
||||
}
|
||||
|
|
54
step.md
|
@ -13,19 +13,19 @@
|
|||
## 自动化流水线创建
|
||||
|
||||
### 1. 创建证书申请部署流水线
|
||||

|
||||

|
||||
|
||||
需要添加域名的DNS解析服务商的授权
|
||||

|
||||

|
||||
|
||||
填写accessKey和accessSecret
|
||||

|
||||

|
||||
流水线创建成功
|
||||

|
||||

|
||||
|
||||
### 2. 任务详情界面
|
||||
|
||||

|
||||

|
||||
|
||||
到这一步申请证书就已经配置完成了。
|
||||
点击手动触发,就可以申请证书了。
|
||||
|
@ -34,72 +34,72 @@
|
|||
|
||||
### 3. 添加部署到阿里云CDN任务
|
||||
点击添加任务
|
||||

|
||||

|
||||
|
||||
选择任务类型
|
||||

|
||||

|
||||
|
||||
填写任务参数
|
||||

|
||||

|
||||
|
||||
点击确定,部署到CDN任务配置成功
|
||||
|
||||
### 4. 添加部署到服务器主机任务
|
||||
点击新任务,弹出添加任务界面
|
||||

|
||||

|
||||
先选择上传到主机任务
|
||||
|
||||
填写任务参数,比如证书保存路径
|
||||

|
||||

|
||||
|
||||
需要添加主机ip、用户名、密码,只需添加一次,后续其他任务可以复用
|
||||

|
||||

|
||||
|
||||
然后添加第二个任务,执行主机命令,部署证书
|
||||

|
||||

|
||||
|
||||
选择执行脚本命令任务
|
||||

|
||||

|
||||
|
||||
编写脚本,选择之前添加的主机
|
||||

|
||||

|
||||
|
||||
点击确定,部署到主机任务配置成功
|
||||

|
||||

|
||||
|
||||
### 5. 手动触发执行任务,测试一下
|
||||

|
||||

|
||||
|
||||
点击任务可以查看状态和日志
|
||||

|
||||

|
||||
|
||||
这里执行失败,可以查看错误日志
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
修改正确后,重新执行
|
||||

|
||||

|
||||
可以看到前面执行过的就会跳过,不会重复执行
|
||||

|
||||

|
||||
|
||||
### 6. 查看证书部署效果
|
||||
可以看到证书已经部署到CDN成功
|
||||

|
||||

|
||||

|
||||

|
||||
也可以手动下载证书
|
||||

|
||||

|
||||
|
||||
### 7. 定时触发
|
||||
配置定时触发,以后每天定时执行
|
||||
cron格式,例如: `0 0 3 * * *` 表示每天凌晨3点执行
|
||||
到期前20天会自动申请新证书并部署,没到期前不会重复申请
|
||||

|
||||

|
||||
|
||||
### 8. 邮件通知
|
||||
可以接收邮件通知(支持时机:开始、成功、失败、失败转成功)
|
||||

|
||||

|
||||
需要配置邮件服务器
|
||||

|
||||

|
||||
|
||||
|
||||
|
||||
|
|