ddclient: update porkbun API endpoint.

This commit is contained in:
Joel Beckmeyer 2024-11-26 12:32:03 -05:00 committed by Đoàn Trần Công Danh
parent a6908ddca7
commit 7220d10a33
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,56 @@
diff --git a/ddclient.in b/ddclient.in
index 7a66c5e..d236555 100755
--- a/ddclient.in
+++ b/ddclient.in
@@ -868,6 +868,7 @@ my %services = (
'apikey' => setv(T_PASSWD, 1, 0, '', undef),
'secretapikey' => setv(T_PASSWD, 1, 0, '', undef),
'on-root-domain' => setv(T_BOOL, 0, 0, 0, undef),
+ 'server' => setv(T_FQDNP, 1, 0, 'api.porkbun.com', undef),
'login' => setv(T_LOGIN, 0, 0, 'unused', undef),
'password' => setv(T_PASSWD, 0, 0, 'unused', undef),
'use' => setv(T_USE, 0, 0, 'disabled', undef),
@@ -7082,6 +7083,7 @@ sub nic_porkbun_update {
debug("\nnic_porkbun_update -------------------");
foreach my $host (@_) {
+ my $server = $config{$host}{'server'};
foreach my $ipv ('ipv4', 'ipv6') {
my $ip = delete $config{$host}{"want$ipv"};
if (!$ip) {
@@ -7099,7 +7101,7 @@ sub nic_porkbun_update {
info("setting %s address to %s for %s", $ipv, $ip, $host);
verbose("UPDATE:","updating %s", $host);
- my $url = "https://porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain";
+ my $url = "https://$server/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain";
my $data = encode_json({
secretapikey => $config{$host}{'secretapikey'},
apikey => $config{$host}{'apikey'},
@@ -7115,7 +7117,7 @@ sub nic_porkbun_update {
# No response, declare as failed
if (!defined($reply) || !$reply) {
$config{$host}{"status-$ipv"} = "bad";
- failed("updating %s: Could not connect to porkbun.com.", $host);
+ failed("updating %s: Could not connect to $server.", $host);
next;
}
if (!header_ok($host, $reply)) {
@@ -7153,7 +7155,7 @@ sub nic_porkbun_update {
my $notes = $records->[0]->{'notes'};
debug("ttl = %s", $ttl);
debug("notes = %s", $notes);
- $url = "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain";
+ $url = "https://$server/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain";
$data = encode_json({
secretapikey => $config{$host}{'secretapikey'},
apikey => $config{$host}{'apikey'},
@@ -7170,7 +7172,7 @@ sub nic_porkbun_update {
);
# No response, declare as failed
if (!defined($reply) || !$reply) {
- failed("updating %s: Could not connect to porkbun.com.", $host);
+ failed("updating %s: Could not connect to $server.", $host);
next;
}
if (!header_ok($host, $reply)) {

View File

@ -1,7 +1,7 @@
# Template file for 'ddclient'
pkgname=ddclient
version=3.11.2
revision=1
revision=2
build_style=gnu-configure
configure_args="--sysconfdir=/etc/ddclient"
hostmakedepends="automake curl"