porkbun: Whitespace fixes
This commit is contained in:
parent
4b5b8ab62d
commit
3f740c3e19
1 changed files with 15 additions and 19 deletions
34
ddclient.in
34
ddclient.in
|
@ -6767,7 +6767,6 @@ EoEXAMPLE
|
||||||
######################################################################
|
######################################################################
|
||||||
sub nic_porkbun_update {
|
sub nic_porkbun_update {
|
||||||
debug("\nnic_porkbun_update -------------------");
|
debug("\nnic_porkbun_update -------------------");
|
||||||
|
|
||||||
for my $host (@_) {
|
for my $host (@_) {
|
||||||
my ($sub_domain, $domain);
|
my ($sub_domain, $domain);
|
||||||
if ($config{$host}{'root-domain'}) {
|
if ($config{$host}{'root-domain'}) {
|
||||||
|
@ -6790,29 +6789,26 @@ sub nic_porkbun_update {
|
||||||
($sub_domain, $domain) = split(/\./, $host, 2);
|
($sub_domain, $domain) = split(/\./, $host, 2);
|
||||||
}
|
}
|
||||||
info("subdomain %s, root domain %s", $sub_domain, $domain) if $sub_domain ne '';
|
info("subdomain %s, root domain %s", $sub_domain, $domain) if $sub_domain ne '';
|
||||||
|
|
||||||
for my $ipv ('ipv4', 'ipv6') {
|
for my $ipv ('ipv4', 'ipv6') {
|
||||||
my $ip = delete $config{$host}{"want$ipv"};
|
my $ip = delete $config{$host}{"want$ipv"};
|
||||||
if (!$ip) {
|
if (!$ip) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my $rrset_type = is_ipv6($ip) ? "AAAA" : "A";
|
my $rrset_type = is_ipv6($ip) ? "AAAA" : "A";
|
||||||
|
|
||||||
info("setting %s address to %s for %s", $ipv, $ip, $host);
|
info("setting %s address to %s for %s", $ipv, $ip, $host);
|
||||||
verbose("UPDATE:","updating %s", $host);
|
verbose("UPDATE:","updating %s", $host);
|
||||||
|
|
||||||
my $url = "https://porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain";
|
my $url = "https://porkbun.com/api/json/v3/dns/retrieveByNameType/$domain/$rrset_type/$sub_domain";
|
||||||
my $data = encode_json({
|
my $data = encode_json({
|
||||||
secretapikey => $config{$host}{'secretapikey'},
|
secretapikey => $config{$host}{'secretapikey'},
|
||||||
apikey => $config{$host}{'apikey'},
|
apikey => $config{$host}{'apikey'},
|
||||||
});
|
});
|
||||||
my $header = "Content-Type: application/json\n";
|
my $header = "Content-Type: application/json\n";
|
||||||
my $reply = geturl(
|
my $reply = geturl(
|
||||||
proxy => opt('proxy'),
|
proxy => opt('proxy'),
|
||||||
url => $url,
|
url => $url,
|
||||||
headers => $header,
|
headers => $header,
|
||||||
method => 'POST',
|
method => 'POST',
|
||||||
data => $data,
|
data => $data,
|
||||||
);
|
);
|
||||||
if (!defined($reply) || !$reply) {
|
if (!defined($reply) || !$reply) {
|
||||||
$config{$host}{"status-$ipv"} = "bad";
|
$config{$host}{"status-$ipv"} = "bad";
|
||||||
|
@ -6855,17 +6851,17 @@ sub nic_porkbun_update {
|
||||||
$url = "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain";
|
$url = "https://porkbun.com/api/json/v3/dns/editByNameType/$domain/$rrset_type/$sub_domain";
|
||||||
$data = encode_json({
|
$data = encode_json({
|
||||||
secretapikey => $config{$host}{'secretapikey'},
|
secretapikey => $config{$host}{'secretapikey'},
|
||||||
apikey => $config{$host}{'apikey'},
|
apikey => $config{$host}{'apikey'},
|
||||||
content => $ip,
|
content => $ip,
|
||||||
ttl => $ttl,
|
ttl => $ttl,
|
||||||
notes => $notes,
|
notes => $notes,
|
||||||
});
|
});
|
||||||
$reply = geturl(
|
$reply = geturl(
|
||||||
proxy => opt('proxy'),
|
proxy => opt('proxy'),
|
||||||
url => $url,
|
url => $url,
|
||||||
headers => $header,
|
headers => $header,
|
||||||
method => 'POST',
|
method => 'POST',
|
||||||
data => $data,
|
data => $data,
|
||||||
);
|
);
|
||||||
if (!defined($reply) || !$reply) {
|
if (!defined($reply) || !$reply) {
|
||||||
failed("updating %s: Could not connect to porkbun.com.", $host);
|
failed("updating %s: Could not connect to porkbun.com.", $host);
|
||||||
|
|
Loading…
Reference in a new issue