/[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.2 - (show annotations) (download)
Mon Dec 4 08:48:10 2023 UTC (5 months, 1 week ago) by brianr
Branch: MAIN
Changes since 1.1: +228 -156 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/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm
2 --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-11-10 16:11:05.915271983 +0000
3 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-12-01 17:16:00.000000000 +0000
4 @@ -114,57 +114,168 @@
5
6 my %ddc_datas = ();
7
8 +sub get_devices_names {
9 + #
10 + # Router devices from which it can get ip address
11 + #
12 + my $devices = ( [
13 + [ '2wire' => '2Wire 1701HG Gateway' ],
14 + [ '3com-3c886a' => '3com 3c886a 56k Lan Modem' ],
15 + [ '3com-oc-remote812' => '3com OfficeConnect Remote 812' ],
16 + [ 'alcatel-510' => 'Alcatel Speed Touch 510' ],
17 + [ 'alcatel-530' => 'Alcatel/Thomson SpeedTouch 530' ],
18 + [ 'alcatel-stp' => 'Alcatel Speed Touch Pro' ],
19 + [ 'allnet-1298' => 'Allnet 1298' ],
20 + [ 'cayman-3220h' => 'Cayman 3220-H DSL' ],
21 + [ 'dlink-524' => 'D-Link DI-524' ],
22 + [ 'dlink-604' => 'D-Link DI-604' ],
23 + [ 'dlink-614' => 'D-Link DI-614+' ],
24 + [ 'e-tech' => 'E-tech Router' ],
25 + [ 'elsa-lancom-dsl10' => 'ELSA LanCom DSL/10 DSL FW' ],
26 + [ 'elsa-lancom-dsl10-ch01' => 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' ],
27 + [ 'elsa-lancom-dsl10-ch02' => 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' ],
28 + [ 'linksys' => 'Linksys FW' ],
29 + [ 'linksys-rv042-wan1' => 'Linksys RV042 Dual Homed Router WAN Port 2' ],
30 + [ 'linksys-rv042-wan2' => 'Linksys RV042 Dual Homed Router WAN Port 2' ],
31 + [ 'linksys-ver2' => 'Linksys FW version 2' ],
32 + [ 'linksys-ver3' => 'Linksys FW version 3' ],
33 + [ 'linksys-wcg200' => 'Linksys WCG200 FW' ],
34 + [ 'linksys-wrt854g' => 'Linksys WRT854G FW' ],
35 + [ 'maxgate-ugate3x00' => 'MaxGate UGATE-3x00 FW' ],
36 + [ 'netcomm-nb3' => 'NetComm NB3' ],
37 + [ 'netgear-dg834g' => 'netgear-dg834g' ],
38 + [ 'netgear-rp614' => 'Netgear RP614 FW' ],
39 + [ 'netgear-rt3xx' => 'Netgear FW' ],
40 + [ 'netgear-wgt624' => 'Netgear WGT624' ],
41 + [ 'netgear-wpn824' => 'Netgear WPN824 FW' ],
42 + [ 'netopia-r910' => 'Netopia R910 FW' ],
43 + [ 'olitec-SX200' => 'olitec-SX200' ],
44 + [ 'rtp300' => 'Linksys RTP300' ],
45 + [ 'siemens-ss4200' => 'Siemens SpeedStream 4200' ],
46 + [ 'sitecom-dc202' => 'Sitecom DC-202 FW' ],
47 + [ 'smc-barricade' => 'SMC Barricade FW' ],
48 + [ 'smc-barricade-7004vbr' => 'SMC Barricade FW (7004VBR model config)' ],
49 + [ 'smc-barricade-7401bra' => 'SMC Barricade 7401BRA FW' ],
50 + [ 'smc-barricade-alt' => 'SMC Barricade FW (alternate config)' ],
51 + [ 'sohoware-nbg800' => 'SOHOWare BroadGuard NBG800' ],
52 + [ 'sveasoft' => 'Sveasoft WRT54G/WRT54GS' ],
53 + [ 'thomson-st536v6' => 'Thomson SpeedTouch 536v6' ],
54 + [ 'thomson-tg782' => 'Thomson/Technicolor TG782' ],
55 + [ 'vigor-2200usb' => 'Vigor 2200 USB' ],
56 + [ 'watchguard-edge-x' => 'Watchguard Edge X FW' ],
57 + [ 'watchguard-soho' => 'Watchguard SOHO FW' ],
58 + [ 'westell-6100' => 'Westell C90-610015-06 DSL Router' ],
59 + [ 'xsense-aero' => 'Xsense Aero']
60 + ] );
61 + return $devices;
62 +
63 +
64 + # Automatic loading of the devices from the ddclient program - I can't get this to pass the results successfully to the template
65 + #my $output = `ddclient -list-devices`; # Run ddclient command to get devices output
66 + #my @lines;
67 + #foreach my $line (split /\n/, $output) {
68 + #$line =~ s/\s+//; # Remove leading whitespace
69 + #my ($field1, $field2) = split(' ', $line, 2);
70 + #push @lines, [$field2, $field1];
71 + #}
72 + #return \@lines; # Return a reference to the lines array
73 +}
74 +
75 +sub get_web_services_names {
76 + #
77 + # Web Services from which it can get ip address
78 + #
79 + my $webservices = ( [
80 + [ 'dyndnshttp://checkip.dyndns.org/' => 'dyndns' ],
81 + [ 'freednshttps://freedns.afraid.org/dynamic/check.php' => 'freedns' ],
82 + [ 'googledomainshttps://domains.google.com/checkip' => 'googledomains' ],
83 + [ 'hehttps://checkip.dns.he.net/' => 'he' ],
84 + [ 'ip4only.mehttps://ip4only.me/api/' => 'ip4only.me' ],
85 + [ 'ip6only.mehttps://ip6only.me/api/' => 'ip6only.me' ],
86 + [ 'ipify-ipv4https://api.ipify.org/' => 'ipify-ipv4' ],
87 + [ 'ipify-ipv6https://api6.ipify.org/' => 'ipify-ipv6' ],
88 + [ 'loopiahttps://dns.loopia.se/checkip/checkip.php' => 'loopia' ],
89 + [ 'myonlineportalhttps://myonlineportal.net/checkip' => 'myonlineportal' ],
90 + [ 'noip-ipv4http://ip1.dynupdate.no-ip.com/' => 'noip-ipv4' ],
91 + [ 'noip-ipv6http://ip1.dynupdate6.no-ip.com/' => 'noip-ipv6' ],
92 + [ 'nsupdate.info-ipv4https://ipv4.nsupdate.info/myip' => 'nsupdate.info-ipv4' ],
93 + [ 'nsupdate.info-ipv6https://ipv6.nsupdate.info/myip' => 'nsupdate.info-ipv6' ],
94 + [ 'zoneedithttps://dynamic.zoneedit.com/checkip.html' => 'zoneedit' ]
95 + ] );
96 + return $webservices
97 +
98 + #my $output = `ddclient -list-web-services`; # Run ddclient command to get web services output
99 + #my @lines;
100 + #foreach my $line (split /\n/, $output) {
101 + #$line =~ s/\s+//; # Remove leading whitespace
102 + #my ($field1, $field2) = split(' ', $line, 2);
103 + #push @lines, [$field2, $field1];
104 + #}
105 + #return \@lines; # Return a reference to the lines array
106 +}
107 +
108 sub get_dns_labels {
109 #
110 # dns service names
111 + # Return array with translated results as well.
112 + #
113 + # Note that "new" ones willl not have any description / translation, this can be added to /usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient
114 #
115 my $c = shift;
116 - my $Labels = (
117 + my $dnsservices = ( [
118 + [ $c->l('1984') => '1984' ],
119 + [ $c->l('changeip') => 'changeip' ],
120 + [ $c->l('cloudflare') => 'cloudflare' ],
121 + [ $c->l('cloudns') => 'cloudns' ],
122 + [ $c->l('digitalocean') => 'digitalocean' ],
123 + [ $c->l('dinahosting') => 'dinahosting' ],
124 + [ $c->l('dnsexit') => 'dnsexit' ],
125 + [ $c->l('dnsmadeeasy') => 'dnsmadeeasy' ],
126 + [ $c->l('domeneshop') => 'domeneshop' ],
127 + [ $c->l('dondominio') => 'dondominio' ],
128 + [ $c->l('dslreports') => 'dslreports' ],
129 + [ $c->l('duckdns') => 'duckdns' ],
130 + [ $c->l('dyndns1') => 'dyndns1' ],
131 + [ $c->l('dyndns2') => 'dyndns2' ],
132 + [ $c->l('easydns') => 'easydns' ],
133 + [ $c->l('enom') => 'enom' ],
134 + [ $c->l('freedns') => 'freedns' ],
135 + [ $c->l('freemyip') => 'freemyip' ],
136 + [ $c->l('gandi') => 'gandi' ],
137 + [ $c->l('godaddy') => 'godaddy' ],
138 + [ $c->l('googledomains') => 'googledomains' ],
139 + [ $c->l('hetzner') => 'hetzner' ],
140 + [ $c->l('infomaniak') => 'infomaniak' ],
141 + [ $c->l('keysystems') => 'keysystems' ],
142 + [ $c->l('mythicdyn') => 'mythicdyn' ],
143 + [ $c->l('namecheap') => 'namecheap' ],
144 + [ $c->l('nfsn') => 'nfsn' ],
145 + [ $c->l('njalla') => 'njalla' ],
146 + [ $c->l('noip') => 'noip' ],
147 + [ $c->l('nsupdate') => 'nsupdate' ],
148 + [ $c->l('ovh') => 'ovh' ],
149 + [ $c->l('porkbun') => 'porkbun' ],
150 + [ $c->l('regfishde') => 'regfishde' ],
151 + [ $c->l('sitelutions') => 'sitelutions' ],
152 + [ $c->l('woima') => 'woima' ],
153 + [ $c->l('yandex') => 'yandex' ],
154 + [ $c->l('zoneedit') => 'zoneedit' ]
155 + ] );
156 + return $dnsservices;
157
158 - # v3.11.1 labels
159 - [
160 - [$c->l('1984') '1984'],
161 - [$c->l('changeip') 'changeip'],
162 - [$c->l('cloudflare') 'cloudflare'],
163 - [$c->l('cloudns') 'cloudns'],,
164 - [$c->l('digitalocean') 'digitalocean'],
165 - [$c->l('dinahosting') 'dinahosting'],
166 - [$c->l('dnsexit2') 'dnsexit2'],
167 - [$c->l('dnsmadeeasy') 'dnsmadeeasy'],
168 - [$c->l('domeneshop') 'domeneshop'],
169 - [$c->l('dondominio') 'dondominio'],
170 - [$c->l('dslreports1') 'dslreports1'],
171 - [$c->l('duckdns') 'duckdns'],
172 - [$c->l('dyndns1') 'dyndns1'],
173 - [$c->l('dyndns2') 'dyndns2'],
174 - [$c->l('easydns') 'easydns'],
175 - [$c->l('enom') 'enom'],
176 - [$c->l('freedns') 'freedns'],
177 - [$c->l('freemyip') 'freemyip'],
178 - [$c->l('gandi') 'gandi'],
179 - [$c->l('godaddy') 'godaddy'],
180 - [$c->l('googledomains') 'googledomains'],
181 - [$c->l('hetzner') 'hetzner'],
182 - [$c->l('infomaniak') 'infomaniak'],
183 - [$c->l('keysystems') 'keysystems'],
184 - [$c->l('mythicdyn') 'mythicdyn'],
185 - [$c->l('namecheap') 'namecheap'],
186 - [$c->l('nfsn') 'nfsn'],
187 - [$c->l('njalla') 'njalla'],
188 - [$c->l('noip') 'noip'],
189 - [$c->l('nsupdate') 'nsupdate'],
190 - [$c->l('ovh') 'ovh'],
191 - [$c->l('porkbun') 'porkbun'],
192 - [$c->l('regfishde') 'regfishde'],
193 - [$c->l('sitelutions') 'sitelutions'],
194 - [$c->l('woima') 'woima'],
195 - [$c->l('yandex') 'yandex'],
196 - [$c->l('zoneedit1') 'zoneedit1']
197 - ]
198 - # end of v3.11.1 labels
199 -
200 -
201 - #[ [ $c->l('CUSTOMDNS'), 'CUSTOMDNS' ],
202 + #my $output = `ddclient -list-protocols`; # Run ddclient command and capture the output
203 + #my @protocols;
204 + #foreach my $line (split /\n/, $output) {
205 + #my ($protocol) = $line =~ /\s*(\S+)/;
206 + #next unless $protocol; # Skip if protocol is empty or contains only whitespace
207 + #my $custom_value = "$protocol.$c->l($protocol)"; # Additional column value using $c->l(protocol)
208 + #push @protocols, [$custom_value, $protocol];
209 + #}
210 + #return \@protocols; # Return a reference to the protocols array
211 +}
212 +
213 +# Pre 3.11.1 dns services
214 + #[ [ $c->l('CUSTOMDNS'), 'CUSTOMDNS' ],
215 #[ $c->l('DYNDNS1'), 'DYNDNS1' ],
216 #[ $c->l('DYNDNS2'), 'DYNDNS2' ],
217 #[ $c->l('DYNDNS3'), 'DYNDNS3' ],
218 @@ -196,9 +307,6 @@
219 #[ $c->l('OVH'), 'OVH' ],
220 #[ $c->l('CLOUDNS'), 'CLOUDNS' ]
221 #]
222 - );
223 - return $Labels;
224 -}
225
226 sub main {
227 #
228 @@ -230,13 +338,15 @@
229 my $emptycust = ( scalar @FreeDomains == 0 );
230
231 my $Labels = (
232 - [ [ $c->l('SME external Interface'), "smeIF" ],
233 - [ $c->l('SME configuration DB'), "smeCMD" ],
234 - [ $c->l('web'), "web" ],
235 - [ $c->l('Interface'), "if" ],
236 - [ $c->l('IP'), "ip" ],
237 - [ $c->l('Command'), "cmd" ]
238 - ]
239 + [
240 + [ $c->l('SME external Interface') => "smeIF" ],
241 + [ $c->l('SME configuration DB') => 'smeCMD' ],
242 + [ $c->l('web') => 'web' ],
243 + [ $c->l('router') => 'router' ],
244 + [ $c->l('Interface') => 'if' ],
245 + [ $c->l('IP') => 'ip' ],
246 + [ $c->l('Command') => 'cmd' ]
247 + ]
248 );
249
250 $c->stash(
251 @@ -246,6 +356,9 @@
252 domains => \@domains,
253 freedomains => \@FreeDomains,
254 methodlabels => $Labels,
255 + dnslabels => get_dns_labels($c),
256 + devices => get_devices_names($c),
257 + webservices => get_web_services_names($c),
258 emptydom => $emptydom,
259 emptycust => $emptycust
260 );
261 @@ -260,6 +373,7 @@
262 # Called to update the parameters relating to the Ip address of the server
263 #
264 my $c = shift;
265 + $ddc_datas{"first"} = '';
266 $ddc_datas{"success"} = pushParams($c);
267 do_display($c);
268 }
269 @@ -269,6 +383,7 @@
270 #Called to update/delete the ddclient for a specific inbuilt domain
271 #
272 my $c = shift;
273 + my $title = $c->l("MODIFY_TITLE");
274 my $retmsg;
275 if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
276 $retmsg = performModifyCustom($c);
277 @@ -276,10 +391,11 @@
278 else {
279 $retmsg = performModifyDomain($c);
280 }
281 + $ddc_datas{"first"} = '';
282 if ( $retmsg eq "ok" ) {
283 my $dns = $c->param('dns');
284 my $domain = $c->param('domainname');
285 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain,
286 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_MODIFIED", $domain,
287 $c->l( '' . $dns ) );
288 do_display( $c, %ddc_datas );
289 }
290 @@ -296,7 +412,7 @@
291 # Create custom domain
292 #
293 my $c = shift;
294 - my $title = $c->l("ddc_CREATE_TITLE");
295 + my $title = $c->l("CREATE_TITLE");
296 my $modul = '';
297 my $trt = "NEW";
298
299 @@ -305,18 +421,21 @@
300 title => $title,
301 modul => $modul,
302 ddc_datas => \%ddc_datas,
303 - dnslabels => get_dns_labels($c)
304 + dnslabels => get_dns_labels($c),
305 + devices => get_devices_names($c),
306 + webservices => get_web_services_names($c)
307 );
308 $c->render( template => 'ddclient' );
309 }
310
311 sub do_create_custom_actual {
312 my $c = shift;
313 + $ddc_datas{"first"} = '';
314 my $retmsg = performCreateCustom($c);
315 if ( $retmsg eq "ok" ) {
316 my $dns = $c->param('dns');
317 my $domain = $c->param('domainname');
318 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain,
319 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain,
320 $c->l( '' . $dns ) );
321 do_display( $c, %ddc_datas );
322 }
323 @@ -334,7 +453,7 @@
324 # Display delete or modify panel for custom domain
325 #
326 my $c = shift;
327 - my $title = $c->l("ddc_MODIFY_TITLE");
328 + my $title = $c->l("MODIFY_TITLE");
329 my $modul = '';
330 my $trt = $c->param("trt");
331
332 @@ -349,7 +468,9 @@
333 title => $title,
334 modul => $modul,
335 ddc_datas => \%ddc_datas,
336 - dnslabels => get_dns_labels($c)
337 + dnslabels => get_dns_labels($c),
338 + devices => get_devices_names($c),
339 + webservices => get_web_services_names($c)
340 );
341 $c->render( template => 'ddclient' );
342 }
343 @@ -360,21 +481,23 @@
344 # param trt = MOD or DEL
345 #
346 my $c = shift;
347 - my $title = $c->l("ddc_MODIFY_TITLE");
348 + my $title = $c->l("MODIFY_TITLE");
349 my $modul = '';
350 my $trt = $c->param("trt");
351
352 #Extract domain stuff from DB
353 my @results
354 = get_domain_table( $c, $c->param("Domain") ); #Returns just one row
355 - $ddc_datas{"Domain_details"} = $results[0];
356
357 + $ddc_datas{"Domain_details"} = $results[0];
358 $ddc_datas{'trt'} = $trt;
359 $c->stash(
360 title => $title,
361 modul => $modul,
362 ddc_datas => \%ddc_datas,
363 - dnslabels => get_dns_labels($c)
364 + dnslabels => get_dns_labels($c),
365 + devices => get_devices_names($c),
366 + webservices => get_web_services_names($c)
367 );
368 $c->render( template => 'ddclient' );
369 }
370 @@ -386,10 +509,11 @@
371 #
372 my $c = shift;
373 my $route = $c->current_route;
374 - my $title = $c->l("ddc_REMOVE_TITLE");
375 + my $title = $c->l("REMOVE_TITLE");
376 my $modul = '';
377 my $retmsg = "";
378 my $domain = $c->param("Domain");
379 + $ddc_datas{"first"} = '';
380
381 #Delete it and return to front summary panel - depends on route domain or custom
382 if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
383 @@ -400,7 +524,7 @@
384 }
385
386 if ( $retmsg eq "ok" ) {
387 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain,
388 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain,
389 $c->l( '' . $c->param("dns") ) );
390 }
391 else { $ddc_datas{"error"} = $retmsg; }
392 @@ -415,15 +539,16 @@
393 #
394 my $c = shift;
395 my $route = $c->current_route;
396 - my $title = $c->l("ddc_REMOVE_TITLE");
397 + my $title = $c->l("REMOVE_TITLE");
398 my $modul = '';
399 my $retmsg = "";
400 my $domain = $c->param("Domain");
401 + $ddc_datas{"first"} = '';
402
403 #Delete it and return to front summary panel - depends on route domain or custom
404 $retmsg = performDeleteCustom( $c, $domain );
405 if ( $retmsg eq "ok" ) {
406 - $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain );
407 + $ddc_datas{"success"} = $c->l( "SUCCESSFULLY_DELETED", $domain );
408 }
409 else { $ddc_datas{"error"} = $retmsg; }
410 do_display( $c, %ddc_datas );
411 @@ -588,6 +713,8 @@
412 my $retrieveinterface = $c->param('retrieveinterface');
413 my $retrievecmd = $c->param('retrievecmd');
414 my $retrieveip = $c->param('retrieveip');
415 +
416 + #print 1 / 0; #Crash
417
418 my $ddclient = $db->get('ddclient');
419 $ddclient->set_prop( 'urlcheckip' => $urlcheckip );
420 @@ -616,7 +743,7 @@
421 #------------------------------------------------------------
422
423 my $domainName = $c->param('domainName');
424 - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
425 + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
426 $domainName = $1;
427 }
428 else {
429 @@ -624,7 +751,7 @@
430 }
431
432 my $domainLogin = $c->param('login');
433 - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
434 + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
435 $domainLogin = $1;
436 }
437 else {
438 @@ -632,7 +759,7 @@
439 }
440
441 my $domainPassword = $c->param('password');
442 - if ( $domainPassword =~ /^(.*)$/ ) {
443 + if ( $domainPassword =~ /(.*)$/ ) {
444 $domainPassword = $1;
445 }
446 else {
447 @@ -646,7 +773,7 @@
448
449 my $dns = $c->param('dns');
450 if ( $dns eq 'CUSTOMDNS' ) {
451 - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
452 + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
453 $customDNS = $1;
454 }
455 else
456 @@ -685,7 +812,7 @@
457 # Attempt to delete domain
458 #------------------------------------------------------------
459
460 - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
461 + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) {
462 $domain = $1;
463 }
464 else {
465 @@ -726,7 +853,7 @@
466 #------------------------------------------------------------
467
468 my $domainName = $c->param('domainName');
469 - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
470 + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
471 $domainName = $1;
472 }
473 else {
474 @@ -749,7 +876,7 @@
475
476 my $domainDesc = $c->param('desc');
477 my $domainLogin = $c->param('login');
478 - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
479 + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
480 $domainLogin = $1;
481 }
482 else {
483 @@ -757,7 +884,7 @@
484 }
485
486 my $domainPassword = $c->param('password');
487 - if ( $domainPassword =~ /^(.*)$/ ) {
488 + if ( $domainPassword =~ /(.*)$/ ) {
489 $domainPassword = $1;
490 }
491 else {
492 @@ -771,7 +898,7 @@
493
494 my $dns = $c->param('dns');
495 if ( $dns eq 'CUSTOMDNS' ) {
496 - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
497 + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
498 $customDNS = $1;
499 }
500 else {
501 @@ -809,7 +936,7 @@
502 #------------------------------------------------------------
503
504 my $domainName = $c->param('domainName');
505 - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
506 + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
507 $domainName = $1;
508 }
509 else {
510 @@ -817,7 +944,7 @@
511 }
512
513 my $domainLogin = $c->param('login');
514 - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
515 + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
516 $domainLogin = $1;
517 }
518 else {
519 @@ -825,7 +952,7 @@
520 }
521
522 my $domainPassword = $c->param('password');
523 - if ( $domainPassword =~ /^(.*)$/ ) {
524 + if ( $domainPassword =~ /(.*)$/ ) {
525 $domainPassword = $1;
526 }
527 else {
528 @@ -839,7 +966,7 @@
529
530 my $dns = $c->param('dns');
531 if ( $dns eq 'CUSTOMDNS' ) {
532 - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
533 + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
534 $customDNS = $1;
535 }
536 else
537 @@ -878,7 +1005,7 @@
538 # Attempt to delete domain
539 #------------------------------------------------------------
540
541 - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
542 + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) {
543 $domain = $1;
544 }
545 else {
546 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
547 --- 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
548 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2023-12-01 16:35:00.000000000 +0000
549 @@ -80,7 +80,7 @@
550 'CLOUDNS'=>'CLOUDNS www.cloudns.net',
551 # End of Service descriptions
552
553 -# v3.11.1 Service descriptions:
554 +# v3.11.x Service descriptions:
555 "1984" => "https://kb.1984hosting.com/doku.php?id=freedns",
556 "changeip" => "https://changeip.com",
557 "cloudflare" => "https://cloudflare.com",
558 @@ -118,7 +118,7 @@
559 "woima" => "http://woima.com",
560 "yandex" => "https://yandex.com",
561 "zoneedit" => "https://www.zoneedit.com/dynamic-dns/",
562 -# end of v3.11.1 Service descriptions:
563 +# end of v3.11.x Service descriptions:
564
565 'CUSTOMDNS' => 'Custom Dynamic DNS Provider',
566 'CUSTOMDNS_LABEL' => 'Custom server Address',
567 @@ -136,8 +136,8 @@
568 'DESCRIPTION_LABEL' => 'Domain description',
569 'SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.',
570 'RETRIEVE_METHOD' => 'Method to retrieve new IP:',
571 -'RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method',
572 -'RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method',
573 +'RETRIEVE_IF' => 'Local interface to get new IP',
574 +'RETRIEVE_CMD' => 'Command to execute to get IP',
575 'SME external Interface' => 'SME external interface',
576 'SME configuration DB' => 'SME configuration DB',
577 'web' => 'Web query',
578 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
579 --- 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
580 +++ 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
581 @@ -1,6 +1,6 @@
582 <div id='ddc_createcustom'>
583 <h2>
584 - %= l 'ddc_CUSTOM_DESCRIPTION'
585 + %= l 'CUSTOM_DESCRIPTION'
586 </h2><br>
587 % my $btn = l('ddc_APPLY');
588 %= form_for '/ddclient7' => (method => 'POST') => begin
589 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
590 --- 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
591 +++ 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
592 @@ -1,4 +1,9 @@
593 <div id='modifydomain'>
594 + <script>
595 + window.onload = function() {
596 + SelectInput();
597 + };
598 + </script>
599 <h2>
600 %= l 'CUSTOM_DESCRIPTION'
601 </h2><br>
602 @@ -24,20 +29,41 @@
603 %=l 'SERVERS_LABEL'
604 </span><span class=data>
605 % param dns=>$ddc_datas->{"Domain_details"}->{"dns"};
606 - %=select_field dns=>$dnslabels
607 + %=select_field dns=>$dnslabels,id=>"dns",onchange=>"SelectInput()",onload=>"SelectInput()"
608 + %= javascript begin
609 + function SelectInput() {
610 + var method = document.querySelector("#dns");
611 + const types=['custom'];
612 + types.forEach((type)=>{
613 + var service = document.querySelector(`.${type}`);
614 + if (service != null) {
615 + if (method.value == type) {
616 + service.style.display = 'block';
617 + } else {
618 + service.style.display = 'none';
619 + }
620 + }
621 + })
622 + }
623 + %end
624 </span><br>
625 - <span class=label>
626 +
627 + %# Dependant on the custom choice from above
628 + <div class=custom>
629 + <span class=label custom>
630 %=l 'CUSTOMDNS_LABEL'
631 - </span><span class=data>
632 + </span><span class=data custom>
633 % param customdns=>$ddc_datas->{"Domain_details"}->{"customdns"};
634 %=text_field 'customdns'
635 </span><br>
636 - <span class=label>
637 + <span class=label custom>
638 %=l 'CUSTOM_PROTOCOL_LABEL'
639 - </span><span class=data>
640 + </span><span class=data custom>
641 % param customprotocol=>$ddc_datas->{"Domain_details"}->{"customprotocol"};
642 %=text_field 'customprotocol'
643 </span><br>
644 + </div>
645 +
646 <span class=label>
647 %=l 'NAME_LABEL'
648 </span><span class=data>
649 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
650 --- 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
651 +++ 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
652 @@ -1,4 +1,9 @@
653 <div id='paramlist'>
654 + <script>
655 + window.onload = function() {
656 + SelectInput();
657 + };
658 + </script>
659 <h2>
660 %= l 'Params_for_IP_Retrieval'
661 </h2>
662 @@ -7,11 +12,11 @@
663 <span class=label>
664 %=l 'RETRIEVE_SSL'
665 </span><span class=data>
666 - % param retrievessl=>$ddc_datas->{"params"}->{"ssl"};
667 + % param retrievessl=>$ddc_datas->{"params"}->{"ssl"} unless param 'retrievessl';
668 %=select_field retrievessl=>[['Yes'=>'yes'],['No'=>'no']]
669 </span><br>
670 <span class=label>
671 - %=l 'RETRIEVE_DEAMONUPDATE'
672 + %=l 'RETRIEVE_DEAMONUPDATE'
673 </span><span class=data>
674 % param retrievedeamonupdate=>$ddc_datas->{"params"}->{"DeamonUpdate"};
675 %=number_field 'retrievedeamonupdate',min=>0
676 @@ -19,33 +24,88 @@
677 <span class=label>
678 %=l 'RETRIEVE_METHOD'
679 </span><span class=data>
680 - % param retrievemethod=>$ddc_datas->{"params"}->{"method"};
681 - %=select_field retrievemethod=>$methodlabels
682 - </span><br>
683 - <span class=label>
684 + % param retrievemethod=>$ddc_datas->{"params"}->{"method"} unless param 'retrievemethod';
685 + %=select_field retrievemethod=>$methodlabels,id=>"retrievemethod",onchange=>"SelectInput()"
686 + %= javascript begin
687 + function SelectInput() {
688 + var method = document.querySelector("#retrievemethod");
689 + const types=['smeIF','smeCMD','web','router','if','ip','cmd','custom'];
690 + types.forEach((type)=>{
691 + var service = document.querySelector(`.${type}`);
692 + if (service != null) {
693 + if (method.value == type) {
694 + service.style.display = 'block';
695 + } else {
696 + service.style.display = 'none';
697 + }
698 + }
699 + })
700 + }
701 + % end
702 + </span><br>
703 + %#
704 + %# From here the one that is shown depends on the choice above
705 + %#
706 + <div class = smeIF></div>
707 + <div class = smeIF></div>
708 + %# Only if "router" is chosen
709 + <div class = router>
710 + <span class=label>
711 + %=l 'Router type'
712 + </span><span class=data>
713 + % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieveinterface';
714 + %=select_field retrieveinterface=>$devices
715 + </span><br>
716 + </div>
717 +
718 + %# Only if "web" is chosen"
719 + <div class = web>
720 + <span class=label>
721 + %=l 'Web service'
722 + </span><span class=data>
723 + % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrieveurlcheckip';
724 + %=select_field retrieveurlcheckip=>$dnslabels
725 + </div>
726 +
727 + %# Only if "Interface" is chosen
728 + <div class=if>
729 + <span class=label Interface>
730 %=l 'RETRIEVE_IF'
731 - </span><span class=data>
732 - % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"};
733 + </span><span class=data Interface>
734 + % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieveinterface';
735 %=text_field 'retrieveinterface'
736 </span><br>
737 - <span class=label>
738 + </div>
739 +
740 + %# Only if "cmd" is chosen
741 + <div class=cmd>
742 + <span class=label cmd>
743 %=l 'RETRIEVE_CMD'
744 - </span><span class=data>
745 - % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"};
746 + </span><span class=data cmd>
747 + % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"} unless param 'retrievecmd';
748 %=text_field 'retrievecmd'
749 </span><br>
750 - <span class=label>
751 + </div>
752 +
753 + %# Only if "ip" is chosen
754 + <div class=ip>
755 + <span class=label ip>
756 %=l 'RETRIEVE_IP'
757 - </span><span class=data>
758 - % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"};
759 + </span><span class=data ip>
760 + % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"} unless param 'retrieveip';
761 %=text_field 'retrieveip'
762 </span><br>
763 - <span class=label>
764 + </div>
765 +
766 + %# Only if "custom web service"
767 + <div class=custom>
768 + <span class=label customweb>
769 %=l 'RETRIEVE_URLCHECKIP'
770 - </span><span class=data>
771 - % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"};
772 + </span><span class=data customweb>
773 + % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrieveurlcheckip';
774 %=text_field 'retrieveurlcheckip'
775 </span><br>
776 + </div>
777
778 %= submit_button "$btn", class => 'action'
779 % end

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