mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
feat: 增加cloudFlare
This commit is contained in:
parent
b1a4d9df00
commit
837705f66f
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||||
"github.com/go-acme/lego/v4/lego"
|
"github.com/go-acme/lego/v4/lego"
|
||||||
"github.com/go-acme/lego/v4/providers/dns/alidns"
|
"github.com/go-acme/lego/v4/providers/dns/alidns"
|
||||||
|
"github.com/go-acme/lego/v4/providers/dns/cloudflare"
|
||||||
"github.com/go-acme/lego/v4/providers/dns/dnspod"
|
"github.com/go-acme/lego/v4/providers/dns/dnspod"
|
||||||
"github.com/go-acme/lego/v4/providers/http/webroot"
|
"github.com/go-acme/lego/v4/providers/http/webroot"
|
||||||
"github.com/go-acme/lego/v4/registration"
|
"github.com/go-acme/lego/v4/registration"
|
||||||
@ -64,6 +65,7 @@ type DnsType string
|
|||||||
const (
|
const (
|
||||||
DnsPod DnsType = "DnsPod"
|
DnsPod DnsType = "DnsPod"
|
||||||
AliYun DnsType = "AliYun"
|
AliYun DnsType = "AliYun"
|
||||||
|
Cloudflare DnsType = "Cloudflare"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DNSParam struct {
|
type DNSParam struct {
|
||||||
@ -101,6 +103,15 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if dnsType == Cloudflare {
|
||||||
|
cloudflareConfig := cloudflare.NewDefaultConfig()
|
||||||
|
cloudflareConfig.AuthEmail = param.Email
|
||||||
|
cloudflareConfig.AuthKey = param.APIkey
|
||||||
|
p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return c.Client.Challenge.SetDNS01Provider(p, dns01.AddDNSTimeout(3*time.Minute))
|
return c.Client.Challenge.SetDNS01Provider(p, dns01.AddDNSTimeout(3*time.Minute))
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ export default {
|
|||||||
applySSL: '证书申请',
|
applySSL: '证书申请',
|
||||||
SSLList: '证书列表',
|
SSLList: '证书列表',
|
||||||
createDnsAccount: 'DNS账号',
|
createDnsAccount: 'DNS账号',
|
||||||
aliyun: '阿里云',
|
aliyun: '阿里云DNS',
|
||||||
manual: '手动解析',
|
manual: '手动解析',
|
||||||
key: '密钥',
|
key: '密钥',
|
||||||
check: '查看',
|
check: '查看',
|
||||||
|
@ -30,6 +30,14 @@
|
|||||||
<el-input v-model="account.authorization['token']"></el-input>
|
<el-input v-model="account.authorization['token']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="account.type === 'CloudFlare'">
|
||||||
|
<el-form-item label="EMAIL" prop="authorization.email">
|
||||||
|
<el-input v-model="account.authorization['email']"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="API Key" prop="authorization.apiKey">
|
||||||
|
<el-input v-model="account.authorization['apiKey']"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
@ -84,6 +92,8 @@ let rules = ref({
|
|||||||
secretKey: [Rules.requiredInput],
|
secretKey: [Rules.requiredInput],
|
||||||
id: [Rules.requiredInput],
|
id: [Rules.requiredInput],
|
||||||
token: [Rules.requiredInput],
|
token: [Rules.requiredInput],
|
||||||
|
email: [Rules.requiredInput],
|
||||||
|
apiKey: [Rules.requiredInput],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
let account = ref({
|
let account = ref({
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
<el-button type="primary" plain @click="openCreate">{{ $t('commons.button.create') }}</el-button>
|
<el-button type="primary" plain @click="openCreate">{{ $t('commons.button.create') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-table-column :label="$t('commons.table.name')" fix show-overflow-tooltip prop="name"></el-table-column>
|
<el-table-column :label="$t('commons.table.name')" fix show-overflow-tooltip prop="name"></el-table-column>
|
||||||
<el-table-column :label="$t('commons.table.type')" prop="type"></el-table-column>
|
<el-table-column :label="$t('commons.table.type')" prop="type">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.type == 'AliYun'">{{ $t('website.aliyun') }}</span>
|
||||||
|
<span v-else>{{ row.type }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column :label="$t('website.key')">
|
<el-table-column :label="$t('website.key')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-link @click="openEdit(row)">{{ $t('website.check') }}</el-link>
|
<el-link @click="openEdit(row)">{{ $t('website.check') }}</el-link>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user