Omit deprecated services from --list-web-services
This also makes the handling of deprecated services a bit more general.
This commit is contained in:
parent
efa487bfb3
commit
4d5a416725
2 changed files with 28 additions and 18 deletions
|
@ -29,6 +29,9 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
|
||||||
protocol. The old name is still accepted but is deprecated and will be
|
protocol. The old name is still accepted but is deprecated and will be
|
||||||
removed in a future version of ddclient.
|
removed in a future version of ddclient.
|
||||||
[#682](https://github.com/ddclient/ddclient/pull/682)
|
[#682](https://github.com/ddclient/ddclient/pull/682)
|
||||||
|
* Deprecated built-in web IP discovery services are not listed in the output
|
||||||
|
of `--list-web-services`.
|
||||||
|
[#682](https://github.com/ddclient/ddclient/pull/682)
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
||||||
|
|
43
ddclient.in
43
ddclient.in
|
@ -193,8 +193,14 @@ sub T_POSTS { 'postscript' }
|
||||||
our %builtinweb = (
|
our %builtinweb = (
|
||||||
'dyndns' => {'url' => 'http://checkip.dyndns.org/', 'skip' => 'Current IP Address:'},
|
'dyndns' => {'url' => 'http://checkip.dyndns.org/', 'skip' => 'Current IP Address:'},
|
||||||
'freedns' => {'url' => 'https://freedns.afraid.org/dynamic/check.php'},
|
'freedns' => {'url' => 'https://freedns.afraid.org/dynamic/check.php'},
|
||||||
'googledomains' => {'url' => 'https://domains.google.com/checkip'}, # Deprecated! See https://github.com/ddclient/ddclient/issues/622 for more details
|
'googledomains' => {
|
||||||
'he' => {'url' => 'https://checkip.dns.he.net/'},
|
url => 'https://domains.google.com/checkip',
|
||||||
|
deprecated => 'See https://github.com/ddclient/ddclient/issues/622 for more info.',
|
||||||
|
},
|
||||||
|
'he' => {
|
||||||
|
url => 'https://checkip.dns.he.net/',
|
||||||
|
deprecated => "Use 'he.net' instead.",
|
||||||
|
},
|
||||||
'he.net' => {'url' => 'https://checkip.dns.he.net/'},
|
'he.net' => {'url' => 'https://checkip.dns.he.net/'},
|
||||||
'ip4only.me' => {'url' => 'https://ip4only.me/api/'},
|
'ip4only.me' => {'url' => 'https://ip4only.me/api/'},
|
||||||
'ip6only.me' => {'url' => 'https://ip6only.me/api/'},
|
'ip6only.me' => {'url' => 'https://ip6only.me/api/'},
|
||||||
|
@ -1166,7 +1172,11 @@ $opt{'list-protocols'} = sub {
|
||||||
exit(0);
|
exit(0);
|
||||||
};
|
};
|
||||||
$opt{'list-web-services'} = sub {
|
$opt{'list-web-services'} = sub {
|
||||||
printf("%s %s\n", $_, $builtinweb{$_}{url}) for sort(keys(%builtinweb));
|
# This intentionally does not list deprecated services, although they are still accepted.
|
||||||
|
# Excluding deprecated services from the output discourages their selection by configuration
|
||||||
|
# wizards (e.g., Debian's debconf) that present this list to users.
|
||||||
|
printf("%s %s\n", $_, $builtinweb{$_}{url})
|
||||||
|
for sort(grep(!$builtinweb{$_}{deprecated}, keys(%builtinweb)));
|
||||||
exit(0);
|
exit(0);
|
||||||
};
|
};
|
||||||
$opt{'version'} = sub {
|
$opt{'version'} = sub {
|
||||||
|
@ -2912,11 +2922,10 @@ sub get_ip {
|
||||||
} elsif ($use eq 'web') {
|
} elsif ($use eq 'web') {
|
||||||
$url = opt('web', $h) // '';
|
$url = opt('web', $h) // '';
|
||||||
$skip = opt('web-skip', $h);
|
$skip = opt('web-skip', $h);
|
||||||
if (exists $builtinweb{$url}) {
|
if (my $biw = $builtinweb{$url}) {
|
||||||
warning("googledomains is deprecated! See https://github.com/ddclient/ddclient/issues/622 for more info.") if ($url eq 'googledomains');
|
warning("'--web=$url' is deprecated! $biw->{deprecated}") if $biw->{deprecated};
|
||||||
warning("'he' is deprecated; use 'he.net' instead.") if ($url eq 'he');
|
$skip //= $biw->{skip};
|
||||||
$skip //= $builtinweb{$url}->{'skip'};
|
$url = $biw->{url};
|
||||||
$url = $builtinweb{$url}->{'url'};
|
|
||||||
}
|
}
|
||||||
$arg = $url;
|
$arg = $url;
|
||||||
if ($url) {
|
if ($url) {
|
||||||
|
@ -3308,11 +3317,10 @@ sub get_ipv4 {
|
||||||
## Obtain IPv4 address by accessing website at url in "webv4=<url>"
|
## Obtain IPv4 address by accessing website at url in "webv4=<url>"
|
||||||
$url = $arg;
|
$url = $arg;
|
||||||
$skip = opt('webv4-skip', $h);
|
$skip = opt('webv4-skip', $h);
|
||||||
if (exists $builtinweb{$url}) {
|
if (my $biw = $builtinweb{$url}) {
|
||||||
warning("googledomains is deprecated! See https://github.com/ddclient/ddclient/issues/622 for more info.") if ($url eq 'googledomains');
|
warning("'--webv4=$url' is deprecated! $biw->{deprecated}") if $biw->{deprecated};
|
||||||
warning("'he' is deprecated; use 'he.net' instead.") if ($url eq 'he');
|
$skip //= $biw->{skip};
|
||||||
$skip //= $builtinweb{$url}->{'skip'};
|
$url = $biw->{url};
|
||||||
$url = $builtinweb{$url}->{'url'};
|
|
||||||
$arg = $url;
|
$arg = $url;
|
||||||
}
|
}
|
||||||
if ($url) {
|
if ($url) {
|
||||||
|
@ -3426,11 +3434,10 @@ sub get_ipv6 {
|
||||||
if (!defined(opt('webv6-skip', $h)) && defined(opt('web-skip', $h)));
|
if (!defined(opt('webv6-skip', $h)) && defined(opt('web-skip', $h)));
|
||||||
$url = $arg;
|
$url = $arg;
|
||||||
$skip = opt('webv6-skip', $h);
|
$skip = opt('webv6-skip', $h);
|
||||||
if (exists $builtinweb{$url}) {
|
if (my $biw = $builtinweb{$url}) {
|
||||||
warning("googledomains is deprecated! See https://github.com/ddclient/ddclient/issues/622 for more info.") if ($url eq 'googledomains');
|
warning("'--webv6=$url' is deprecated! $biw->{deprecated}") if $biw->{deprecated};
|
||||||
warning("'he' is deprecated; use 'he.net' instead.") if ($url eq 'he');
|
$skip //= $biw->{skip};
|
||||||
$skip //= $builtinweb{$url}->{'skip'};
|
$url = $biw->{url};
|
||||||
$url = $builtinweb{$url}->{'url'};
|
|
||||||
$arg = $url;
|
$arg = $url;
|
||||||
}
|
}
|
||||||
if ($url) {
|
if ($url) {
|
||||||
|
|
Loading…
Reference in a new issue