From 7220d10a335e605e24ceb3abe0c734a5034dcbbb Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Tue, 26 Nov 2024 12:32:03 -0500 Subject: [PATCH] ddclient: update porkbun API endpoint. --- srcpkgs/ddclient/patches/porkbun.patch | 56 ++++++++++++++++++++++++++ srcpkgs/ddclient/template | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/ddclient/patches/porkbun.patch diff --git a/srcpkgs/ddclient/patches/porkbun.patch b/srcpkgs/ddclient/patches/porkbun.patch new file mode 100644 index 00000000000..39268fda186 --- /dev/null +++ b/srcpkgs/ddclient/patches/porkbun.patch @@ -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)) { diff --git a/srcpkgs/ddclient/template b/srcpkgs/ddclient/template index ad0fadbcef6..833b7a9bc66 100644 --- a/srcpkgs/ddclient/template +++ b/srcpkgs/ddclient/template @@ -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"