/[smecontribs]/rpms/smeserver-ddclient/contribs10/smeserver-ddclient-1.3.0-Update-SM2-code-for-new-services-and-protocols.patch
ViewVC logotype

Contents of /rpms/smeserver-ddclient/contribs10/smeserver-ddclient-1.3.0-Update-SM2-code-for-new-services-and-protocols.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (show annotations) (download)
Mon Dec 18 10:55:05 2023 UTC (4 months, 4 weeks ago) by brianr
Branch: MAIN
Changes since 1.7: +2 -2 lines
* Fri Nov 10 2023 Brian Read <brianr@koozali.org> 1.3.0-28.sme
- Update template for deprecated commands and v3.11.1 ddclient [SME: 12427 ]
- Update SM2 code to show all new protocols etc

1 diff -urN smeserver-ddclient-1.3.0.old/createlinks smeserver-ddclient-1.3.0/createlinks
2 --- smeserver-ddclient-1.3.0.old/createlinks 2023-11-10 16:11:05.855271810 +0000
3 +++ smeserver-ddclient-1.3.0/createlinks 2023-12-18 10:52:53.495714627 +0000
4 @@ -48,3 +48,6 @@
5 $event = 'post-upgrade';
6 templates2events("/etc/ddclient/ddclient.conf", $event);
7 templates2events("/etc/ppp/ip-up.local", $event);
8 +
9 +# and create an empty cache
10 +# safe_touch("/var/cache/ddclient/ddclient.cache")
11 diff -urN smeserver-ddclient-1.3.0.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers smeserver-ddclient-1.3.0/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers
12 --- smeserver-ddclient-1.3.0.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers 2023-11-10 16:11:05.911271972 +0000
13 +++ smeserver-ddclient-1.3.0/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers 2023-12-14 11:40:00.000000000 +0000
14 @@ -52,15 +52,16 @@
15 } elsif ( $method eq 'ip') {
16 # we want to force manually
17 $OUT.="usev4=ipv4, ipv4=$ForceIP \n";
18 - } elsif ( $method eq 'cmd') {
19 - $OUT .="usev4=cmd, cmdv4='$cmd'\n";
20 + } elsif ( $method eq 'cmdv4') {
21 + $OUT .="usev4=cmdv4, cmdv4='$cmd'\n";
22 } else {
23 # fw method
24 my $fwaddress = $ddclient{'fwaddress'}||'';
25 + my $fwdevice = $ddclient{'Extinterface'}||'';
26 my $fwlogin = $ddclient{'fwlogin'}||'';
27 my $fwpassword = $ddclient{'fwpassword'}||'';
28 my $fwskip = $ddclient{'fwskip'}||'';
29 - $OUT .= "usev4=$method, fwv4=$fwaddress";
30 + $OUT .= "usev4=$fwdevice, fwv4=$fwaddress";
31 $OUT .= ", fw-login=$fwlogin " if ( $fwlogin ne '' );
32 $OUT .= ", fw-password=$fwpassword " if ( $fwpassword ne '' );
33 $OUT .= ", fwv4-skip='$fwskip' " if ( $fwskip ne '' );
34 diff -urN smeserver-ddclient-1.3.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/ddclient.service.d/50koozali.conf/20Service smeserver-ddclient-1.3.0/root/etc/e-smith/templates/usr/lib/systemd/system/ddclient.service.d/50koozali.conf/20Service
35 --- smeserver-ddclient-1.3.0.old/root/etc/e-smith/templates/usr/lib/systemd/system/ddclient.service.d/50koozali.conf/20Service 2023-11-10 16:11:05.857271816 +0000
36 +++ smeserver-ddclient-1.3.0/root/etc/e-smith/templates/usr/lib/systemd/system/ddclient.service.d/50koozali.conf/20Service 2023-12-16 10:40:00.000000000 +0000
37 @@ -1,7 +1,7 @@
38 {
39 $debug = (($ddclient{'debug'} eq 'enabled') ? "debug" : "nodebug");
40 $verbose = (($ddclient{'verbose'} eq 'enabled') ? "verbose" : "noverbose");
41 -$quiet = (($ddclient{'quiet'} eq 'enabled') ? "quiet" : "noquiet");
42 +$quiet = (($ddclient{'quiet'} eq 'disabled') ? "noquiet" : "quiet");
43 $syslog = (($ddclient{'syslog'} eq "enabled") ? "syslog" : "nosyslog");
44 $OUT .= "\n";
45 $OUT .= "[Service]\n";
46 diff -urN smeserver-ddclient-1.3.0.old/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf smeserver-ddclient-1.3.0/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf
47 --- smeserver-ddclient-1.3.0.old/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf 2023-11-10 16:11:05.785271609 +0000
48 +++ smeserver-ddclient-1.3.0/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf 2023-12-15 11:54:47.841967164 +0000
49 @@ -1,3 +1,3 @@
50 UID="ddclient"
51 GID="ddclient"
52 -PERMS=0644
53 +PERMS=0600
54 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
55 --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-11-10 16:11:05.915271983 +0000
56 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-12-14 11:33:00.000000000 +0000
57 @@ -114,90 +114,164 @@
58
59 my %ddc_datas = ();
60
61 +sub get_devices_names {
62 + #
63 + # Router/Firewall devices from which it can get ip address
64 + #
65 + my $devices = ( [
66 + [ '2Wire 1701HG Gateway' => '2wire' ],
67 + [ '3com 3c886a 56k Lan Modem' => '3com-3c886a' ],
68 + [ '3com OfficeConnect Remote 812' => '3com-oc-remote812' ],
69 + [ 'Alcatel Speed Touch 510' => 'alcatel-510' ],
70 + [ 'Alcatel/Thomson SpeedTouch 530' => 'alcatel-530' ],
71 + [ 'Alcatel Speed Touch Pro' => 'alcatel-stp' ],
72 + [ 'Allnet 1298' => 'allnet-1298' ],
73 + [ 'Cayman 3220-H DSL' => 'cayman-3220h' ],
74 + [ 'D-Link DI-524' => 'dlink-524' ],
75 + [ 'D-Link DI-604' => 'dlink-604' ],
76 + [ 'dlink-614' => 'D-Link DI-614+' ],
77 + [ 'e-tech' => 'E-tech Router' ],
78 + [ 'elsa-lancom-dsl10' => 'ELSA LanCom DSL/10 DSL FW' ],
79 + [ 'elsa-lancom-dsl10-ch01' => 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' ],
80 + [ 'elsa-lancom-dsl10-ch02' => 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' ],
81 + [ 'linksys' => 'Linksys FW' ],
82 + [ 'linksys-rv042-wan1' => 'Linksys RV042 Dual Homed Router WAN Port 2' ],
83 + [ 'linksys-rv042-wan2' => 'Linksys RV042 Dual Homed Router WAN Port 2' ],
84 + [ 'linksys-ver2' => 'Linksys FW version 2' ],
85 + [ 'linksys-ver3' => 'Linksys FW version 3' ],
86 + [ 'linksys-wcg200' => 'Linksys WCG200 FW' ],
87 + [ 'linksys-wrt854g' => 'Linksys WRT854G FW' ],
88 + [ 'maxgate-ugate3x00' => 'MaxGate UGATE-3x00 FW' ],
89 + [ 'netcomm-nb3' => 'NetComm NB3' ],
90 + [ 'netgear-dg834g' => 'netgear-dg834g' ],
91 + [ 'netgear-rp614' => 'Netgear RP614 FW' ],
92 + [ 'netgear-rt3xx' => 'Netgear FW' ],
93 + [ 'netgear-wgt624' => 'Netgear WGT624' ],
94 + [ 'netgear-wpn824' => 'Netgear WPN824 FW' ],
95 + [ 'netopia-r910' => 'Netopia R910 FW' ],
96 + [ 'olitec-SX200' => 'olitec-SX200' ],
97 + [ 'rtp300' => 'Linksys RTP300' ],
98 + [ 'siemens-ss4200' => 'Siemens SpeedStream 4200' ],
99 + [ 'sitecom-dc202' => 'Sitecom DC-202 FW' ],
100 + [ 'smc-barricade' => 'SMC Barricade FW' ],
101 + [ 'smc-barricade-7004vbr' => 'SMC Barricade FW (7004VBR model config)' ],
102 + [ 'smc-barricade-7401bra' => 'SMC Barricade 7401BRA FW' ],
103 + [ 'smc-barricade-alt' => 'SMC Barricade FW (alternate config)' ],
104 + [ 'sohoware-nbg800' => 'SOHOWare BroadGuard NBG800' ],
105 + [ 'sveasoft' => 'Sveasoft WRT54G/WRT54GS' ],
106 + [ 'thomson-st536v6' => 'Thomson SpeedTouch 536v6' ],
107 + [ 'thomson-tg782' => 'Thomson/Technicolor TG782' ],
108 + [ 'vigor-2200usb' => 'Vigor 2200 USB' ],
109 + [ 'watchguard-edge-x' => 'Watchguard Edge X FW' ],
110 + [ 'watchguard-soho' => 'Watchguard SOHO FW' ],
111 + [ 'westell-6100' => 'Westell C90-610015-06 DSL Router' ],
112 + [ 'xsense-aero' => 'Xsense Aero' ]
113 + ] );
114 + return $devices;
115 +
116 +
117 + # Automatic loading of the devices from the ddclient program - I can't get this to pass the results successfully to the template
118 + #my $output = `ddclient -list-devices`; # Run ddclient command to get devices output
119 + #my @lines;
120 + #foreach my $line (split /\n/, $output) {
121 + #$line =~ s/\s+//; # Remove leading whitespace
122 + #my ($field1, $field2) = split(' ', $line, 2);
123 + #push @lines, [$field2, $field1];
124 + #}
125 + #return \@lines; # Return a reference to the lines array
126 +}
127 +
128 +sub get_web_services_names {
129 + #
130 + # Web Services from which it can get ip address
131 + #
132 + my $webservices = ( [
133 + [ 'dyndns-http://checkip.dyndns.org/' => 'dyndns' ],
134 + [ 'freedns-https://freedns.afraid.org/dynamic/check.php' => 'freedns' ],
135 + [ 'googledomains-https://domains.google.com/checkip' => 'googledomains' ],
136 + [ 'he-https://checkip.dns.he.net/' => 'he' ],
137 + [ 'ip4only.me-https://ip4only.me/api/' => 'ip4only.me' ],
138 + [ 'ip6only.me-https://ip6only.me/api/' => 'ip6only.me' ],
139 + [ 'ipify-ipv4-https://api.ipify.org/' => 'ipify-ipv4' ],
140 + [ 'ipify-ipv6-https://api6.ipify.org/' => 'ipify-ipv6' ],
141 + [ 'loopia:-https://dns.loopia.se/checkip/checkip.php' => 'loopia' ],
142 + [ 'myonlineportal-https://myonlineportal.net/checkip' => 'myonlineportal' ],
143 + [ 'noip-ipv4-http://ip1.dynupdate.no-ip.com/' => 'noip-ipv4' ],
144 + [ 'noip-ipv6-http://ip1.dynupdate6.no-ip.com/' => 'noip-ipv6' ],
145 + [ 'nsupdate.info-ipv4-https://ipv4.nsupdate.info/myip' => 'nsupdate.info-ipv4' ],
146 + [ 'nsupdate.info-ipv6-https://ipv6.nsupdate.info/myip' => 'nsupdate.info-ipv6' ],
147 + [ 'zoneedit-https://dynamic.zoneedit.com/checkip.html' => 'zoneedit' ]
148 + ] );
149 + return $webservices
150 +
151 + #my $output = `ddclient -list-web-services`; # Run ddclient command to get web services output
152 + #my @lines;
153 + #foreach my $line (split /\n/, $output) {
154 + #$line =~ s/\s+//; # Remove leading whitespace
155 + #my ($field1, $field2) = split(' ', $line, 2);
156 + #push @lines, [$field2, $field1];
157 + #}
158 + #return \@lines; # Return a reference to the lines array
159 +}
160 +
161 sub get_dns_labels {
162 #
163 # dns service names
164 + # Return array with translated results as well.
165 + #
166 + # Note that "new" ones willl not have any description / translation, this can be added to /usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient
167 #
168 my $c = shift;
169 - my $Labels = (
170 -
171 - # v3.11.1 labels
172 - [
173 - [$c->l('1984') '1984'],
174 - [$c->l('changeip') 'changeip'],
175 - [$c->l('cloudflare') 'cloudflare'],
176 - [$c->l('cloudns') 'cloudns'],,
177 - [$c->l('digitalocean') 'digitalocean'],
178 - [$c->l('dinahosting') 'dinahosting'],
179 - [$c->l('dnsexit2') 'dnsexit2'],
180 - [$c->l('dnsmadeeasy') 'dnsmadeeasy'],
181 - [$c->l('domeneshop') 'domeneshop'],
182 - [$c->l('dondominio') 'dondominio'],
183 - [$c->l('dslreports1') 'dslreports1'],
184 - [$c->l('duckdns') 'duckdns'],
185 - [$c->l('dyndns1') 'dyndns1'],
186 - [$c->l('dyndns2') 'dyndns2'],
187 - [$c->l('easydns') 'easydns'],
188 - [$c->l('enom') 'enom'],
189 - [$c->l('freedns') 'freedns'],
190 - [$c->l('freemyip') 'freemyip'],
191 - [$c->l('gandi') 'gandi'],
192 - [$c->l('godaddy') 'godaddy'],
193 - [$c->l('googledomains') 'googledomains'],
194 - [$c->l('hetzner') 'hetzner'],
195 - [$c->l('infomaniak') 'infomaniak'],
196 - [$c->l('keysystems') 'keysystems'],
197 - [$c->l('mythicdyn') 'mythicdyn'],
198 - [$c->l('namecheap') 'namecheap'],
199 - [$c->l('nfsn') 'nfsn'],
200 - [$c->l('njalla') 'njalla'],
201 - [$c->l('noip') 'noip'],
202 - [$c->l('nsupdate') 'nsupdate'],
203 - [$c->l('ovh') 'ovh'],
204 - [$c->l('porkbun') 'porkbun'],
205 - [$c->l('regfishde') 'regfishde'],
206 - [$c->l('sitelutions') 'sitelutions'],
207 - [$c->l('woima') 'woima'],
208 - [$c->l('yandex') 'yandex'],
209 - [$c->l('zoneedit1') 'zoneedit1']
210 - ]
211 - # end of v3.11.1 labels
212 + my $dnsservices = ( [
213 + [ $c->l('1984') => '1984' ],
214 + [ $c->l('changeip') => 'changeip' ],
215 + [ $c->l('cloudflare') => 'cloudflare' ],
216 + [ $c->l('cloudns') => 'cloudns' ],
217 + [ $c->l('digitalocean') => 'digitalocean' ],
218 + [ $c->l('dinahosting') => 'dinahosting' ],
219 + [ $c->l('dnsexit') => 'dnsexit' ],
220 + [ $c->l('dnsmadeeasy') => 'dnsmadeeasy' ],
221 + [ $c->l('domeneshop') => 'domeneshop' ],
222 + [ $c->l('dondominio') => 'dondominio' ],
223 + [ $c->l('dslreports') => 'dslreports' ],
224 + [ $c->l('duckdns') => 'duckdns' ],
225 + [ $c->l('dyndns1') => 'dyndns1' ],
226 + [ $c->l('dyndns2') => 'dyndns2' ],
227 + [ $c->l('easydns') => 'easydns' ],
228 + [ $c->l('enom') => 'enom' ],
229 + [ $c->l('freedns') => 'freedns' ],
230 + [ $c->l('freemyip') => 'freemyip' ],
231 + [ $c->l('gandi') => 'gandi' ],
232 + [ $c->l('godaddy') => 'godaddy' ],
233 + [ $c->l('googledomains') => 'googledomains' ],
234 + [ $c->l('hetzner') => 'hetzner' ],
235 + [ $c->l('infomaniak') => 'infomaniak' ],
236 + [ $c->l('keysystems') => 'keysystems' ],
237 + [ $c->l('mythicdyn') => 'mythicdyn' ],
238 + [ $c->l('namecheap') => 'namecheap' ],
239 + [ $c->l('nfsn') => 'nfsn' ],
240 + [ $c->l('njalla') => 'njalla' ],
241 + [ $c->l('noip') => 'noip' ],
242 + [ $c->l('nsupdate') => 'nsupdate' ],
243 + [ $c->l('ovh') => 'ovh' ],
244 + [ $c->l('porkbun') => 'porkbun' ],
245 + [ $c->l('regfishde') => 'regfishde' ],
246 + [ $c->l('sitelutions') => 'sitelutions' ],
247 + [ $c->l('woima') => 'woima' ],
248 + [ $c->l('yandex') => 'yandex' ],
249 + [ $c->l('zoneedit') => 'zoneedit' ]
250 + ] );
251 + return $dnsservices;
252
253 -
254 - #[ [ $c->l('CUSTOMDNS'), 'CUSTOMDNS' ],
255 - #[ $c->l('DYNDNS1'), 'DYNDNS1' ],
256 - #[ $c->l('DYNDNS2'), 'DYNDNS2' ],
257 - #[ $c->l('DYNDNS3'), 'DYNDNS3' ],
258 - #[ $c->l('ZONEDIT'), 'ZONEDIT' ],
259 - #[ $c->l('EASYDNS'), 'EASYDNS' ],
260 - #[ $c->l('HAMMER'), 'HAMMER' ],
261 - #[ $c->l('DSLREPORTS'), 'DSLREPORTS' ],
262 - #[ $c->l('EURODYNDNS'), 'EURODYNDNS' ],
263 - #[ $c->l('DTDNS'), 'DTDNS' ],
264 - #[ $c->l('LOOPIA'), 'LOOPIA' ],
265 - #[ $c->l('DNSPARK'), 'DNSPARK' ],
266 - #[ $c->l('DYNHOST'), 'DYNHOST' ],
267 - #[ $c->l('NOIP'), 'NOIP' ],
268 - #[ $c->l('CHANGEIP'), 'CHANGEIP' ],
269 - #[ $c->l('NAMECHEAP'), 'NAMECHEAP' ],
270 - #[ $c->l('SPDNS'), 'SPDNS' ],
271 - #[ $c->l('SITELUTIONS'), 'SITELUTIONS' ],
272 - #[ $c->l('FREEDNS'), 'FREEDNS' ],
273 - #[ $c->l('NSUPDATE'), 'NSUPDATE' ],
274 - #[ $c->l('CLOUDFLARE'), 'CLOUDFLARE' ],
275 - #[ $c->l('GOOGLEDOMAINS'), 'GOOGLEDOMAINS' ],
276 - #[ $c->l('DUCKDNS'), 'DUCKDNS' ],
277 - #[ $c->l('FREEMYIP'), 'FREEMYIP' ],
278 - #[ $c->l('WOIMA'), 'WOIMA' ],
279 - #[ $c->l('YANDEX'), 'YANDEX' ],
280 - #[ $c->l('DNSMADEEASY'), 'DNSMADEEASY' ],
281 - #[ $c->l('DONDOMINIO'), 'DONDOMINIO' ],
282 - #[ $c->l('NEARLYFREESPEECH'), 'NFSN' ],
283 - #[ $c->l('OVH'), 'OVH' ],
284 - #[ $c->l('CLOUDNS'), 'CLOUDNS' ]
285 - #]
286 - );
287 - return $Labels;
288 + #my $output = `ddclient -list-protocols`; # Run ddclient command and capture the output
289 + #my @protocols;
290 + #foreach my $line (split /\n/, $output) {
291 + #my ($protocol) = $line =~ /\s*(\S+)/;
292 + #next unless $protocol; # Skip if protocol is empty or contains only whitespace
293 + #my $custom_value = "$protocol.$c->l($protocol)"; # Additional column value using $c->l(protocol)
294 + #push @protocols, [$custom_value, $protocol];
295 + #}
296 + #return \@protocols; # Return a reference to the protocols array
297 }
298
299 sub main {
300 @@ -230,13 +304,15 @@
301 my $emptycust = ( scalar @FreeDomains == 0 );
302
303 my $Labels = (
304 - [ [ $c->l('SME external Interface'), "smeIF" ],
305 - [ $c->l('SME configuration DB'), "smeCMD" ],
306 - [ $c->l('web'), "web" ],
307 - [ $c->l('Interface'), "if" ],
308 - [ $c->l('IP'), "ip" ],
309 - [ $c->l('Command'), "cmd" ]
310 - ]
311 + [
312 + [ $c->l('SME external Interface') => "smeIF" ],
313 + [ $c->l('SME configuration DB') => 'smeCMD' ],
314 + [ $c->l('web') => 'web' ],
315 + [ $c->l('Router/Firewall') => 'router' ],
316 + [ $c->l('Interface') => 'if' ],
317 + [ $c->l('IP') => 'ip' ],
318 + [ $c->l('Command') => 'cmdv4' ]
319 + ]
320 );
321
322 $c->stash(
323 @@ -246,6 +322,9 @@
324 domains => \@domains,
325 freedomains => \@FreeDomains,
326 methodlabels => $Labels,
327 + dnslabels => get_dns_labels($c),
328 + devices => get_devices_names($c),
329 + webservices => get_web_services_names($c),
330 emptydom => $emptydom,
331 emptycust => $emptycust
332 );
333 @@ -260,6 +339,7 @@
334 # Called to update the parameters relating to the Ip address of the server
335 #
336 my $c = shift;
337 + $ddc_datas{"first"} = '';
338 $ddc_datas{"success"} = pushParams($c);
339 do_display($c);
340 }
341 @@ -269,6 +349,7 @@
342 #Called to update/delete the ddclient for a specific inbuilt domain
343 #
344 my $c = shift;
345 + my $title = $c->l("MODIFY_TITLE");
346 my $retmsg;
347 if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
348 $retmsg = performModifyCustom($c);
349 @@ -276,10 +357,11 @@
350 else {
351 $retmsg = performModifyDomain($c);
352 }
353 + $ddc_datas{"first"} = '';
354 if ( $retmsg eq "ok" ) {
355 my $dns = $c->param('dns');
356 my $domain = $c->param('domainname');
357 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain,
358 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_MODIFIED", $domain,
359 $c->l( '' . $dns ) );
360 do_display( $c, %ddc_datas );
361 }
362 @@ -296,7 +378,7 @@
363 # Create custom domain
364 #
365 my $c = shift;
366 - my $title = $c->l("ddc_CREATE_TITLE");
367 + my $title = $c->l("CREATE_TITLE");
368 my $modul = '';
369 my $trt = "NEW";
370
371 @@ -305,18 +387,21 @@
372 title => $title,
373 modul => $modul,
374 ddc_datas => \%ddc_datas,
375 - dnslabels => get_dns_labels($c)
376 + dnslabels => get_dns_labels($c),
377 + devices => get_devices_names($c),
378 + webservices => get_web_services_names($c)
379 );
380 $c->render( template => 'ddclient' );
381 }
382
383 sub do_create_custom_actual {
384 my $c = shift;
385 + $ddc_datas{"first"} = '';
386 my $retmsg = performCreateCustom($c);
387 if ( $retmsg eq "ok" ) {
388 my $dns = $c->param('dns');
389 my $domain = $c->param('domainname');
390 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain,
391 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain,
392 $c->l( '' . $dns ) );
393 do_display( $c, %ddc_datas );
394 }
395 @@ -334,7 +419,7 @@
396 # Display delete or modify panel for custom domain
397 #
398 my $c = shift;
399 - my $title = $c->l("ddc_MODIFY_TITLE");
400 + my $title = $c->l("MODIFY_TITLE");
401 my $modul = '';
402 my $trt = $c->param("trt");
403
404 @@ -349,7 +434,9 @@
405 title => $title,
406 modul => $modul,
407 ddc_datas => \%ddc_datas,
408 - dnslabels => get_dns_labels($c)
409 + dnslabels => get_dns_labels($c),
410 + devices => get_devices_names($c),
411 + webservices => get_web_services_names($c)
412 );
413 $c->render( template => 'ddclient' );
414 }
415 @@ -360,21 +447,23 @@
416 # param trt = MOD or DEL
417 #
418 my $c = shift;
419 - my $title = $c->l("ddc_MODIFY_TITLE");
420 + my $title = $c->l("MODIFY_TITLE");
421 my $modul = '';
422 my $trt = $c->param("trt");
423
424 #Extract domain stuff from DB
425 my @results
426 = get_domain_table( $c, $c->param("Domain") ); #Returns just one row
427 - $ddc_datas{"Domain_details"} = $results[0];
428
429 + $ddc_datas{"Domain_details"} = $results[0];
430 $ddc_datas{'trt'} = $trt;
431 $c->stash(
432 title => $title,
433 modul => $modul,
434 ddc_datas => \%ddc_datas,
435 - dnslabels => get_dns_labels($c)
436 + dnslabels => get_dns_labels($c),
437 + devices => get_devices_names($c),
438 + webservices => get_web_services_names($c)
439 );
440 $c->render( template => 'ddclient' );
441 }
442 @@ -386,10 +475,11 @@
443 #
444 my $c = shift;
445 my $route = $c->current_route;
446 - my $title = $c->l("ddc_REMOVE_TITLE");
447 + my $title = $c->l("REMOVE_TITLE");
448 my $modul = '';
449 my $retmsg = "";
450 my $domain = $c->param("Domain");
451 + $ddc_datas{"first"} = '';
452
453 #Delete it and return to front summary panel - depends on route domain or custom
454 if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
455 @@ -400,7 +490,7 @@
456 }
457
458 if ( $retmsg eq "ok" ) {
459 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain,
460 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain,
461 $c->l( '' . $c->param("dns") ) );
462 }
463 else { $ddc_datas{"error"} = $retmsg; }
464 @@ -415,15 +505,16 @@
465 #
466 my $c = shift;
467 my $route = $c->current_route;
468 - my $title = $c->l("ddc_REMOVE_TITLE");
469 + my $title = $c->l("REMOVE_TITLE");
470 my $modul = '';
471 my $retmsg = "";
472 my $domain = $c->param("Domain");
473 + $ddc_datas{"first"} = '';
474
475 #Delete it and return to front summary panel - depends on route domain or custom
476 $retmsg = performDeleteCustom( $c, $domain );
477 if ( $retmsg eq "ok" ) {
478 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain );
479 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain );
480 }
481 else { $ddc_datas{"error"} = $retmsg; }
482 do_display( $c, %ddc_datas );
483 @@ -450,7 +541,7 @@
484
485 foreach $domain ( sort @virtualDomains ) {
486 my %properties = $domaindb->get($domain)->props;
487 - my $test = $domaindb->get_prop( $domain, "dns" ) || '';
488 + my $test = $domaindb->get($domain) || '';
489 my %extraprops;
490 if ( $test ne '' ) {
491 %extraprops = $domaindb->get($domain)->props;
492 @@ -567,6 +658,8 @@
493 my $Extinterface = $ddretrieve->prop('Extinterface') || '';
494 my $cmd = $ddretrieve->prop('cmd') || '';
495 my $forceIP = $ddretrieve->prop('ForceIP') || '';
496 + my $fwlogin = $ddretrieve->prop('fwlogin') || '';
497 + my $fwpassword = $ddretrieve->prop('fwpassword') || '';
498 my $res = {
499 "ssl" => $ssl,
500 "DeamonUpdate" => $DeamonUpdate,
501 @@ -574,29 +667,43 @@
502 "Extinterface" => $Extinterface,
503 "cmd" => $cmd,
504 "ForceIP" => $forceIP,
505 - "urlcheckip" => $urlcheckip
506 + "urlcheckip" => $urlcheckip,
507 + "FWlogin" => $fwlogin,
508 + "FWpassword" => $fwpassword
509 };
510 return $res;
511 }
512
513 sub pushParams {
514 my $c = shift;
515 - my $DeamonUpdate = $c->param('retrievedeamonupdate');
516 - my $urlcheckip = $c->param('retrieveurlcheckip');
517 - my $ssl = $c->param('retrievessl');
518 + my $retrievedeamonupdate = $c->param('retrievedeamonupdate');
519 + my $retrieverouter = $c->param('retrieverouter');
520 + my $retrievewebservice = $c->param('retrievewebservice');
521 + my $retrieveurlcheckip = $c->param('retrieveurlcheckip');
522 + my $retrievessl = $c->param('retrievessl');
523 my $retrievemethod = $c->param('retrievemethod');
524 my $retrieveinterface = $c->param('retrieveinterface');
525 my $retrievecmd = $c->param('retrievecmd');
526 my $retrieveip = $c->param('retrieveip');
527 + my $retrievefwlogin = $c->param('retrieverouterlogin');
528 + my $retrievefwpassword = $c->param('retrieverouterpassword');
529 +
530 + #print 1 / 0; #Crash
531
532 my $ddclient = $db->get('ddclient');
533 - $ddclient->set_prop( 'urlcheckip' => $urlcheckip );
534 - $ddclient->set_prop( 'DeamonUpdate' => $DeamonUpdate );
535 - $ddclient->set_prop( 'SSL' => $ssl );
536 + $ddclient->set_prop( 'urlcheckip' => $retrievewebservice || $retrieveurlcheckip );
537 + $ddclient->set_prop( 'DeamonUpdate' => $retrievedeamonupdate );
538 + $ddclient->set_prop( 'SSL' => $retrievessl );
539 $ddclient->set_prop( 'method' => $retrievemethod );
540 - $ddclient->set_prop( 'Extinterface' => $retrieveinterface );
541 + if ($retrievemethod eq 'router') {
542 + $ddclient->set_prop( 'Extinterface' => $retrieverouter );
543 + } else {
544 + $ddclient->set_prop( 'Extinterface' => $retrieveinterface );
545 + }
546 $ddclient->set_prop( 'cmd' => $retrievecmd );
547 $ddclient->set_prop( 'ForceIP' => $retrieveip );
548 + $ddclient->set_prop( 'fwlogin' => $retrievefwlogin );
549 + $ddclient->set_prop( 'fwpassword' => $retrievefwpassword );
550
551 $domaindb->reload();
552
553 @@ -616,7 +723,7 @@
554 #------------------------------------------------------------
555
556 my $domainName = $c->param('domainName');
557 - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
558 + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
559 $domainName = $1;
560 }
561 else {
562 @@ -624,7 +731,7 @@
563 }
564
565 my $domainLogin = $c->param('login');
566 - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
567 + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
568 $domainLogin = $1;
569 }
570 else {
571 @@ -632,7 +739,7 @@
572 }
573
574 my $domainPassword = $c->param('password');
575 - if ( $domainPassword =~ /^(.*)$/ ) {
576 + if ( $domainPassword =~ /(.*)$/ ) {
577 $domainPassword = $1;
578 }
579 else {
580 @@ -646,7 +753,7 @@
581
582 my $dns = $c->param('dns');
583 if ( $dns eq 'CUSTOMDNS' ) {
584 - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
585 + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
586 $customDNS = $1;
587 }
588 else
589 @@ -685,7 +792,7 @@
590 # Attempt to delete domain
591 #------------------------------------------------------------
592
593 - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
594 + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) {
595 $domain = $1;
596 }
597 else {
598 @@ -726,7 +833,7 @@
599 #------------------------------------------------------------
600
601 my $domainName = $c->param('domainName');
602 - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
603 + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
604 $domainName = $1;
605 }
606 else {
607 @@ -749,7 +856,7 @@
608
609 my $domainDesc = $c->param('desc');
610 my $domainLogin = $c->param('login');
611 - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
612 + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
613 $domainLogin = $1;
614 }
615 else {
616 @@ -757,7 +864,7 @@
617 }
618
619 my $domainPassword = $c->param('password');
620 - if ( $domainPassword =~ /^(.*)$/ ) {
621 + if ( $domainPassword =~ /(.*)$/ ) {
622 $domainPassword = $1;
623 }
624 else {
625 @@ -771,7 +878,7 @@
626
627 my $dns = $c->param('dns');
628 if ( $dns eq 'CUSTOMDNS' ) {
629 - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
630 + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
631 $customDNS = $1;
632 }
633 else {
634 @@ -809,7 +916,7 @@
635 #------------------------------------------------------------
636
637 my $domainName = $c->param('domainName');
638 - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
639 + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
640 $domainName = $1;
641 }
642 else {
643 @@ -817,7 +924,7 @@
644 }
645
646 my $domainLogin = $c->param('login');
647 - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
648 + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
649 $domainLogin = $1;
650 }
651 else {
652 @@ -825,7 +932,7 @@
653 }
654
655 my $domainPassword = $c->param('password');
656 - if ( $domainPassword =~ /^(.*)$/ ) {
657 + if ( $domainPassword =~ /(.*)$/ ) {
658 $domainPassword = $1;
659 }
660 else {
661 @@ -839,7 +946,7 @@
662
663 my $dns = $c->param('dns');
664 if ( $dns eq 'CUSTOMDNS' ) {
665 - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
666 + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
667 $customDNS = $1;
668 }
669 else
670 @@ -878,7 +985,7 @@
671 # Attempt to delete domain
672 #------------------------------------------------------------
673
674 - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
675 + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) {
676 $domain = $1;
677 }
678 else {
679 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
680 --- 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
681 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2023-12-18 09:29:00.000000000 +0000
682 @@ -80,46 +80,48 @@
683 'CLOUDNS'=>'CLOUDNS www.cloudns.net',
684 # End of Service descriptions
685
686 -# v3.11.1 Service descriptions:
687 -"1984" => "https://kb.1984hosting.com/doku.php?id=freedns",
688 -"changeip" => "https://changeip.com",
689 -"cloudflare" => "https://cloudflare.com",
690 -"cloudns" => "https://cloudns.com",
691 -"digitalocean" => "https://digitalocean.com",
692 -"dinahosting" => "https://dinahosting.com",
693 -"dnsexit" => "https://dnsexit.com/",
694 -"dnsmadeeasy" => "https://dnsmadeeasy.com",
695 -"domeneshop" => "https://domeneshop.com",
696 -"dondominio" => "https://dondominio.com",
697 -"dslreports" => "https://www.dslreports.com/",
698 -"duckdns" => "https://duckdns.com",
699 -"dyndns1" => "https://account.dyn.com/",
700 -"dyndns2" => "https://account.dyn.com/",
701 -"easydns" => "https://easydns.com",
702 -"enom" => "https://enom.com",
703 -"freedns" => "http://freedns.com",
704 -"freemyip" => "https://freemyip.com",
705 -"gandi" => "https://gandi.com",
706 -"godaddy" => "https://godaddy.com",
707 -"googledomains" => "https://googledomains.com",
708 -"hetzner" => "https://hetzner.com",
709 -"infomaniak" => "https://infomaniak.com",
710 -"keysystems" => "https://keysystems.com",
711 -"mythicdyn" => "https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns",
712 -"namecheap" => "https://namecheap.com",
713 -"nfsn" => "http://nfsn.com",
714 -"njalla" => "https://njalla.com",
715 -"noip" => "https://noip.com",
716 -"nsupdate" => "http://nsupdate.com",
717 -"ovh" => "https://ovh.com",
718 -"porkbun" => "https://porkbun.com",
719 -"regfishde" => "regfishde",
720 -"sitelutions" => "https://sitelutions.com",
721 -"woima" => "http://woima.com",
722 -"yandex" => "https://yandex.com",
723 -"zoneedit" => "https://www.zoneedit.com/dynamic-dns/",
724 -# end of v3.11.1 Service descriptions:
725 +# v3.11.x Service descriptions:
726 +"1984" => "1984-https://kb.1984hosting.com/doku.php?id=freedns",
727 +"changeip" => "changeip-https://changeip.com",
728 +"cloudflare" => "cloudflare-https://cloudflare.com",
729 +"cloudns" => "cloudns-https://cloudns.com",
730 +"digitalocean" => "digitalocean-https://digitalocean.com",
731 +"dinahosting" => "dinahosting-https://dinahosting.com",
732 +"dnsexit" => "dnsexit-https://dnsexit.com/",
733 +"dnsmadeeasy" => "dnsmadeeasy-https://dnsmadeeasy.com",
734 +"domeneshop" => "domeneshop-https://domeneshop.com",
735 +"dondominio" => "dondominio-https://dondominio.com",
736 +"dslreports" => "dslreports-https://www.dslreports.com/",
737 +"duckdns" => "duckdns-https://duckdns.com",
738 +"dyndns1" => "dyndns1-https://account.dyn.com/",
739 +"dyndns2" => "dyndns2-https://account.dyn.com/",
740 +"easydns" => "easydns-https://easydns.com",
741 +"enom" => "enom-https://enom.com",
742 +"freedns" => "freedns-http://freedns.com",
743 +"freemyip" => "freemyip-https://freemyip.com",
744 +"gandi" => "gandi-https://gandi.com",
745 +"godaddy" => "godaddy-https://godaddy.com",
746 +"googledomains" => "googledomains-https://googledomains.com",
747 +"hetzner" => "hetzner-https://hetzner.com",
748 +"infomaniak" => "infomaniak-https://infomaniak.com",
749 +"keysystems" => "keysystems-https://keysystems.com",
750 +"mythicdyn" => "mythicdyn-https://www.mythic-beasts.com/support/api/dnsv2/dynamic-dns",
751 +"namecheap" => "namecheap-https://namecheap.com",
752 +"nfsn" => "nfsn-http://nfsn.com",
753 +"njalla" => "njalla-https://njalla.com",
754 +"noip" => "noip-https://noip.com",
755 +"nsupdate" => "nsupdate-http://nsupdate.com",
756 +"ovh" => "ovh-https://ovh.com",
757 +"porkbun" => "porkbun-https://porkbun.com",
758 +"regfishde" => "regfishde-regfishde",
759 +"sitelutions" => "sitelutions-https://sitelutions.com",
760 +"woima" => "woima-http://woima.com",
761 +"yandex" => "yandex-https://yandex.com",
762 +"zoneedit" => "zoneedit-https://www.zoneedit.com/dynamic-dns/",
763 +# end of v3.11.x Service descriptions:
764
765 +'MODIFY_DESCRIPTION' => "You can modify the Dynamic DNS Service that you use and change the username and password",
766 +'CREATE_DESCRIPTION' => "You can create a domain to use for the Dynamic DNS Service that you use and set or change the username and password",
767 'CUSTOMDNS' => 'Custom Dynamic DNS Provider',
768 'CUSTOMDNS_LABEL' => 'Custom server Address',
769 'CUSTOM_PROTOCOL_LABEL' => 'Custom ddclient Protocol',
770 @@ -136,8 +138,8 @@
771 'DESCRIPTION_LABEL' => 'Domain description',
772 'SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.',
773 'RETRIEVE_METHOD' => 'Method to retrieve new IP:',
774 -'RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method',
775 -'RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method',
776 +'RETRIEVE_IF' => 'Local interface to get new IP',
777 +'RETRIEVE_CMD' => 'Command to execute to get IP',
778 'SME external Interface' => 'SME external interface',
779 'SME configuration DB' => 'SME configuration DB',
780 'web' => 'Web query',
781 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
782 --- 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
783 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_create_cust.html.ep 2023-12-18 09:35:00.000000000 +0000
784 @@ -1,41 +1,43 @@
785 -<div id='ddc_createcustom'>
786 +<div id='createcustom'>
787 <h2>
788 - %= l 'ddc_CUSTOM_DESCRIPTION'
789 + %= l 'CREATE_DESCRIPTION'
790 </h2><br>
791 - % my $btn = l('ddc_APPLY');
792 + % my $btn = l('APPLY');
793 %= form_for '/ddclient7' => (method => 'POST') => begin
794 <span class=label>
795 - %=l 'ddc_DOMAIN_NAME_LABEL'
796 + %=l 'DOMAIN_NAME_LABEL'
797 </span><span class=data>
798 %=text_field 'domainName'
799 </span><br>
800 <span class=label>
801 - %=l 'ddc_DESCRIPTION_LABEL'
802 + %=l 'DESCRIPTION_LABEL'
803 </span><span class=data>
804 %=text_field 'desc'
805 </span><br>
806 <span class=label>
807 - %=l 'ddc_SERVERS_LABEL'
808 + %=l 'SERVERS_LABEL'
809 </span><span class=data>
810 %=select_field dns=>$dnslabels
811 </span><br>
812 +<!--
813 <span class=label>
814 - %=l 'ddc_CUSTOMDNS_LABEL'
815 + %=l 'CUSTOMDNS_LABEL'
816 </span><span class=data>
817 %=text_field 'customdns'
818 </span><br>
819 <span class=label>
820 - %=l 'ddc_CUSTOM_PROTOCOL_LABEL'
821 + %=l 'CUSTOM_PROTOCOL_LABEL'
822 </span><span class=data>
823 %=text_field 'customprotocol'
824 </span><br>
825 +-->
826 <span class=label>
827 - %=l 'ddc_NAME_LABEL'
828 + %=l 'NAME_LABEL'
829 </span><span class=data>
830 %=text_field 'login'
831 </span><br>
832 <span class=label>
833 - %=l 'ddc_PASSWORD_LABEL'
834 + %=l 'PASSWORD_LABEL'
835 </span><span class=data>
836 %=password_field 'password',id=>"ddcPass"
837 %=label_for show=>"Show"
838 @@ -52,7 +54,7 @@
839 % end
840 </span><br>
841 <span class=label>
842 - %=l 'ddc_MX'
843 + %=l 'MX'
844 </span><span class=data>
845 %=text_field 'mx'
846 </span><br>
847 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
848 --- 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
849 +++ 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
850 @@ -1,4 +1,9 @@
851 <div id='modifydomain'>
852 + <script>
853 + window.onload = function() {
854 + SelectInput();
855 + };
856 + </script>
857 <h2>
858 %= l 'CUSTOM_DESCRIPTION'
859 </h2><br>
860 @@ -24,20 +29,41 @@
861 %=l 'SERVERS_LABEL'
862 </span><span class=data>
863 % param dns=>$ddc_datas->{"Domain_details"}->{"dns"};
864 - %=select_field dns=>$dnslabels
865 + %=select_field dns=>$dnslabels,id=>"dns",onchange=>"SelectInput()",onload=>"SelectInput()"
866 + %= javascript begin
867 + function SelectInput() {
868 + var method = document.querySelector("#dns");
869 + const types=['custom'];
870 + types.forEach((type)=>{
871 + var service = document.querySelector(`.${type}`);
872 + if (service != null) {
873 + if (method.value == type) {
874 + service.style.display = 'block';
875 + } else {
876 + service.style.display = 'none';
877 + }
878 + }
879 + })
880 + }
881 + %end
882 </span><br>
883 - <span class=label>
884 +
885 + %# Dependant on the custom choice from above
886 + <div class=custom>
887 + <span class=label custom>
888 %=l 'CUSTOMDNS_LABEL'
889 - </span><span class=data>
890 + </span><span class=data custom>
891 % param customdns=>$ddc_datas->{"Domain_details"}->{"customdns"};
892 %=text_field 'customdns'
893 </span><br>
894 - <span class=label>
895 + <span class=label custom>
896 %=l 'CUSTOM_PROTOCOL_LABEL'
897 - </span><span class=data>
898 + </span><span class=data custom>
899 % param customprotocol=>$ddc_datas->{"Domain_details"}->{"customprotocol"};
900 %=text_field 'customprotocol'
901 </span><br>
902 + </div>
903 +
904 <span class=label>
905 %=l 'NAME_LABEL'
906 </span><span class=data>
907 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
908 --- 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
909 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/themes/default/templates/partials/_ddc_paramlist.html.ep 2023-12-14 11:36:00.000000000 +0000
910 @@ -1,4 +1,9 @@
911 <div id='paramlist'>
912 + <script>
913 + window.onload = function() {
914 + SelectInput();
915 + };
916 + </script>
917 <h2>
918 %= l 'Params_for_IP_Retrieval'
919 </h2>
920 @@ -7,11 +12,11 @@
921 <span class=label>
922 %=l 'RETRIEVE_SSL'
923 </span><span class=data>
924 - % param retrievessl=>$ddc_datas->{"params"}->{"ssl"};
925 + % param retrievessl=>$ddc_datas->{"params"}->{"ssl"} unless param 'retrievessl';
926 %=select_field retrievessl=>[['Yes'=>'yes'],['No'=>'no']]
927 </span><br>
928 <span class=label>
929 - %=l 'RETRIEVE_DEAMONUPDATE'
930 + %=l 'RETRIEVE_DEAMONUPDATE'
931 </span><span class=data>
932 % param retrievedeamonupdate=>$ddc_datas->{"params"}->{"DeamonUpdate"};
933 %=number_field 'retrievedeamonupdate',min=>0
934 @@ -19,33 +24,112 @@
935 <span class=label>
936 %=l 'RETRIEVE_METHOD'
937 </span><span class=data>
938 - % param retrievemethod=>$ddc_datas->{"params"}->{"method"};
939 - %=select_field retrievemethod=>$methodlabels
940 - </span><br>
941 - <span class=label>
942 - %=l 'RETRIEVE_IF'
943 - </span><span class=data>
944 - % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"};
945 - %=text_field 'retrieveinterface'
946 - </span><br>
947 - <span class=label>
948 - %=l 'RETRIEVE_CMD'
949 - </span><span class=data>
950 - % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"};
951 - %=text_field 'retrievecmd'
952 - </span><br>
953 - <span class=label>
954 - %=l 'RETRIEVE_IP'
955 - </span><span class=data>
956 - % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"};
957 - %=text_field 'retrieveip'
958 - </span><br>
959 - <span class=label>
960 - %=l 'RETRIEVE_URLCHECKIP'
961 - </span><span class=data>
962 - % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"};
963 - %=text_field 'retrieveurlcheckip'
964 - </span><br>
965 + % param retrievemethod=>$ddc_datas->{"params"}->{"method"} unless param 'retrievemethod';
966 + %=select_field retrievemethod=>$methodlabels,id=>"retrievemethod",onchange=>"SelectInput()"
967 + %= javascript begin
968 + function SelectInput() {
969 + var method = document.querySelector("#retrievemethod");
970 + const types=['smeIF','smeCMD','web','router','if','ip','cmdv4','custom'];
971 + types.forEach((type)=>{
972 + var service = document.querySelector(`.${type}`);
973 + if (service != null) {
974 + if (method.value == type) {
975 + service.style.display = 'block';
976 + } else {
977 + service.style.display = 'none';
978 + }
979 + }
980 + })
981 + }
982 + % end
983 + </span><br>
984 + %#
985 + %# From here the one that is shown depends on the choice above
986 + %#
987 + %# Only if "router" is chosen
988 + <div class = router>
989 + <span class=label>
990 + %=l 'Router type'
991 + </span><span class=data>
992 + % param retrieverouter=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieverouter';
993 + %=select_field retrieverouter=>$devices
994 + </span><br>
995 + %# Need login and password for router
996 + <span class=label>
997 + %=l 'Router login'
998 + </span><span class=data>
999 + % param retrieverouterlogin=>$ddc_datas->{"params"}->{"FWLogin"} unless param 'retrieverouter';
1000 + %=text_field 'retrieverouterlogin'
1001 + </span><br>
1002 + <span class=label>
1003 + %=l 'Router password'
1004 + </span><span class=data>
1005 + % param retrieverouterpassword=>$ddc_datas->{"params"}->{"FWPassword"} unless param 'retrieverouterpassword';
1006 + %=password_field 'retrieverouterpassword', id=>'ddcPass'
1007 + %=label_for show=>"Show"
1008 + %=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;"
1009 + %= javascript begin
1010 + function showPass() {
1011 + var x = document.getElementById("ddcPass");
1012 + if (x.type === "password") {
1013 + x.type = "text";
1014 + } else {
1015 + x.type = "password";
1016 + }
1017 + }
1018 + % end
1019 + </span><br>
1020 + </div>
1021 +
1022 + %# Only if "web" is chosen"
1023 + <div class = web>
1024 + <span class=label>
1025 + %=l 'Web service'
1026 + </span><span class=data>
1027 + % param retrievewebservice=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrievewebservice';
1028 + %=select_field retrievewebservice=>$webservices
1029 + </span><br />
1030 + </div>
1031 +
1032 + %# Only if "Interface" is chosen
1033 + <div class=if>
1034 + <span class=label Interface>
1035 + %=l 'RETRIEVE_IF'
1036 + </span><span class=data Interface>
1037 + % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieveinterface';
1038 + %=text_field 'retrieveinterface'
1039 + </span><br>
1040 + </div>
1041 +
1042 + %# Only if "cmd" is chosen
1043 + <div class=cmdv4>
1044 + <span class=label cmd>
1045 + %=l 'RETRIEVE_CMD'
1046 + </span><span class=data cmd>
1047 + % param retrievecmd=>$ddc_datas->{"params"}->{"cmdv4"} unless param 'retrievecmd';
1048 + %=text_field 'retrievecmd'
1049 + </span><br>
1050 + </div>
1051 +
1052 + %# Only if "ip" is chosen
1053 + <div class=ip>
1054 + <span class=label ip>
1055 + %=l 'RETRIEVE_IP'
1056 + </span><span class=data ip>
1057 + % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"} unless param 'retrieveip';
1058 + %=text_field 'retrieveip'
1059 + </span><br>
1060 + </div>
1061 +
1062 + %# Only if "custom web service"
1063 + <div class=custom>
1064 + <span class=label customweb>
1065 + %=l 'RETRIEVE_URLCHECKIP'
1066 + </span><span class=data customweb>
1067 + % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrieveurlcheckip';
1068 + %=text_field 'retrieveurlcheckip'
1069 + </span><br>
1070 + </div>
1071
1072 %= submit_button "$btn", class => 'action'
1073 % end

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed