Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add DNS provider ClouDNS #8207

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions backend/utils/ssl/client.go
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions frontend/src/global/mimetype.ts
Original file line number Diff line number Diff line change
@@ -184,6 +184,10 @@ export const DNSTypes = [
label: 'CloudDNS',
value: 'CloudDns',
},
{
label: 'ClouDNS',
value: 'ClouDNS',
},
{
label: 'NameSilo',
value: 'NameSilo',
32 changes: 32 additions & 0 deletions frontend/src/views/website/ssl/dns-account/create/index.vue
Original file line number Diff line number Diff line change
@@ -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"
@@ -169,6 +180,27 @@ const rules = ref<any>({
clientID: [Rules.requiredInput],
email: [Rules.email],
password: [Rules.requiredInput],
authID: [{
validator: (rule: any, value: any, callback: any) => {
if (!value && !account.value.authorization.subAuthID) {
callback(new Error(i18n.global.t('commons.validate.requiredInput')));
} else {
callback();
}
},
trigger: ['blur', 'change']
}],
subAuthID: [{
validator: (rule: any, value: any, callback: any) => {
if (!value && !account.value.authorization.authID) {
callback(new Error(i18n.global.t('commons.validate.requiredInput')));
} else {
callback();
}
},
trigger: ['blur', 'change']
}],
authPassword: [Rules.requiredInput],
Comment on lines +183 to +203
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请使用 Rules.requiredInput

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请使用 Rules.requiredInput

authIDsubAuthID只要其中一个有值的情况下,有什么建议吗?
ClouDNS官网文档: https://www.cloudns.net/wiki/article/42/
image

Copy link
Member

@zhengkunwang223 zhengkunwang223 Mar 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样的话,建议提交的时候处理,submit 之前判断一下。不一定非得用表单检验。

},
});
const account = ref({