mirror of https://github.com/1Panel-dev/1Panel
feat: 证书模块增加一些提示 (#3126)
parent
732080b0bf
commit
e687f82126
|
@ -153,10 +153,12 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
|
||||||
}
|
}
|
||||||
create.ID = websiteSSL.ID
|
create.ID = websiteSSL.ID
|
||||||
go func() {
|
go func() {
|
||||||
if err = w.ObtainSSL(request.WebsiteSSLApply{
|
if create.Provider != constant.DnsManual {
|
||||||
ID: websiteSSL.ID,
|
if err = w.ObtainSSL(request.WebsiteSSLApply{
|
||||||
}); err != nil {
|
ID: websiteSSL.ID,
|
||||||
global.LOG.Errorf("obtain ssl failed, err: %v", err)
|
}); err != nil {
|
||||||
|
global.LOG.Errorf("obtain ssl failed, err: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return create, nil
|
return create, nil
|
||||||
|
|
|
@ -19,7 +19,7 @@ var UpdateAcmeAccount = &gormigrate.Migration{
|
||||||
}
|
}
|
||||||
|
|
||||||
var AddWebsiteCA = &gormigrate.Migration{
|
var AddWebsiteCA = &gormigrate.Migration{
|
||||||
ID: "20231130-add-website-ca",
|
ID: "20231125-add-website-ca",
|
||||||
Migrate: func(tx *gorm.DB) error {
|
Migrate: func(tx *gorm.DB) error {
|
||||||
if err := tx.AutoMigrate(&model.WebsiteCA{}); err != nil {
|
if err := tx.AutoMigrate(&model.WebsiteCA{}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -59,7 +59,7 @@ var AddDatabaseSSL = &gormigrate.Migration{
|
||||||
}
|
}
|
||||||
|
|
||||||
var AddDefaultCA = &gormigrate.Migration{
|
var AddDefaultCA = &gormigrate.Migration{
|
||||||
ID: "20231130-add-default-ca",
|
ID: "20231129-add-default-ca",
|
||||||
Migrate: func(tx *gorm.DB) error {
|
Migrate: func(tx *gorm.DB) error {
|
||||||
caService := service.NewIWebsiteCAService()
|
caService := service.NewIWebsiteCAService()
|
||||||
if _, err := caService.Create(request.WebsiteCACreate{
|
if _, err := caService.Create(request.WebsiteCACreate{
|
||||||
|
|
|
@ -150,26 +150,15 @@ func NewRegisterClient(acmeAccount *model.WebsiteAcmeAccount) (*AcmeClient, erro
|
||||||
|
|
||||||
func newConfig(user *AcmeUser, accountType string) *lego.Config {
|
func newConfig(user *AcmeUser, accountType string) *lego.Config {
|
||||||
config := lego.NewConfig(user)
|
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 {
|
switch accountType {
|
||||||
case "letsencrypt":
|
case "letsencrypt":
|
||||||
config.CADirURL = "https://acme-staging-v02.api.letsencrypt.org/directory"
|
config.CADirURL = "https://acme-v02.api.letsencrypt.org/directory"
|
||||||
case "zerossl":
|
case "zerossl":
|
||||||
config.CADirURL = "https://acme.zerossl.com/v2/DV90"
|
config.CADirURL = "https://acme.zerossl.com/v2/DV90"
|
||||||
case "buypass":
|
case "buypass":
|
||||||
config.CADirURL = "https://api.test4.buypass.no/acme/directory"
|
config.CADirURL = "https://api.buypass.com/acme/directory"
|
||||||
case "google":
|
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"
|
config.UserAgent = "1Panel"
|
||||||
|
|
|
@ -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',
|
'Two files will be generated in this directory, the certificate file: fullchain.pem and the key file: privkey.pem',
|
||||||
organizationDetail: 'Organization Details',
|
organizationDetail: 'Organization Details',
|
||||||
fromWebsite: 'From Websites',
|
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: {
|
firewall: {
|
||||||
create: 'Create rule',
|
create: 'Create rule',
|
||||||
|
|
|
@ -1742,6 +1742,11 @@ const message = {
|
||||||
pushDirHelper: '會在此目錄下產生兩個文件,憑證檔案:fullchain.pem 金鑰檔案:privkey.pem',
|
pushDirHelper: '會在此目錄下產生兩個文件,憑證檔案:fullchain.pem 金鑰檔案:privkey.pem',
|
||||||
organizationDetail: '機構詳情',
|
organizationDetail: '機構詳情',
|
||||||
fromWebsite: '從網站獲取',
|
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: {
|
firewall: {
|
||||||
create: '創建規則',
|
create: '創建規則',
|
||||||
|
|
|
@ -1742,6 +1742,11 @@ const message = {
|
||||||
pushDirHelper: '会在此目录下生成两个文件,证书文件:fullchain.pem 密钥文件:privkey.pem',
|
pushDirHelper: '会在此目录下生成两个文件,证书文件:fullchain.pem 密钥文件:privkey.pem',
|
||||||
organizationDetail: '机构详情',
|
organizationDetail: '机构详情',
|
||||||
fromWebsite: '从网站中获取',
|
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: {
|
firewall: {
|
||||||
create: '创建规则',
|
create: '创建规则',
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
:value="acme.value"
|
:value="acme.value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<span class="input-help" v-if="account.type === 'buypass'">
|
||||||
|
{{ $t('ssl.buypassHelper') }}
|
||||||
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('website.keyType')" prop="keyType">
|
<el-form-item :label="$t('website.keyType')" prop="keyType">
|
||||||
<el-select v-model="account.keyType">
|
<el-select v-model="account.keyType">
|
||||||
|
@ -39,6 +42,7 @@
|
||||||
<el-form-item label="EAB HmacKey" prop="eabHmacKey">
|
<el-form-item label="EAB HmacKey" prop="eabHmacKey">
|
||||||
<el-input v-model.trim="account.eabHmacKey"></el-input>
|
<el-input v-model.trim="account.eabHmacKey"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<span v-html="$t('ssl.googleHelper')"></span>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
|
@ -61,6 +61,12 @@
|
||||||
<el-radio label="dnsManual">{{ $t('website.dnsManual') }}</el-radio>
|
<el-radio label="dnsManual">{{ $t('website.dnsManual') }}</el-radio>
|
||||||
<el-radio label="http">HTTP</el-radio>
|
<el-radio label="http">HTTP</el-radio>
|
||||||
</el-radio-group>
|
</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>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$t('website.dnsAccount')"
|
:label="$t('website.dnsAccount')"
|
||||||
|
@ -258,8 +264,10 @@ const submit = async (formEl: FormInstance | undefined) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
CreateSSL(ssl.value)
|
CreateSSL(ssl.value)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
|
if (ssl.value.provider != 'dnsManual') {
|
||||||
|
em('submit', res.data.id);
|
||||||
|
}
|
||||||
handleClose();
|
handleClose();
|
||||||
em('submit', res.data.id);
|
|
||||||
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
|
@ -2,13 +2,6 @@
|
||||||
<div>
|
<div>
|
||||||
<RouterButton :buttons="routerButton" />
|
<RouterButton :buttons="routerButton" />
|
||||||
<LayoutContent :title="$t('website.ssl')">
|
<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>
|
<template #toolbar>
|
||||||
<el-button type="primary" @click="openSSL()">
|
<el-button type="primary" @click="openSSL()">
|
||||||
{{ $t('ssl.create') }}
|
{{ $t('ssl.create') }}
|
||||||
|
|
Loading…
Reference in New Issue