diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm index 30fab82..6ddc84f 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm @@ -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; \ No newline at end of file diff --git a/root/usr/share/smanager/themes/default/templates/ddclient.html.ep b/root/usr/share/smanager/themes/default/templates/ddclient.html.ep index 1f57805..f09c67b 100644 --- a/root/usr/share/smanager/themes/default/templates/ddclient.html.ep +++ b/root/usr/share/smanager/themes/default/templates/ddclient.html.ep @@ -3,7 +3,7 @@ % content_for 'module' => begin
- % if ($config->{debug} == 1) { + % if (config->{debug} == 1) {

%= dumper $c->current_route

@@ -45,4 +45,4 @@ %}
-%end +%end \ No newline at end of file diff --git a/smeserver-ddclient.spec b/smeserver-ddclient.spec index d7ab820..8228f12 100644 --- a/smeserver-ddclient.spec +++ b/smeserver-ddclient.spec @@ -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 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 11.0.0-1.sme - Take out restart for createlinks for bootstrap-console-save [SME: 12998] - and update version