feat: 证书模块增加一些提示 (#3126)

pull/3136/head
zhengkunwang 2023-12-01 16:54:09 +08:00 committed by GitHub
parent 732080b0bf
commit e687f82126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 39 additions and 28 deletions

View File

@ -153,10 +153,12 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
}
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)
if create.Provider != constant.DnsManual {
if err = w.ObtainSSL(request.WebsiteSSLApply{
ID: websiteSSL.ID,
}); err != nil {
global.LOG.Errorf("obtain ssl failed, err: %v", err)
}
}
}()
return create, nil

View File

@ -19,7 +19,7 @@ var UpdateAcmeAccount = &gormigrate.Migration{
}
var AddWebsiteCA = &gormigrate.Migration{
ID: "20231130-add-website-ca",
ID: "20231125-add-website-ca",
Migrate: func(tx *gorm.DB) error {
if err := tx.AutoMigrate(&model.WebsiteCA{}); err != nil {
return err
@ -59,7 +59,7 @@ var AddDatabaseSSL = &gormigrate.Migration{
}
var AddDefaultCA = &gormigrate.Migration{
ID: "20231130-add-default-ca",
ID: "20231129-add-default-ca",
Migrate: func(tx *gorm.DB) error {
caService := service.NewIWebsiteCAService()
if _, err := caService.Create(request.WebsiteCACreate{

View File

@ -150,26 +150,15 @@ func NewRegisterClient(acmeAccount *model.WebsiteAcmeAccount) (*AcmeClient, erro
func newConfig(user *AcmeUser, accountType string) *lego.Config {
config := lego.NewConfig(user)
//switch accountType {
//case "letsencrypt":
// config.CADirURL = "https://acme-v02.api.letsencrypt.org/directory"
//case "zerossl":
// config.CADirURL = "https://acme.zerossl.com/v2/DV90"
//case "buypass":
// config.CADirURL = "https://api.buypass.com/acme/directory"
//case "google":
// config.CADirURL = "https://dv.acme-v02.api.pki.goog/directory"
//}
switch accountType {
case "letsencrypt":
config.CADirURL = "https://acme-staging-v02.api.letsencrypt.org/directory"
config.CADirURL = "https://acme-v02.api.letsencrypt.org/directory"
case "zerossl":
config.CADirURL = "https://acme.zerossl.com/v2/DV90"
case "buypass":
config.CADirURL = "https://api.test4.buypass.no/acme/directory"
config.CADirURL = "https://api.buypass.com/acme/directory"
case "google":
config.CADirURL = "https://dv.acme-v02.test-api.pki.goog/directory\""
config.CADirURL = "https://dv.acme-v02.api.pki.goog/directory"
}
config.UserAgent = "1Panel"

View File

@ -1856,6 +1856,11 @@ const message = {
'Two files will be generated in this directory, the certificate file: fullchain.pem and the key file: privkey.pem',
organizationDetail: 'Organization Details',
fromWebsite: 'From Websites',
dnsMauanlHelper: ' DNS ',
httpHelper: 'HTTP OpenResty',
buypassHelper: 'Buypass ',
googleHelper:
"<a target=“_blank” href='https://cloud.google.com/certificate-manager/docs/public-ca-tutorial?hl=zh-cn'>如何取得EAB HmacKey 和EAB kid</a > ",
},
firewall: {
create: 'Create rule',

View File

@ -1742,6 +1742,11 @@ const message = {
pushDirHelper: 'fullchain.pem privkey.pem',
organizationDetail: '',
fromWebsite: '',
dnsMauanlHelper: ' DNS ',
httpHelper: 'HTTP OpenResty',
buypassHelper: 'Buypass ',
googleHelper:
"<a target=“_blank” href='https://cloud.google.com/certificate-manager/docs/public-ca-tutorial?hl=zh-cn'>如何取得EAB HmacKey 和EAB kid</a > ",
},
firewall: {
create: '',

View File

@ -1742,6 +1742,11 @@ const message = {
pushDirHelper: 'fullchain.pem privkey.pem',
organizationDetail: '',
fromWebsite: '',
dnsMauanlHelper: ' DNS ',
httpHelper: 'HTTP OpenResty',
buypassHelper: 'Buypass 访',
googleHelper:
"<a target=“_blank” href='https://cloud.google.com/certificate-manager/docs/public-ca-tutorial?hl=zh-cn'>如何获取 EAB HmacKey 和 EAB kid</a> ",
},
firewall: {
create: '',

View File

@ -21,6 +21,9 @@
:value="acme.value"
></el-option>
</el-select>
<span class="input-help" v-if="account.type === 'buypass'">
{{ $t('ssl.buypassHelper') }}
</span>
</el-form-item>
<el-form-item :label="$t('website.keyType')" prop="keyType">
<el-select v-model="account.keyType">
@ -39,6 +42,7 @@
<el-form-item label="EAB HmacKey" prop="eabHmacKey">
<el-input v-model.trim="account.eabHmacKey"></el-input>
</el-form-item>
<span v-html="$t('ssl.googleHelper')"></span>
</div>
</el-form>
</el-col>

View File

@ -61,6 +61,12 @@
<el-radio label="dnsManual">{{ $t('website.dnsManual') }}</el-radio>
<el-radio label="http">HTTP</el-radio>
</el-radio-group>
<span class="input-help" v-if="ssl.provider === 'dnsManual'">
{{ $t('ssl.dnsMauanlHelper') }}
</span>
<span class="input-help" v-if="ssl.provider === 'http'">
{{ $t('ssl.httpHelper') }}
</span>
</el-form-item>
<el-form-item
:label="$t('website.dnsAccount')"
@ -258,8 +264,10 @@ const submit = async (formEl: FormInstance | undefined) => {
loading.value = true;
CreateSSL(ssl.value)
.then((res: any) => {
if (ssl.value.provider != 'dnsManual') {
em('submit', res.data.id);
}
handleClose();
em('submit', res.data.id);
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
})
.finally(() => {

View File

@ -2,13 +2,6 @@
<div>
<RouterButton :buttons="routerButton" />
<LayoutContent :title="$t('website.ssl')">
<template #prompt>
<el-alert type="info" :closable="false">
<template #default>
<span><span v-html="$t('website.encryptHelper')"></span></span>
</template>
</el-alert>
</template>
<template #toolbar>
<el-button type="primary" @click="openSSL()">
{{ $t('ssl.create') }}