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

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