diff -urN smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-11-10 16:11:05.915271983 +0000 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-12-01 17:16:00.000000000 +0000 @@ -114,57 +114,168 @@ my %ddc_datas = (); +sub get_devices_names { + # + # Router devices from which it can get ip address + # + my $devices = ( [ + [ '2wire' => '2Wire 1701HG Gateway' ], + [ '3com-3c886a' => '3com 3c886a 56k Lan Modem' ], + [ '3com-oc-remote812' => '3com OfficeConnect Remote 812' ], + [ 'alcatel-510' => 'Alcatel Speed Touch 510' ], + [ 'alcatel-530' => 'Alcatel/Thomson SpeedTouch 530' ], + [ 'alcatel-stp' => 'Alcatel Speed Touch Pro' ], + [ 'allnet-1298' => 'Allnet 1298' ], + [ 'cayman-3220h' => 'Cayman 3220-H DSL' ], + [ 'dlink-524' => 'D-Link DI-524' ], + [ 'dlink-604' => 'D-Link DI-604' ], + [ 'dlink-614' => 'D-Link DI-614+' ], + [ 'e-tech' => 'E-tech Router' ], + [ 'elsa-lancom-dsl10' => 'ELSA LanCom DSL/10 DSL FW' ], + [ 'elsa-lancom-dsl10-ch01' => 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' ], + [ 'elsa-lancom-dsl10-ch02' => 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' ], + [ 'linksys' => 'Linksys FW' ], + [ 'linksys-rv042-wan1' => 'Linksys RV042 Dual Homed Router WAN Port 2' ], + [ 'linksys-rv042-wan2' => 'Linksys RV042 Dual Homed Router WAN Port 2' ], + [ 'linksys-ver2' => 'Linksys FW version 2' ], + [ 'linksys-ver3' => 'Linksys FW version 3' ], + [ 'linksys-wcg200' => 'Linksys WCG200 FW' ], + [ 'linksys-wrt854g' => 'Linksys WRT854G FW' ], + [ 'maxgate-ugate3x00' => 'MaxGate UGATE-3x00 FW' ], + [ 'netcomm-nb3' => 'NetComm NB3' ], + [ 'netgear-dg834g' => 'netgear-dg834g' ], + [ 'netgear-rp614' => 'Netgear RP614 FW' ], + [ 'netgear-rt3xx' => 'Netgear FW' ], + [ 'netgear-wgt624' => 'Netgear WGT624' ], + [ 'netgear-wpn824' => 'Netgear WPN824 FW' ], + [ 'netopia-r910' => 'Netopia R910 FW' ], + [ 'olitec-SX200' => 'olitec-SX200' ], + [ 'rtp300' => 'Linksys RTP300' ], + [ 'siemens-ss4200' => 'Siemens SpeedStream 4200' ], + [ 'sitecom-dc202' => 'Sitecom DC-202 FW' ], + [ 'smc-barricade' => 'SMC Barricade FW' ], + [ 'smc-barricade-7004vbr' => 'SMC Barricade FW (7004VBR model config)' ], + [ 'smc-barricade-7401bra' => 'SMC Barricade 7401BRA FW' ], + [ 'smc-barricade-alt' => 'SMC Barricade FW (alternate config)' ], + [ 'sohoware-nbg800' => 'SOHOWare BroadGuard NBG800' ], + [ 'sveasoft' => 'Sveasoft WRT54G/WRT54GS' ], + [ 'thomson-st536v6' => 'Thomson SpeedTouch 536v6' ], + [ 'thomson-tg782' => 'Thomson/Technicolor TG782' ], + [ 'vigor-2200usb' => 'Vigor 2200 USB' ], + [ 'watchguard-edge-x' => 'Watchguard Edge X FW' ], + [ 'watchguard-soho' => 'Watchguard SOHO FW' ], + [ 'westell-6100' => 'Westell C90-610015-06 DSL Router' ], + [ 'xsense-aero' => 'Xsense Aero'] + ] ); + return $devices; + + + # Automatic loading of the devices from the ddclient program - I can't get this to pass the results successfully to the template + #my $output = `ddclient -list-devices`; # Run ddclient command to get devices output + #my @lines; + #foreach my $line (split /\n/, $output) { + #$line =~ s/\s+//; # Remove leading whitespace + #my ($field1, $field2) = split(' ', $line, 2); + #push @lines, [$field2, $field1]; + #} + #return \@lines; # Return a reference to the lines array +} + +sub get_web_services_names { + # + # Web Services from which it can get ip address + # + my $webservices = ( [ + [ 'dyndnshttp://checkip.dyndns.org/' => 'dyndns' ], + [ 'freednshttps://freedns.afraid.org/dynamic/check.php' => 'freedns' ], + [ 'googledomainshttps://domains.google.com/checkip' => 'googledomains' ], + [ 'hehttps://checkip.dns.he.net/' => 'he' ], + [ 'ip4only.mehttps://ip4only.me/api/' => 'ip4only.me' ], + [ 'ip6only.mehttps://ip6only.me/api/' => 'ip6only.me' ], + [ 'ipify-ipv4https://api.ipify.org/' => 'ipify-ipv4' ], + [ 'ipify-ipv6https://api6.ipify.org/' => 'ipify-ipv6' ], + [ 'loopiahttps://dns.loopia.se/checkip/checkip.php' => 'loopia' ], + [ 'myonlineportalhttps://myonlineportal.net/checkip' => 'myonlineportal' ], + [ 'noip-ipv4http://ip1.dynupdate.no-ip.com/' => 'noip-ipv4' ], + [ 'noip-ipv6http://ip1.dynupdate6.no-ip.com/' => 'noip-ipv6' ], + [ 'nsupdate.info-ipv4https://ipv4.nsupdate.info/myip' => 'nsupdate.info-ipv4' ], + [ 'nsupdate.info-ipv6https://ipv6.nsupdate.info/myip' => 'nsupdate.info-ipv6' ], + [ 'zoneedithttps://dynamic.zoneedit.com/checkip.html' => 'zoneedit' ] + ] ); + return $webservices + + #my $output = `ddclient -list-web-services`; # Run ddclient command to get web services output + #my @lines; + #foreach my $line (split /\n/, $output) { + #$line =~ s/\s+//; # Remove leading whitespace + #my ($field1, $field2) = split(' ', $line, 2); + #push @lines, [$field2, $field1]; + #} + #return \@lines; # Return a reference to the lines array +} + sub get_dns_labels { # # dns service names + # Return array with translated results as well. + # + # Note that "new" ones willl not have any description / translation, this can be added to /usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient # my $c = shift; - my $Labels = ( + my $dnsservices = ( [ + [ $c->l('1984') => '1984' ], + [ $c->l('changeip') => 'changeip' ], + [ $c->l('cloudflare') => 'cloudflare' ], + [ $c->l('cloudns') => 'cloudns' ], + [ $c->l('digitalocean') => 'digitalocean' ], + [ $c->l('dinahosting') => 'dinahosting' ], + [ $c->l('dnsexit') => 'dnsexit' ], + [ $c->l('dnsmadeeasy') => 'dnsmadeeasy' ], + [ $c->l('domeneshop') => 'domeneshop' ], + [ $c->l('dondominio') => 'dondominio' ], + [ $c->l('dslreports') => 'dslreports' ], + [ $c->l('duckdns') => 'duckdns' ], + [ $c->l('dyndns1') => 'dyndns1' ], + [ $c->l('dyndns2') => 'dyndns2' ], + [ $c->l('easydns') => 'easydns' ], + [ $c->l('enom') => 'enom' ], + [ $c->l('freedns') => 'freedns' ], + [ $c->l('freemyip') => 'freemyip' ], + [ $c->l('gandi') => 'gandi' ], + [ $c->l('godaddy') => 'godaddy' ], + [ $c->l('googledomains') => 'googledomains' ], + [ $c->l('hetzner') => 'hetzner' ], + [ $c->l('infomaniak') => 'infomaniak' ], + [ $c->l('keysystems') => 'keysystems' ], + [ $c->l('mythicdyn') => 'mythicdyn' ], + [ $c->l('namecheap') => 'namecheap' ], + [ $c->l('nfsn') => 'nfsn' ], + [ $c->l('njalla') => 'njalla' ], + [ $c->l('noip') => 'noip' ], + [ $c->l('nsupdate') => 'nsupdate' ], + [ $c->l('ovh') => 'ovh' ], + [ $c->l('porkbun') => 'porkbun' ], + [ $c->l('regfishde') => 'regfishde' ], + [ $c->l('sitelutions') => 'sitelutions' ], + [ $c->l('woima') => 'woima' ], + [ $c->l('yandex') => 'yandex' ], + [ $c->l('zoneedit') => 'zoneedit' ] + ] ); + return $dnsservices; - # v3.11.1 labels - [ - [$c->l('1984') '1984'], - [$c->l('changeip') 'changeip'], - [$c->l('cloudflare') 'cloudflare'], - [$c->l('cloudns') 'cloudns'],, - [$c->l('digitalocean') 'digitalocean'], - [$c->l('dinahosting') 'dinahosting'], - [$c->l('dnsexit2') 'dnsexit2'], - [$c->l('dnsmadeeasy') 'dnsmadeeasy'], - [$c->l('domeneshop') 'domeneshop'], - [$c->l('dondominio') 'dondominio'], - [$c->l('dslreports1') 'dslreports1'], - [$c->l('duckdns') 'duckdns'], - [$c->l('dyndns1') 'dyndns1'], - [$c->l('dyndns2') 'dyndns2'], - [$c->l('easydns') 'easydns'], - [$c->l('enom') 'enom'], - [$c->l('freedns') 'freedns'], - [$c->l('freemyip') 'freemyip'], - [$c->l('gandi') 'gandi'], - [$c->l('godaddy') 'godaddy'], - [$c->l('googledomains') 'googledomains'], - [$c->l('hetzner') 'hetzner'], - [$c->l('infomaniak') 'infomaniak'], - [$c->l('keysystems') 'keysystems'], - [$c->l('mythicdyn') 'mythicdyn'], - [$c->l('namecheap') 'namecheap'], - [$c->l('nfsn') 'nfsn'], - [$c->l('njalla') 'njalla'], - [$c->l('noip') 'noip'], - [$c->l('nsupdate') 'nsupdate'], - [$c->l('ovh') 'ovh'], - [$c->l('porkbun') 'porkbun'], - [$c->l('regfishde') 'regfishde'], - [$c->l('sitelutions') 'sitelutions'], - [$c->l('woima') 'woima'], - [$c->l('yandex') 'yandex'], - [$c->l('zoneedit1') 'zoneedit1'] - ] - # end of v3.11.1 labels - - - #[ [ $c->l('CUSTOMDNS'), 'CUSTOMDNS' ], + #my $output = `ddclient -list-protocols`; # Run ddclient command and capture the output + #my @protocols; + #foreach my $line (split /\n/, $output) { + #my ($protocol) = $line =~ /\s*(\S+)/; + #next unless $protocol; # Skip if protocol is empty or contains only whitespace + #my $custom_value = "$protocol.$c->l($protocol)"; # Additional column value using $c->l(protocol) + #push @protocols, [$custom_value, $protocol]; + #} + #return \@protocols; # Return a reference to the protocols array +} + +# Pre 3.11.1 dns services + #[ [ $c->l('CUSTOMDNS'), 'CUSTOMDNS' ], #[ $c->l('DYNDNS1'), 'DYNDNS1' ], #[ $c->l('DYNDNS2'), 'DYNDNS2' ], #[ $c->l('DYNDNS3'), 'DYNDNS3' ], @@ -196,9 +307,6 @@ #[ $c->l('OVH'), 'OVH' ], #[ $c->l('CLOUDNS'), 'CLOUDNS' ] #] - ); - return $Labels; -} sub main { # @@ -230,13 +338,15 @@ my $emptycust = ( scalar @FreeDomains == 0 ); my $Labels = ( - [ [ $c->l('SME external Interface'), "smeIF" ], - [ $c->l('SME configuration DB'), "smeCMD" ], - [ $c->l('web'), "web" ], - [ $c->l('Interface'), "if" ], - [ $c->l('IP'), "ip" ], - [ $c->l('Command'), "cmd" ] - ] + [ + [ $c->l('SME external Interface') => "smeIF" ], + [ $c->l('SME configuration DB') => 'smeCMD' ], + [ $c->l('web') => 'web' ], + [ $c->l('router') => 'router' ], + [ $c->l('Interface') => 'if' ], + [ $c->l('IP') => 'ip' ], + [ $c->l('Command') => 'cmd' ] + ] ); $c->stash( @@ -246,6 +356,9 @@ domains => \@domains, freedomains => \@FreeDomains, methodlabels => $Labels, + dnslabels => get_dns_labels($c), + devices => get_devices_names($c), + webservices => get_web_services_names($c), emptydom => $emptydom, emptycust => $emptycust ); @@ -260,6 +373,7 @@ # Called to update the parameters relating to the Ip address of the server # my $c = shift; + $ddc_datas{"first"} = ''; $ddc_datas{"success"} = pushParams($c); do_display($c); } @@ -269,6 +383,7 @@ #Called to update/delete the ddclient for a specific inbuilt domain # my $c = shift; + my $title = $c->l("MODIFY_TITLE"); my $retmsg; if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field $retmsg = performModifyCustom($c); @@ -276,10 +391,11 @@ else { $retmsg = performModifyDomain($c); } + $ddc_datas{"first"} = ''; if ( $retmsg eq "ok" ) { my $dns = $c->param('dns'); my $domain = $c->param('domainname'); - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain, + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_MODIFIED", $domain, $c->l( '' . $dns ) ); do_display( $c, %ddc_datas ); } @@ -296,7 +412,7 @@ # Create custom domain # my $c = shift; - my $title = $c->l("ddc_CREATE_TITLE"); + my $title = $c->l("CREATE_TITLE"); my $modul = ''; my $trt = "NEW"; @@ -305,18 +421,21 @@ title => $title, modul => $modul, ddc_datas => \%ddc_datas, - dnslabels => get_dns_labels($c) + dnslabels => get_dns_labels($c), + devices => get_devices_names($c), + webservices => get_web_services_names($c) ); $c->render( template => 'ddclient' ); } sub do_create_custom_actual { my $c = shift; + $ddc_datas{"first"} = ''; my $retmsg = performCreateCustom($c); if ( $retmsg eq "ok" ) { my $dns = $c->param('dns'); my $domain = $c->param('domainname'); - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain, $c->l( '' . $dns ) ); do_display( $c, %ddc_datas ); } @@ -334,7 +453,7 @@ # Display delete or modify panel for custom domain # my $c = shift; - my $title = $c->l("ddc_MODIFY_TITLE"); + my $title = $c->l("MODIFY_TITLE"); my $modul = ''; my $trt = $c->param("trt"); @@ -349,7 +468,9 @@ title => $title, modul => $modul, ddc_datas => \%ddc_datas, - dnslabels => get_dns_labels($c) + dnslabels => get_dns_labels($c), + devices => get_devices_names($c), + webservices => get_web_services_names($c) ); $c->render( template => 'ddclient' ); } @@ -360,21 +481,23 @@ # param trt = MOD or DEL # my $c = shift; - my $title = $c->l("ddc_MODIFY_TITLE"); + my $title = $c->l("MODIFY_TITLE"); my $modul = ''; my $trt = $c->param("trt"); #Extract domain stuff from DB my @results = get_domain_table( $c, $c->param("Domain") ); #Returns just one row - $ddc_datas{"Domain_details"} = $results[0]; + $ddc_datas{"Domain_details"} = $results[0]; $ddc_datas{'trt'} = $trt; $c->stash( title => $title, modul => $modul, ddc_datas => \%ddc_datas, - dnslabels => get_dns_labels($c) + dnslabels => get_dns_labels($c), + devices => get_devices_names($c), + webservices => get_web_services_names($c) ); $c->render( template => 'ddclient' ); } @@ -386,10 +509,11 @@ # my $c = shift; my $route = $c->current_route; - my $title = $c->l("ddc_REMOVE_TITLE"); + my $title = $c->l("REMOVE_TITLE"); my $modul = ''; my $retmsg = ""; my $domain = $c->param("Domain"); + $ddc_datas{"first"} = ''; #Delete it and return to front summary panel - depends on route domain or custom if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field @@ -400,7 +524,7 @@ } if ( $retmsg eq "ok" ) { - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain, $c->l( '' . $c->param("dns") ) ); } else { $ddc_datas{"error"} = $retmsg; } @@ -415,15 +539,16 @@ # my $c = shift; my $route = $c->current_route; - my $title = $c->l("ddc_REMOVE_TITLE"); + my $title = $c->l("REMOVE_TITLE"); my $modul = ''; my $retmsg = ""; my $domain = $c->param("Domain"); + $ddc_datas{"first"} = ''; #Delete it and return to front summary panel - depends on route domain or custom $retmsg = performDeleteCustom( $c, $domain ); if ( $retmsg eq "ok" ) { - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain ); + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain ); } else { $ddc_datas{"error"} = $retmsg; } do_display( $c, %ddc_datas ); @@ -588,6 +713,8 @@ my $retrieveinterface = $c->param('retrieveinterface'); my $retrievecmd = $c->param('retrievecmd'); my $retrieveip = $c->param('retrieveip'); + + #print 1 / 0; #Crash my $ddclient = $db->get('ddclient'); $ddclient->set_prop( 'urlcheckip' => $urlcheckip ); @@ -616,7 +743,7 @@ #------------------------------------------------------------ my $domainName = $c->param('domainName'); - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) { $domainName = $1; } else { @@ -624,7 +751,7 @@ } my $domainLogin = $c->param('login'); - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) { $domainLogin = $1; } else { @@ -632,7 +759,7 @@ } my $domainPassword = $c->param('password'); - if ( $domainPassword =~ /^(.*)$/ ) { + if ( $domainPassword =~ /(.*)$/ ) { $domainPassword = $1; } else { @@ -646,7 +773,7 @@ my $dns = $c->param('dns'); if ( $dns eq 'CUSTOMDNS' ) { - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) { $customDNS = $1; } else @@ -685,7 +812,7 @@ # Attempt to delete domain #------------------------------------------------------------ - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) { $domain = $1; } else { @@ -726,7 +853,7 @@ #------------------------------------------------------------ my $domainName = $c->param('domainName'); - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) { $domainName = $1; } else { @@ -749,7 +876,7 @@ my $domainDesc = $c->param('desc'); my $domainLogin = $c->param('login'); - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) { $domainLogin = $1; } else { @@ -757,7 +884,7 @@ } my $domainPassword = $c->param('password'); - if ( $domainPassword =~ /^(.*)$/ ) { + if ( $domainPassword =~ /(.*)$/ ) { $domainPassword = $1; } else { @@ -771,7 +898,7 @@ my $dns = $c->param('dns'); if ( $dns eq 'CUSTOMDNS' ) { - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) { $customDNS = $1; } else { @@ -809,7 +936,7 @@ #------------------------------------------------------------ my $domainName = $c->param('domainName'); - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) { $domainName = $1; } else { @@ -817,7 +944,7 @@ } my $domainLogin = $c->param('login'); - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) { + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) { $domainLogin = $1; } else { @@ -825,7 +952,7 @@ } my $domainPassword = $c->param('password'); - if ( $domainPassword =~ /^(.*)$/ ) { + if ( $domainPassword =~ /(.*)$/ ) { $domainPassword = $1; } else { @@ -839,7 +966,7 @@ my $dns = $c->param('dns'); if ( $dns eq 'CUSTOMDNS' ) { - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) { $customDNS = $1; } else @@ -878,7 +1005,7 @@ # Attempt to delete domain #------------------------------------------------------------ - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) { + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) { $domain = $1; } else { diff -urN smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2023-11-10 16:11:05.916271986 +0000 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2023-12-01 16:35:00.000000000 +0000 @@ -80,7 +80,7 @@ 'CLOUDNS'=>'CLOUDNS www.cloudns.net', # End of Service descriptions -# v3.11.1 Service descriptions: +# v3.11.x Service descriptions: "1984" => "https://kb.1984hosting.com/doku.php?id=freedns", "changeip" => "https://changeip.com", "cloudflare" => "https://cloudflare.com", @@ -118,7 +118,7 @@ "woima" => "http://woima.com", "yandex" => "https://yandex.com", "zoneedit" => "https://www.zoneedit.com/dynamic-dns/", -# end of v3.11.1 Service descriptions: +# end of v3.11.x Service descriptions: 'CUSTOMDNS' => 'Custom Dynamic DNS Provider', 'CUSTOMDNS_LABEL' => 'Custom server Address', @@ -136,8 +136,8 @@ 'DESCRIPTION_LABEL' => 'Domain description', 'SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.', 'RETRIEVE_METHOD' => 'Method to retrieve new IP:', -'RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method', -'RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method', +'RETRIEVE_IF' => 'Local interface to get new IP', +'RETRIEVE_CMD' => 'Command to execute to get IP', 'SME external Interface' => 'SME external interface', 'SME configuration DB' => 'SME configuration DB', 'web' => 'Web query', diff -urN smeserver-ddclient-1.3.0.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep 2020-06-28 09:57:52.000000000 +0100 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep 2023-11-15 16:10:00.000000000 +0000 @@ -1,6 +1,6 @@

- %= l 'ddc_CUSTOM_DESCRIPTION' + %= l 'CUSTOM_DESCRIPTION'


% my $btn = l('ddc_APPLY'); %= form_for '/ddclient7' => (method => 'POST') => begin diff -urN smeserver-ddclient-1.3.0.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep 2023-11-10 16:11:05.901271943 +0000 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_modify_domain.html.ep 2023-11-18 14:56:00.000000000 +0000 @@ -1,4 +1,9 @@
+

%= l 'CUSTOM_DESCRIPTION'


@@ -24,20 +29,41 @@ %=l 'SERVERS_LABEL' % param dns=>$ddc_datas->{"Domain_details"}->{"dns"}; - %=select_field dns=>$dnslabels + %=select_field dns=>$dnslabels,id=>"dns",onchange=>"SelectInput()",onload=>"SelectInput()" + %= javascript begin + function SelectInput() { + var method = document.querySelector("#dns"); + const types=['custom']; + types.forEach((type)=>{ + var service = document.querySelector(`.${type}`); + if (service != null) { + if (method.value == type) { + service.style.display = 'block'; + } else { + service.style.display = 'none'; + } + } + }) + } + %end
- + + %# Dependant on the custom choice from above +
+ %=l 'CUSTOMDNS_LABEL' - + % param customdns=>$ddc_datas->{"Domain_details"}->{"customdns"}; %=text_field 'customdns'
- + %=l 'CUSTOM_PROTOCOL_LABEL' - + % param customprotocol=>$ddc_datas->{"Domain_details"}->{"customprotocol"}; %=text_field 'customprotocol'
+
+ %=l 'NAME_LABEL' diff -urN smeserver-ddclient-1.3.0.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep 2023-11-10 16:11:05.902271946 +0000 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep 2023-12-01 17:12:00.000000000 +0000 @@ -1,4 +1,9 @@
+

%= l 'Params_for_IP_Retrieval'

@@ -7,11 +12,11 @@ %=l 'RETRIEVE_SSL' - % param retrievessl=>$ddc_datas->{"params"}->{"ssl"}; + % param retrievessl=>$ddc_datas->{"params"}->{"ssl"} unless param 'retrievessl'; %=select_field retrievessl=>[['Yes'=>'yes'],['No'=>'no']]
- %=l 'RETRIEVE_DEAMONUPDATE' + %=l 'RETRIEVE_DEAMONUPDATE' % param retrievedeamonupdate=>$ddc_datas->{"params"}->{"DeamonUpdate"}; %=number_field 'retrievedeamonupdate',min=>0 @@ -19,33 +24,88 @@ %=l 'RETRIEVE_METHOD' - % param retrievemethod=>$ddc_datas->{"params"}->{"method"}; - %=select_field retrievemethod=>$methodlabels -
- + % param retrievemethod=>$ddc_datas->{"params"}->{"method"} unless param 'retrievemethod'; + %=select_field retrievemethod=>$methodlabels,id=>"retrievemethod",onchange=>"SelectInput()" + %= javascript begin + function SelectInput() { + var method = document.querySelector("#retrievemethod"); + const types=['smeIF','smeCMD','web','router','if','ip','cmd','custom']; + types.forEach((type)=>{ + var service = document.querySelector(`.${type}`); + if (service != null) { + if (method.value == type) { + service.style.display = 'block'; + } else { + service.style.display = 'none'; + } + } + }) + } + % end +
+ %# + %# From here the one that is shown depends on the choice above + %# +
+
+ %# Only if "router" is chosen +
+ + %=l 'Router type' + + % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieveinterface'; + %=select_field retrieveinterface=>$devices +
+
+ + %# Only if "web" is chosen" +
+ + %=l 'Web service' + + % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrieveurlcheckip'; + %=select_field retrieveurlcheckip=>$dnslabels +
+ + %# Only if "Interface" is chosen +
+ %=l 'RETRIEVE_IF' - - % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"}; + + % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieveinterface'; %=text_field 'retrieveinterface'
- +
+ + %# Only if "cmd" is chosen +
+ %=l 'RETRIEVE_CMD' - - % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"}; + + % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"} unless param 'retrievecmd'; %=text_field 'retrievecmd'
- +
+ + %# Only if "ip" is chosen +
+ %=l 'RETRIEVE_IP' - - % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"}; + + % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"} unless param 'retrieveip'; %=text_field 'retrieveip'
- +
+ + %# Only if "custom web service" +
+ %=l 'RETRIEVE_URLCHECKIP' - - % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"}; + + % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrieveurlcheckip'; %=text_field 'retrieveurlcheckip'
+
%= submit_button "$btn", class => 'action' % end