From d9365359bdc1f6044c9bd1adb2171d1ee9a63dc0 Mon Sep 17 00:00:00 2001 From: Cristian Aldea Date: Fri, 11 Oct 2024 14:54:30 -0700 Subject: [PATCH 1/2] update porkbun api endpoint domain --- ddclient.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ddclient.in b/ddclient.in index ba4b463..523d1f9 100755 --- a/ddclient.in +++ b/ddclient.in @@ -6823,7 +6823,7 @@ sub nic_porkbun_update { info("setting IPv$ipv address to $ip"); my $reply = geturl( proxy => opt('proxy'), - url => "https://porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain", + url => "https://api.porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain", headers => ['Content-Type: application/json'], method => 'POST', data => encode_json({ @@ -6861,7 +6861,7 @@ sub nic_porkbun_update { debug("notes = %s", $notes); $reply = geturl( proxy => opt('proxy'), - url => "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain", + url => "https://api.porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain", headers => ['Content-Type: application/json'], method => 'POST', data => encode_json({ From eb48bb55aeca171d2764a6aa2f5e30ac998762ba Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Mon, 14 Oct 2024 08:32:12 -0400 Subject: [PATCH 2/2] make porkbun endpoint configurable --- ddclient.in | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ddclient.in b/ddclient.in index 523d1f9..0beb3f8 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1201,10 +1201,11 @@ our %protocols = ( %{$cfgvars{'protocol-common-defaults'}}, 'login' => undef, 'password' => undef, - 'apikey' => setv(T_PASSWD, 1, undef, undef), - 'secretapikey' => setv(T_PASSWD, 1, undef, undef), - 'root-domain' => setv(T_FQDN, 0, undef, undef), - 'on-root-domain' => setv(T_BOOL, 0, 0, undef), + 'apikey' => setv(T_PASSWD, 1, undef, undef), + 'secretapikey' => setv(T_PASSWD, 1, undef, undef), + 'root-domain' => setv(T_FQDN, 0, undef, undef), + 'on-root-domain' => setv(T_BOOL, 0, 0, undef), + 'server' => setv(T_FQDNP, 0, 'api.porkbun.com', undef), }, ), 'sitelutions' => ddclient::LegacyProtocol->new( @@ -6742,6 +6743,7 @@ Available configuration variables: an unnamed record (Zone APEX) in a zone. It is useful to specify it as a local variable as shown in the example. This configuration value is deprecated, use root-domain instead! + * server: API endpoint to use, defaults to api.porkbun.com * usev4, usev6 : These configuration variables can be specified as local variables to override the global settings. It is useful to finely control IPv4 or IPv6 as shown in the example. * use (deprecated) : This parameter is deprecated but can be overridden like the above parameters. @@ -6799,6 +6801,7 @@ EoEXAMPLE sub nic_porkbun_update { my $self = shift; for my $h (@_) { + my $server = opt('server', $h); local $_l = pushlogctx($h); my ($sub_domain, $domain); if (opt('root-domain', $h)) { @@ -6823,7 +6826,7 @@ sub nic_porkbun_update { info("setting IPv$ipv address to $ip"); my $reply = geturl( proxy => opt('proxy'), - url => "https://api.porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain", + url => "https://$server/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain", headers => ['Content-Type: application/json'], method => 'POST', data => encode_json({ @@ -6861,7 +6864,7 @@ sub nic_porkbun_update { debug("notes = %s", $notes); $reply = geturl( proxy => opt('proxy'), - url => "https://api.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", headers => ['Content-Type: application/json'], method => 'POST', data => encode_json({