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

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