diff --git a/backend/app/dto/request/website_ssl.go b/backend/app/dto/request/website_ssl.go
index d9f9fdbf1..9ec8fc6a9 100644
--- a/backend/app/dto/request/website_ssl.go
+++ b/backend/app/dto/request/website_ssl.go
@@ -18,6 +18,8 @@ type WebsiteSSLCreate struct {
Apply bool `json:"apply"`
PushDir bool `json:"pushDir"`
Dir string `json:"dir"`
+ ID uint `json:"id"`
+ Description string `json:"description"`
}
type WebsiteDNSReq struct {
@@ -66,9 +68,6 @@ type WebsiteSSLUpdate struct {
ID uint `json:"id" validate:"required"`
AutoRenew bool `json:"autoRenew"`
Description string `json:"description"`
- PrivateKey string `json:"privateKey"`
- Certificate string `json:"certificate"`
- Type string `json:"type" validate:"required,oneof=autoRenew description certificate privateKey"`
}
type WebsiteSSLUpload struct {
diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go
index 3c38b35aa..9b66ccd39 100644
--- a/backend/app/service/website_ssl.go
+++ b/backend/app/service/website_ssl.go
@@ -115,6 +115,7 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
ExpireDate: time.Now(),
KeyType: create.KeyType,
PushDir: create.PushDir,
+ Description: create.Description,
}
if create.PushDir {
if !files.NewFileOp().Stat(create.Dir) {
@@ -150,7 +151,14 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
if err := websiteSSLRepo.Create(context.TODO(), &websiteSSL); err != nil {
return res, err
}
-
+ create.ID = websiteSSL.ID
+ go func() {
+ if err = w.ObtainSSL(request.WebsiteSSLApply{
+ ID: websiteSSL.ID,
+ }); err != nil {
+ global.LOG.Errorf("obtain ssl failed, err: %v", err)
+ }
+ }()
return create, nil
}
@@ -343,6 +351,7 @@ func (w WebsiteSSLService) Update(update request.WebsiteSSLUpdate) error {
return err
}
websiteSSL.AutoRenew = update.AutoRenew
+ websiteSSL.Description = update.Description
return websiteSSLRepo.Save(websiteSSL)
}
diff --git a/frontend/src/api/interface/website.ts b/frontend/src/api/interface/website.ts
index 493f6ae34..badf3e902 100644
--- a/frontend/src/api/interface/website.ts
+++ b/frontend/src/api/interface/website.ts
@@ -166,6 +166,7 @@ export namespace Website {
acmeAccountId?: number;
status: string;
domains: string;
+ description: string;
}
export interface SSLDTO extends SSL {
@@ -178,6 +179,8 @@ export namespace Website {
provider: string;
acmeAccountId: number;
dnsAccountId: number;
+ id?: number;
+ description: string;
}
export interface SSLApply {
@@ -192,6 +195,7 @@ export namespace Website {
export interface SSLUpdate {
id: number;
autoRenew: boolean;
+ description: string;
}
export interface AcmeAccount extends CommonModel {
diff --git a/frontend/src/views/website/ssl/create/index.vue b/frontend/src/views/website/ssl/create/index.vue
index f96fc1816..42692f1cb 100644
--- a/frontend/src/views/website/ssl/create/index.vue
+++ b/frontend/src/views/website/ssl/create/index.vue
@@ -16,6 +16,9 @@
v-model="ssl.otherDomains"
>
+
+
+
({
keyType: 'P256',
pushDir: false,
dir: '',
+ description: '',
});
const ssl = ref(initData());
const dnsResolve = ref([]);
-const em = defineEmits(['close']);
+const em = defineEmits(['close', 'submit']);
const handleClose = () => {
resetForm();
open.value = false;
@@ -211,8 +215,9 @@ const submit = async (formEl: FormInstance | undefined) => {
}
loading.value = true;
CreateSSL(ssl.value)
- .then(() => {
+ .then((res: any) => {
handleClose();
+ em('submit', res.data.id);
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
})
.finally(() => {
diff --git a/frontend/src/views/website/ssl/index.vue b/frontend/src/views/website/ssl/index.vue
index cf71c26b8..0688e207a 100644
--- a/frontend/src/views/website/ssl/index.vue
+++ b/frontend/src/views/website/ssl/index.vue
@@ -109,6 +109,18 @@
show-overflow-tooltip
prop="organization"
>
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -165,6 +177,7 @@ import SSLUpload from './upload/index.vue';
import Apply from './apply/index.vue';
import Log from '@/components/log-dialog/index.vue';
import Obtain from './obtain/index.vue';
+import MsgInfo from '@/components/msg-info/index.vue';
const globalStore = GlobalStore();
const paginationConfig = reactive({
@@ -280,9 +293,14 @@ const search = () => {
});
};
+const updateDesc = (row: Website.SSLDTO, bulr: Function) => {
+ bulr();
+ updateConfig(row);
+};
+
const updateConfig = (row: Website.SSLDTO) => {
loading.value = true;
- UpdateSSL({ id: row.id, autoRenew: row.autoRenew })
+ UpdateSSL({ id: row.id, autoRenew: row.autoRenew, description: row.description })
.then(() => {
MsgSuccess(i18n.global.t('commons.msg.updateSuccess'));
})