Compare commits

...

19 Commits

Author SHA1 Message Date
yoan
f036eb1cf2 Add the functionality to authorize copying 2024-10-04 08:19:46 +08:00
usual2970
1347066549 Merge pull request #131 from liburdi/hotfix/access_copy_word
fix: update en.json
2024-10-03 07:55:09 +08:00
liburdi
7fc149f67d fix: update en.json 2024-10-02 12:55:24 +08:00
yoan
dfba5ee638 Merge branch 'liburdi-feature/copy_access' 2024-10-01 07:04:56 +08:00
yoan
9ba79f996f fix conflict 2024-10-01 07:04:40 +08:00
yoan
cd85000908 Merge branch 'JonathanSimon123-main' 2024-10-01 06:59:18 +08:00
liburdi
995349ab3e feat: add issues 124 2024-09-30 18:22:16 +08:00
simon
4fa8031318 feat:Add star sequence diagram 2024-09-30 14:08:11 +08:00
simon
3f45bb1629 Merge branch 'main' of https://github.com/JonathanSimon123/certimate 2024-09-30 11:46:08 +08:00
蒋驰磊
0e139e6284 feat:Add star sequence diagram 2024-09-30 11:44:37 +08:00
JonathanSimon123
82dbfc6de3 Update README.md
feature:Add start sequence diagram
2024-09-30 11:04:41 +08:00
JonathanSimon123
9b2937d601 Update README_EN.md
feature:Add start sequence diagram
2024-09-30 11:02:06 +08:00
yoan
3375839a40 Merge branch 'l123wx-local_deployment_translate' 2024-09-30 07:35:26 +08:00
yoan
7f5ff6fab5 build ui 2024-09-30 07:34:44 +08:00
usual2970
5160b4c3d9 Merge pull request #120 from yanlc39/dev/fix_docker_deploy_way
簡化 Docker 部署的方式
2024-09-30 07:33:27 +08:00
Elvis Liao
85234b21c7 chore: translate local deployment form 2024-09-29 20:43:42 +08:00
yanlc39
223af9e09d feat: let docker deploy way simpley 2024-09-29 17:42:05 +08:00
usual2970
49fdf8213a Merge pull request #117 from sgpublic-forks/feat/pre_command
fix: wrong pre command reference
2024-09-29 08:30:04 +08:00
Madray Haven
7a48101015 fix: wrong pre command reference 2024-09-28 17:28:55 +08:00
22 changed files with 218 additions and 159 deletions

View File

@@ -1,4 +1,4 @@
[中文](README.md) | [English](README_EN.md)
[中文](README.md) | [English](README_EN.md)
# 🔒Certimate
@@ -18,13 +18,8 @@ Certimate 就是为了解决上述问题而产生的,它具有以下特点:
* [Why Certimate?](https://docs.certimate.me/blog/why-certimate)
* [域名变量及部署授权组介绍](https://docs.certimate.me/blog/multi-deployer)
Certimate 旨在为用户提供一个安全、简便的 SSL 证书管理解决方案。使用文档请访问[https://docs.certimate.me](https://docs.certimate.me)
## 一、安装
安装 Certimate 非常简单,你可以选择以下方式之一进行安装:
@@ -40,12 +35,11 @@ Certimate 旨在为用户提供一个安全、简便的 SSL 证书管理解决
> [!NOTE]
> MacOS 在执行二进制文件时会提示无法打开“certimate”因为Apple无法检查其是否包含恶意软件。可在系统设置> 隐私与安全性> 安全性 中点击 "仍然允许",然后再次尝试执行二进制文件。
### 2. Docker 安装
```bash
git clone git@github.com:usual2970/certimate.git && cd certimate/docker && docker compose up -d
mkdir -p ~/.certimate && cd ~/.certimate && curl -O https://raw.githubusercontent.com/usual2970/certimate/refs/heads/main/docker/docker-compose.yml && docker compose up -d
```
@@ -58,7 +52,6 @@ go mod vendor
go run main.go serve
```
## 二、使用
执行完上述安装操作后,在浏览器中访问 `http://127.0.0.1:8090` 即可访问 Certimate 管理页面。
@@ -72,17 +65,14 @@ go run main.go serve
## 三、支持的服务商列表
| 服务商 | 是否域名服务商 | 是否部署服务 | 备注 |
|------|------|-----|------|
| 阿里云| 是 | 是 | 支持阿里云注册的域名,支持部署到阿里云 CDN,OSS |
| 腾讯云| 是 | 是 | 支持腾讯云注册的域名,支持部署到腾讯云 CDN |
| 七牛云| 否 | 是 | 七牛云没有注册域名服务,支持部署到七牛云 CDN |
|CloudFlare| 是 | 否 | 支持 CloudFlare 注册的域名CloudFlare 服务自带SSL证书 |
|SSH| 否 | 是 | 支持部署到 SSH 服务器 |
|WEBHOOK| 否 | 是 | 支持回调到 WEBHOOK |
| 服务商 | 是否域名服务商 | 是否部署服务 | 备注 |
| ---------- | -------------- | ------------ | ------------------------------------------------------ |
| 阿里云 | 是 | 是 | 支持阿里云注册的域名,支持部署到阿里云 CDN,OSS |
| 腾讯云 | 是 | 是 | 支持腾讯云注册的域名,支持部署到腾讯云 CDN |
| 七牛云 | 否 | 是 | 七牛云没有注册域名服务,支持部署到七牛云 CDN |
| CloudFlare | 是 | 否 | 支持 CloudFlare 注册的域名CloudFlare 服务自带SSL证书 |
| SSH | 否 | 是 | 支持部署到 SSH 服务器 |
| WEBHOOK | 否 | 是 | 支持回调到 WEBHOOK |
## 四、系统截图
@@ -96,7 +86,6 @@ go run main.go serve
![history](https://i.imgur.com/aaPtSW7.jpeg)
## 五、概念
Certimate 的工作流程如下:
@@ -140,7 +129,6 @@ Certimate 申请证书后,会自动将证书部署到你指定的目标上,
## 六、常见问题
Q: 提供saas服务吗
> A: 不提供目前仅支持self-hosted私有部署
@@ -153,8 +141,6 @@ Q: 自动续期证书?
> A: 已经申请的证书会在过期前10天自动续期。每天会检查一次证书是否快要过期快要过期时会自动重新申请证书并部署到目标服务上。
## 七、贡献
Certimate 是一个免费且开源的项目,采用 [MIT 开源协议](LICENSE.md)。你可以使用它做任何你想做的事,甚至把它当作一个付费服务提供给用户。
@@ -168,8 +154,10 @@ Certimate 是一个免费且开源的项目,采用 [MIT 开源协议](LICENSE.
## 八、加入社区
* [Telegram-a new era of messaging](https://t.me/+ZXphsppxUg41YmVl)
* [Telegram-a new era of messaging](https://t.me/+ZXphsppxUg41YmVl)
* 微信群聊(需要邀请入群,可先加作者好友)
* 微信群聊
<img src="https://i.imgur.com/8xwsLTA.png" width="400"/>
<img src="https://i.imgur.com/zSHEoIm.png" width="400"/>
## 九、Star History
[![Stargazers over time](https://starchart.cc/usual2970/certimate.svg?variant=adaptive)](https://starchart.cc/usual2970/certimate)

View File

@@ -1,10 +1,9 @@
[中文](README.md) | [English](README_EN.md)
[中文](README.md) | [English](README_EN.md)
# 🔒Certimate
For individuals managing personal projects or those responsible for IT operations in small businesses who need to manage multiple domain names, applying for certificates manually comes with several drawbacks:
1. 😱Troublesome: Applying for and deploying certificates isnt difficult, but it can be quite a hassle, especially when managing multiple domains.
2. 😭Easily forgotten: The current free certificate has a validity period of only 90 days, requiring regular renewal operations. This increases the workload and makes it easy to forget, which can result in the website becoming inaccessible.
@@ -19,20 +18,14 @@ Related articles:
* [Why Certimate?](https://docs.certimate.me/blog/why-certimate)
* [Introduction to Domain Variables and Deployment Authorization Groups](https://docs.certimate.me/blog/multi-deployer)
Certimate aims to provide users with a secure and user-friendly SSL certificate management solution. For usage documentation, please visit.[https://docs.certimate.me](https://docs.certimate.me)
## Installation
Installing Certimate is very simple, you can choose one of the following methods for installation:
### 1. Binary File
You can download the precompiled binary files directly from the [Releases page](https://github.com/usual2970/certimate/releases), and after extracting them, execute:
```bash
@@ -42,12 +35,11 @@ You can download the precompiled binary files directly from the [Releases page](
> [!NOTE]
> When executing the binary file on macOS, you may see a prompt saying: “Cannot open certimate because Apple cannot check it for malicious software.” You can go to System Preferences > Security & Privacy > General, then click “Allow Anyway,” and try executing the binary file again.
### 2. Docker Installation
```bash
git clone git@github.com:usual2970/certimate.git && cd certimate/docker && docker compose up -d
mkdir -p ~/.certimate && cd ~/.certimate && curl -O https://raw.githubusercontent.com/usual2970/certimate/refs/heads/main/docker/docker-compose.yml && docker compose up -d
```
@@ -60,7 +52,6 @@ go mod vendor
go run main.go serve
```
## Usage
After completing the installation steps above, you can access the Certimate management page by visiting http://127.0.0.1:8090 in your browser.
@@ -74,19 +65,16 @@ password1234567890
## List of Supported Providers
| Provider | Domain Registrar | Deployment Service | Remarks |
| ------------- | ---------------- | ------------------ | ------------------------------------------------------------------------------------------------- |
| Alibaba Cloud | Yes | Yes | Supports domains registered with Alibaba Cloud; supports deployment to Alibaba Cloud CDN and OSS. |
| Tencent Cloud | Yes | Yes | Supports domains registered with Tencent Cloud; supports deployment to Tencent Cloud CDN. |
| Qiniu Cloud | No | Yes | Qiniu Cloud does not offer domain registration services; supports deployment to Qiniu Cloud CDN. |
| Cloudflare | Yes | No | Supports domains registered with Cloudflare; Cloudflare services come with SSL certificates. |
| SSH | No | Yes | Supports deployment to SSH servers. |
| WEBHOOK | No | Yes | Supports callbacks to WEBHOOK. |
| Provider | Domain Registrar | Deployment Service | Remarks |
|--------------|------------------|--------------------|------------------------------------------------------|
| Alibaba Cloud| Yes | Yes | Supports domains registered with Alibaba Cloud; supports deployment to Alibaba Cloud CDN and OSS. |
| Tencent Cloud| Yes | Yes | Supports domains registered with Tencent Cloud; supports deployment to Tencent Cloud CDN. |
| Qiniu Cloud | No | Yes | Qiniu Cloud does not offer domain registration services; supports deployment to Qiniu Cloud CDN. |
| Cloudflare | Yes | No | Supports domains registered with Cloudflare; Cloudflare services come with SSL certificates. |
| SSH | No | Yes | Supports deployment to SSH servers. |
| WEBHOOK | No | Yes | Supports callbacks to WEBHOOK. |
## Screenshots
## Screenshots
![login](https://i.imgur.com/SYjjbql.jpeg)
@@ -98,7 +86,6 @@ password1234567890
![history](https://i.imgur.com/aaPtSW7.jpeg)
## Concepts
The workflow of Certimate is as follows:
@@ -140,8 +127,7 @@ After Certimate applies for the certificate, it will automatically deploy the ce
The authorization information for the deployment service provider is the same as that for the DNS provider, with the distinction that the DNS provider's authorization information is used to prove that the domain belongs to you, while the deployment service provider's authorization information is used to provide authorization for the certificate deployment.
## FAQ
## FAQ
Q: Do you provide SaaS services?
@@ -155,8 +141,6 @@ Q: Automatic Certificate Renewal?
> A: Certificates that have already been issued will be automatically renewed 10 days before expiration. The system checks once a day to see if any certificates are nearing expiration, and if so, it will automatically reapply for the certificate and deploy it to the target service.
## Contributing
Certimate is a free and open-source project, licensed under the [MIT License](LICENSE.md). You can use it for anything you want, even offering it as a paid service to users.
@@ -170,8 +154,7 @@ Support for more service providers, UI enhancements, bug fixes, and documentatio
## Join the Community
* [Telegram-a new era of messaging](https://t.me/+ZXphsppxUg41YmVl)
* Wechat Group
* [Telegram-a new era of messaging](https://t.me/+ZXphsppxUg41YmVl)
* Wechat Group
<img src="https://i.imgur.com/zSHEoIm.png" width="400"/>

View File

@@ -71,7 +71,7 @@ func (s *ssh) Deploy(ctx context.Context) error {
// 执行前置命令
if access.PreCommand != "" {
err, stdout, stderr := s.sshExecCommand(client, access.Command)
err, stdout, stderr := s.sshExecCommand(client, access.PreCommand)
if err != nil {
return fmt.Errorf("failed to run pre-command: %w, stdout: %s, stderr: %s", err, stdout, stderr)
}

View File

@@ -31,11 +31,12 @@ func Send(title, content string) error {
return nil
}
n := notifyPackage.New()
// 添加推送渠道
notifyPackage.UseServices(notifiers...)
n.UseServices(notifiers...)
// 发送消息
return notifyPackage.Send(context.Background(), title, content)
return n.Send(context.Background(), title, content)
}
func getNotifiers() ([]notifyPackage.Notifier, error) {

View File

File diff suppressed because one or more lines are too long

2
ui/dist/index.html vendored
View File

@@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Certimate - Your Trusted SSL Automation Partner</title>
<script type="module" crossorigin src="/assets/index-TzNEc_kS.js"></script>
<script type="module" crossorigin src="/assets/index-Dn4jGLHB.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-I--T0qY3.css">
</head>
<body class="bg-background">

View File

@@ -24,9 +24,11 @@ import { PbErrorData } from "@/domain/base";
const AccessAliyunForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -69,6 +71,7 @@ const AccessAliyunForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -76,10 +79,11 @@ const AccessAliyunForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}
console.log(req);
addAccess(req);
} catch (e) {
const err = e as ClientResponseError;

View File

@@ -23,9 +23,11 @@ import { PbErrorData } from "@/domain/base";
const AccessCloudflareForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -65,6 +67,7 @@ const AccessCloudflareForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -72,7 +75,7 @@ const AccessCloudflareForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}

View File

@@ -36,7 +36,7 @@ import AccessGodaddyFrom from "./AccessGodaddyForm";
import AccessLocalForm from "./AccessLocalForm";
type TargetConfigEditProps = {
op: "add" | "edit";
op: "add" | "edit" | "copy";
className?: string;
trigger: React.ReactNode;
data?: Access;
@@ -60,6 +60,7 @@ export function AccessEdit({
form = (
<AccessTencentForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -70,6 +71,7 @@ export function AccessEdit({
form = (
<AccessAliyunForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -80,6 +82,7 @@ export function AccessEdit({
form = (
<AccessSSHForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -90,6 +93,7 @@ export function AccessEdit({
form = (
<WebhookForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -100,6 +104,7 @@ export function AccessEdit({
form = (
<AccessCloudflareForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -110,6 +115,7 @@ export function AccessEdit({
form = (
<AccessQiniuForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -120,6 +126,7 @@ export function AccessEdit({
form = (
<AccessNamesiloForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -130,6 +137,7 @@ export function AccessEdit({
form = (
<AccessGodaddyFrom
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -140,6 +148,7 @@ export function AccessEdit({
form = (
<AccessLocalForm
data={data}
op={op}
onAfterReq={() => {
setOpen(false);
}}
@@ -159,7 +168,7 @@ export function AccessEdit({
</DialogTrigger>
<DialogContent className="sm:max-w-[600px] w-full dark:text-stone-200">
<DialogHeader>
<DialogTitle>{op == "add" ? t('access.add') : t('access.edit')}</DialogTitle>
<DialogTitle>{op == "add" ? t('access.add') : op == "edit" ? t('access.edit') : t('access.copy')}</DialogTitle>
</DialogHeader>
<ScrollArea className="max-h-[80vh]">
<div className="container py-3">

View File

@@ -28,9 +28,11 @@ import { PbErrorData } from "@/domain/base";
const AccessGodaddyFrom = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -74,6 +76,7 @@ const AccessGodaddyFrom = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -81,7 +84,7 @@ const AccessGodaddyFrom = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}

View File

@@ -9,6 +9,7 @@ import { useConfig } from "@/providers/config";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { useTranslation } from "react-i18next";
import {
Form,
FormControl,
@@ -26,21 +27,24 @@ import { PbErrorData } from "@/domain/base";
const AccessLocalForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess, reloadAccessGroups } = useConfig();
const { t } = useTranslation();
const formSchema = z.object({
id: z.string().optional(),
name: z.string().min(1).max(64),
name: z.string().min(1, 'access.form.name.not.empty').max(64, t('zod.rule.string.max', { max: 64 })),
configType: accessFormType,
command: z.string().min(1).max(2048),
certPath: z.string().min(0).max(2048),
keyPath: z.string().min(0).max(2048),
command: z.string().min(1, 'access.form.ssh.command.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
certPath: z.string().min(0, 'access.form.ssh.cert.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
keyPath: z.string().min(0, 'access.form.ssh.key.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
});
let config: LocalConfig = {
@@ -54,7 +58,7 @@ const AccessLocalForm = ({
resolver: zodResolver(formSchema),
defaultValues: {
id: data?.id,
name: data?.name,
name: data?.name || '',
configType: "local",
certPath: config.certPath,
keyPath: config.keyPath,
@@ -77,6 +81,7 @@ const AccessLocalForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -84,7 +89,7 @@ const AccessLocalForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
} else {
addAccess(req);
@@ -123,9 +128,9 @@ const AccessLocalForm = ({
name="name"
render={({ field }) => (
<FormItem>
<FormLabel></FormLabel>
<FormLabel>{t('name')}</FormLabel>
<FormControl>
<Input placeholder="请输入授权名称" {...field} />
<Input placeholder={t('access.form.name.not.empty')} {...field} />
</FormControl>
<FormMessage />
@@ -138,7 +143,7 @@ const AccessLocalForm = ({
name="id"
render={({ field }) => (
<FormItem className="hidden">
<FormLabel></FormLabel>
<FormLabel>{t('access.form.config.field')}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
@@ -153,7 +158,7 @@ const AccessLocalForm = ({
name="configType"
render={({ field }) => (
<FormItem className="hidden">
<FormLabel></FormLabel>
<FormLabel>{t('access.form.config.field')}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
@@ -168,9 +173,9 @@ const AccessLocalForm = ({
name="certPath"
render={({ field }) => (
<FormItem>
<FormLabel></FormLabel>
<FormLabel>{t('access.form.ssh.cert.path')}</FormLabel>
<FormControl>
<Input placeholder="请输入证书上传路径" {...field} />
<Input placeholder={t('access.form.ssh.cert.path.not.empty')} {...field} />
</FormControl>
<FormMessage />
@@ -183,9 +188,9 @@ const AccessLocalForm = ({
name="keyPath"
render={({ field }) => (
<FormItem>
<FormLabel></FormLabel>
<FormLabel>{t('access.form.ssh.key.path')}</FormLabel>
<FormControl>
<Input placeholder="请输入私钥上传路径" {...field} />
<Input placeholder={t('access.form.ssh.key.path.not.empty')} {...field} />
</FormControl>
<FormMessage />
@@ -198,9 +203,9 @@ const AccessLocalForm = ({
name="command"
render={({ field }) => (
<FormItem>
<FormLabel>Command</FormLabel>
<FormLabel>{t('access.form.ssh.command')}</FormLabel>
<FormControl>
<Textarea placeholder="请输入要执行的命令" {...field} />
<Textarea placeholder={t('access.form.ssh.command.not.empty')} {...field} />
</FormControl>
<FormMessage />
@@ -211,7 +216,7 @@ const AccessLocalForm = ({
<FormMessage />
<div className="flex justify-end">
<Button type="submit"></Button>
<Button type="submit">{t('save')}</Button>
</div>
</form>
</Form>

View File

@@ -23,9 +23,11 @@ import { PbErrorData } from "@/domain/base";
const AccessNamesiloForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -64,6 +66,7 @@ const AccessNamesiloForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -71,7 +74,7 @@ const AccessNamesiloForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}

View File

@@ -24,9 +24,11 @@ import { PbErrorData } from "@/domain/base";
const AccessQiniuForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -69,6 +71,7 @@ const AccessQiniuForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -76,7 +79,7 @@ const AccessQiniuForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}

View File

@@ -39,9 +39,11 @@ import { updateById } from "@/repository/access_group";
const AccessSSHForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const {
@@ -80,8 +82,8 @@ const AccessSSHForm = ({
password: z.string().min(0, 'password.not.empty').max(64, t('zod.rule.string.max', { max: 64 })),
key: z.string().min(0, 'access.form.ssh.key.not.empty').max(20480, t('zod.rule.string.max', { max: 20480 })),
keyFile: z.any().optional(),
preCommand: z.string().min(0).max(2048).optional(),
preCommand: z.string().min(0).max(2048, t('zod.rule.string.max', { max: 2048 })).optional(),
command: z.string().min(1, 'access.form.ssh.command.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
certPath: z.string().min(0, 'access.form.ssh.cert.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
keyPath: z.string().min(0, 'access.form.ssh.key.path.not.empty').max(2048, t('zod.rule.string.max', { max: 2048 })),
@@ -122,7 +124,6 @@ const AccessSSHForm = ({
});
const onSubmit = async (data: z.infer<typeof formSchema>) => {
console.log(data);
let group = data.group;
if (group == "emptyId") group = "";
@@ -146,6 +147,7 @@ const AccessSSHForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -153,7 +155,7 @@ const AccessSSHForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
} else {
addAccess(req);
@@ -480,9 +482,9 @@ const AccessSSHForm = ({
name="preCommand"
render={({ field }) => (
<FormItem>
<FormLabel> Command</FormLabel>
<FormLabel>{t('access.form.ssh.pre.command')}</FormLabel>
<FormControl>
<Textarea placeholder="请输入要在部署证书前执行的前置命令" {...field} />
<Textarea placeholder={t('access.form.ssh.pre.command.not.empty')} {...field} />
</FormControl>
<FormMessage />

View File

@@ -23,9 +23,11 @@ import { PbErrorData } from "@/domain/base";
const AccessTencentForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -68,6 +70,7 @@ const AccessTencentForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -75,7 +78,7 @@ const AccessTencentForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}

View File

@@ -23,9 +23,11 @@ import { PbErrorData } from "@/domain/base";
const WebhookForm = ({
data,
op,
onAfterReq,
}: {
data?: Access;
op: "add" | "edit" | "copy";
onAfterReq: () => void;
}) => {
const { addAccess, updateAccess } = useConfig();
@@ -64,6 +66,7 @@ const WebhookForm = ({
};
try {
req.id = op == "copy" ? "" : req.id;
const rs = await save(req);
onAfterReq();
@@ -71,7 +74,7 @@ const WebhookForm = ({
req.id = rs.id;
req.created = rs.created;
req.updated = rs.updated;
if (data.id) {
if (data.id && op == "edit") {
updateAccess(req);
return;
}

View File

@@ -9,7 +9,7 @@ export const accessTypeMap: Map<string, [string, string]> = new Map([
["qiniu", ["qiniu", "/imgs/providers/qiniu.svg"]],
["ssh", ["ssh", "/imgs/providers/ssh.svg"]],
["webhook", ["webhook", "/imgs/providers/webhook.svg"]],
["local", ["local", "/imgs/providers/local.svg"]],
["local", ["local.deployment", "/imgs/providers/local.svg"]],
]);
export const getProviderInfo = (t: string) => {

View File

@@ -47,7 +47,7 @@ export const targetTypeMap: Map<string, [string, string]> = new Map([
["ssh", ["ssh", "/imgs/providers/ssh.svg"]],
["qiniu-cdn", ["qiniu.cdn", "/imgs/providers/qiniu.svg"]],
["webhook", ["webhook", "/imgs/providers/webhook.svg"]],
["local", ["local", "/imgs/providers/local.svg"]],
["local", ["local.deployment", "/imgs/providers/local.svg"]],
]);
export const targetTypeKeys = Array.from(targetTypeMap.keys());

View File

@@ -1 +1 @@
export const version = "Certimate v0.1.12";
export const version = "Certimate v0.1.15";

View File

@@ -21,6 +21,7 @@
"cancel": "Cancel",
"confirm": "Confirm",
"edit": "Edit",
"copy": "Copy",
"succeed": "Successful",
"add": "Add",
"document": "Document",
@@ -42,7 +43,7 @@
"ding.talk": "Ding Talk",
"telegram": "Telegram",
"webhook": "Webhook",
"local": "Local Deployment",
"local.deployment": "Local Deployment",
"tencent": "Tencent",
"tencent.cdn": "Tencent-CDN",
"aliyun": "Alibaba Cloud",
@@ -154,6 +155,8 @@
"access.management": "Authorization Management",
"access.add": "Add Authorization",
"access.edit": "Edit Authorization",
"access.copy": "Copy Authorization",
"access.delete.confirm": "Are you sure you want to delete the deployment authorization?",
"access.all": "All Authorizations",
"access.list": "Authorization List",
"access.type": "Provider",
@@ -200,10 +203,12 @@
"access.form.ssh.key": "Key (Log in using certificate)",
"access.form.ssh.key.not.empty": "Please enter Key",
"access.form.ssh.key.file.not.empty": "Please select file",
"access.form.ssh.cert.path": "Certificate Upload Path",
"access.form.ssh.cert.path.not.empty": "Please enter certificate upload path",
"access.form.ssh.key.path": "Private Key Upload Path",
"access.form.ssh.key.path.not.empty": "Please enter private key upload path",
"access.form.ssh.cert.path": "Certificate Save Path",
"access.form.ssh.cert.path.not.empty": "Please enter certificate save path",
"access.form.ssh.key.path": "Private Key Save Path",
"access.form.ssh.key.path.not.empty": "Please enter private key save path",
"access.form.ssh.pre.command": "Pre-deployment Command",
"access.form.ssh.pre.command.not.empty": "Command to be executed before deploying the certificate",
"access.form.ssh.command": "Command",
"access.form.ssh.command.not.empty": "Please enter command",
"access.form.ding.access.token.placeholder": "Signature for signed addition"

View File

@@ -21,6 +21,7 @@
"cancel": "取消",
"confirm": "确认",
"edit": "编辑",
"copy": "复制",
"succeed": "成功",
"add": "新增",
"document": "文档",
@@ -42,7 +43,7 @@
"ding.talk": "钉钉",
"telegram": "Telegram",
"webhook": "Webhook",
"local": "本地部署",
"local.deployment": "本地部署",
"tencent": "腾讯云",
"tencent.cdn": "腾讯云-CDN",
"aliyun": "阿里云",
@@ -154,6 +155,8 @@
"access.management": "授权管理",
"access.add": "添加授权",
"access.edit": "编辑授权",
"access.copy": "复制授权",
"access.delete.confirm": "确定要删除授权吗?",
"access.all": "所有授权",
"access.list": "授权列表",
"access.type": "服务商",
@@ -200,10 +203,12 @@
"access.form.ssh.key": "Key使用证书登录",
"access.form.ssh.key.not.empty": "请输入 Key",
"access.form.ssh.key.file.not.empty": "请选择文件",
"access.form.ssh.cert.path": "证书上传路径",
"access.form.ssh.cert.path.not.empty": "请输入证书上传路径",
"access.form.ssh.key.path": "私钥上传路径",
"access.form.ssh.key.path.not.empty": "请输入私钥上传路径",
"access.form.ssh.cert.path": "证书保存路径",
"access.form.ssh.cert.path.not.empty": "请输入证书保存路径",
"access.form.ssh.key.path": "私钥保存路径",
"access.form.ssh.key.path.not.empty": "请输入私钥保存路径",
"access.form.ssh.pre.command": "前置 Command",
"access.form.ssh.pre.command.not.empty": "在部署证书前执行的前置命令",
"access.form.ssh.command": "Command",
"access.form.ssh.command.not.empty": "请输入要执行的命令",
"access.form.ding.access.token.placeholder": "加签的签名"

View File

@@ -12,6 +12,15 @@ import { remove } from "@/repository/access";
import { t } from "i18next";
import { Key } from "lucide-react";
import { useLocation, useNavigate } from "react-router-dom";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent, AlertDialogDescription, AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger
} from "@/components/ui/alert-dialog.tsx";
const Access = () => {
const { config, deleteAccess } = useConfig();
@@ -149,15 +158,45 @@ const Access = () => {
data={access}
/>
<Separator orientation="vertical" className="h-4 mx-2" />
<Button
variant={"link"}
className="p-0"
onClick={() => {
handleDelete(access);
}}
>
{t("delete")}
</Button>
<AccessEdit
trigger={
<Button variant={"link"} className="p-0">
{t("copy")}
</Button>
}
op="copy"
data={access}
/>
<Separator orientation="vertical" className="h-4 mx-2" />
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant={"link"} size={"sm"}>
{t('delete')}
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle className="dark:text-gray-200">
{t('access.group.delete')}
</AlertDialogTitle>
<AlertDialogDescription>
{t('access.delete.confirm')}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel className="dark:text-gray-200">
{t('cancel')}
</AlertDialogCancel>
<AlertDialogAction
onClick={() => {
handleDelete(access);
}}
>
{t('confirm')}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
</div>
))}