* Sat May 10 2025 Brian Read <brianr@koozali.org> 11.0.0-2.sme

- correct $config (remove $) and get protocols, services and devices by interrogating ddclient [SME: 13001]
This commit is contained in:
Brian Read 2025-05-10 17:03:29 +01:00
parent 6dc6143642
commit 6b207dec6b
3 changed files with 55 additions and 7 deletions

View File

@ -322,9 +322,9 @@ sub do_display {
domains => \@domains,
freedomains => \@FreeDomains,
methodlabels => $Labels,
dnslabels => get_dns_labels($c),
devices => get_devices_names($c),
webservices => get_web_services_names($c),
dnslabels => ddclient_protocol_options($c),
devices => ddclient_device_options($c),
webservices => ddclient_web_services_options($c),
emptydom => $emptydom,
emptycust => $emptycust
);
@ -1012,4 +1012,49 @@ sub performDeleteCustom {
return "ok";
}
1;
#Routines to extract protocols, services and devices from ddclient and present them for select options
sub ddclient_web_services_options {
my $output = qx(ddclient -list-web-services 2>/dev/null);
my @options;
for my $line (split /\n/, $output) {
next unless $line =~ /^(\S+)\s+(\S+)/;
my ($service, $url) = ($1, $2);
# You can use the service name as both label and value, or include the URL in the label for clarity
push @options, [ "$service ($url)", $service ];
}
return \@options;
}
sub ddclient_protocol_options {
my $output = qx(ddclient -list-protocols 2>/dev/null);
my @options;
for my $line (split /\n/, $output) {
$line =~ s/^\s+|\s+$//g; # Trim whitespace
next unless $line; # Skip empty lines
push @options, [ $line, $line ]; # [label, value]
}
return \@options;
}
sub ddclient_device_options {
my $output = qx(ddclient -list-devices 2>/dev/null);
my @options;
for my $line (split /\n/, $output) {
$line =~ s/^\s+|\s+$//g; # Trim whitespace
next unless $line; # Skip empty lines
my ($id, $name) = split(/\s+/, $line, 2);
next unless $id && $name;
push @options, [ $name, $id ]; # [label, value]
}
return \@options;
}
1;

View File

@ -3,7 +3,7 @@
% content_for 'module' => begin
<div id="module" class="module ddclient-panel">
% if ($config->{debug} == 1) {
% if (config->{debug} == 1) {
<p>
%= dumper $c->current_route
</p>
@ -45,4 +45,4 @@
%}
</div>
%end
%end

View File

@ -4,7 +4,7 @@
%define name smeserver-ddclient
%define version 11.0.0
%define release 1
%define release 2
Summary: ddclient panel for SME Server
Name: %{name}
@ -25,6 +25,9 @@ Requires: smeserver-formmagick
AutoReqProv: no
%changelog
* Sat May 10 2025 Brian Read <brianr@koozali.org> 11.0.0-2.sme
- correct $config (remove $) and get protocols, services and devices by interrogating ddclient [SME: 13001]
* Sat May 03 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme
- Take out restart for createlinks for bootstrap-console-save [SME: 12998]
- and update version