mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-07 23:25:30 +08:00
feat: add DNS provider ClouDNS (#8207)
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after 10m28s
Some checks failed
SonarCloud Scan / SonarCloud (push) Failing after 10m28s
* feat: add DNS provider ClouDNS * feat: ClouDNS account parameter validation
This commit is contained in:
parent
3c4a1ea614
commit
ed12bec460
3 changed files with 37 additions and 1 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
"github.com/go-acme/lego/v4/lego"
|
||||
"github.com/go-acme/lego/v4/providers/dns/alidns"
|
||||
"github.com/go-acme/lego/v4/providers/dns/clouddns"
|
||||
"github.com/go-acme/lego/v4/providers/dns/cloudns"
|
||||
"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/godaddy"
|
||||
|
@ -75,6 +76,7 @@ const (
|
|||
Volcengine DnsType = "Volcengine"
|
||||
CloudFlare DnsType = "CloudFlare"
|
||||
CloudDns DnsType = "CloudDns"
|
||||
ClouDNS DnsType = "ClouDNS"
|
||||
FreeMyIP DnsType = "FreeMyIP"
|
||||
NameSilo DnsType = "NameSilo"
|
||||
NameCheap DnsType = "NameCheap"
|
||||
|
@ -98,6 +100,9 @@ type DNSParam struct {
|
|||
Region string `json:"region"`
|
||||
ClientID string `json:"clientID"`
|
||||
Password string `json:"password"`
|
||||
AuthID string `json:"authID"`
|
||||
SubAuthID string `json:"subAuthID"`
|
||||
AuthPassword string `json:"authPassword"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -158,6 +163,15 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web
|
|||
clouddnsConfig.PollingInterval = pollingInterval
|
||||
clouddnsConfig.TTL = ttl
|
||||
p, err = clouddns.NewDNSProviderConfig(clouddnsConfig)
|
||||
case ClouDNS:
|
||||
cloudnsConfig := cloudns.NewDefaultConfig()
|
||||
cloudnsConfig.AuthID = param.AuthID
|
||||
cloudnsConfig.SubAuthID = param.SubAuthID
|
||||
cloudnsConfig.AuthPassword = param.AuthPassword
|
||||
cloudnsConfig.PropagationTimeout = propagationTimeout
|
||||
cloudnsConfig.PollingInterval = pollingInterval
|
||||
cloudnsConfig.TTL = ttl
|
||||
p, err = clouddns.NewDNSProviderConfig(cloudnsConfig)
|
||||
case FreeMyIP:
|
||||
freeMyIpConfig := freemyip.NewDefaultConfig()
|
||||
freeMyIpConfig.Token = param.Token
|
||||
|
|
|
@ -184,6 +184,10 @@ export const DNSTypes = [
|
|||
label: 'CloudDNS',
|
||||
value: 'CloudDns',
|
||||
},
|
||||
{
|
||||
label: 'ClouDNS',
|
||||
value: 'ClouDNS',
|
||||
},
|
||||
{
|
||||
label: 'NameSilo',
|
||||
value: 'NameSilo',
|
||||
|
|
|
@ -97,6 +97,17 @@
|
|||
<el-input v-model.trim="account.authorization['password']"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div v-if="account.type === 'ClouDNS'">
|
||||
<el-form-item label="Auth ID" prop="authorization.authID">
|
||||
<el-input v-model.trim="account.authorization['authID']"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Sub Auth ID" prop="authorization.subAuthID">
|
||||
<el-input v-model.trim="account.authorization['subAuthID']"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="Auth Password" prop="authorization.authPassword">
|
||||
<el-input v-model.trim="account.authorization['authPassword']"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item
|
||||
label="API Key"
|
||||
prop="authorization.apiKey"
|
||||
|
@ -137,7 +148,7 @@
|
|||
import { CreateDnsAccount, UpdateDnsAccount } from '@/api/modules/website';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import i18n from '@/lang';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { MsgSuccess, MsgError } from '@/utils/message';
|
||||
import { FormInstance } from 'element-plus';
|
||||
import { ref } from 'vue';
|
||||
import { DNSTypes } from '@/global/mimetype';
|
||||
|
@ -169,6 +180,7 @@ const rules = ref<any>({
|
|||
clientID: [Rules.requiredInput],
|
||||
email: [Rules.email],
|
||||
password: [Rules.requiredInput],
|
||||
authPassword: [Rules.requiredInput],
|
||||
},
|
||||
});
|
||||
const account = ref({
|
||||
|
@ -217,6 +229,12 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
if (account.value.type === 'ClouDNS') {
|
||||
if (!account.value.authorization.authID && !account.value.authorization.subAuthID) {
|
||||
MsgError('Please input Auth ID or Sub Auth ID');
|
||||
return;
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
|
||||
if (accountData.value.mode === 'edit') {
|
||||
|
|
Loading…
Add table
Reference in a new issue