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

Annotation 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.3 - (hide annotations) (download)
Mon Dec 4 15:19:27 2023 UTC (5 months, 1 week ago) by brianr
Branch: MAIN
Changes since 1.2: +298 -175 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 brianr 1.3 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 brianr 1.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
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 brianr 1.3 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2023-12-04 14:53:00.000000000 +0000
20     @@ -114,90 +114,164 @@
21 brianr 1.1
22     my %ddc_datas = ();
23    
24     +sub get_devices_names {
25     + #
26 brianr 1.3 + # Router/Firewall devices from which it can get ip address
27 brianr 1.1 + #
28     + my $devices = ( [
29 brianr 1.2 + [ '2wire' => '2Wire 1701HG Gateway' ],
30     + [ '3com-3c886a' => '3com 3c886a 56k Lan Modem' ],
31     + [ '3com-oc-remote812' => '3com OfficeConnect Remote 812' ],
32     + [ 'alcatel-510' => 'Alcatel Speed Touch 510' ],
33     + [ 'alcatel-530' => 'Alcatel/Thomson SpeedTouch 530' ],
34     + [ 'alcatel-stp' => 'Alcatel Speed Touch Pro' ],
35     + [ 'allnet-1298' => 'Allnet 1298' ],
36     + [ 'cayman-3220h' => 'Cayman 3220-H DSL' ],
37     + [ 'dlink-524' => 'D-Link DI-524' ],
38     + [ 'dlink-604' => 'D-Link DI-604' ],
39 brianr 1.3 + [ 'D-Link DI-614+' => 'dlink-614' ],
40     + [ 'E-tech Router' => 'e-tech' ],
41     + [ 'ELSA LanCom DSL/10 DSL FW' => 'elsa-lancom-dsl10' ],
42     + [ 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' => 'elsa-lancom-dsl10-ch01' ],
43     + [ 'ELSA LanCom DSL/10 DSL FW (isdn ch01)' => 'elsa-lancom-dsl10-ch02' ],
44     + [ 'Linksys FW' => 'linksys' ],
45     + [ 'Linksys RV042 Dual Homed Router WAN Port 2' => 'linksys-rv042-wan1' ],
46     + [ 'Linksys RV042 Dual Homed Router WAN Port 2' => 'linksys-rv042-wan2' ],
47     + [ 'Linksys FW version 2' => 'linksys-ver2' ],
48     + [ 'Linksys FW version 3' => 'linksys-ver3' ],
49     + [ 'Linksys WCG200 FW' => 'linksys-wcg200' ],
50     + [ 'Linksys WRT854G FW' => 'linksys-wrt854g' ],
51     + [ 'MaxGate UGATE-3x00 FW' => 'maxgate-ugate3x00' ],
52     + [ 'NetComm NB3' => 'netcomm-nb3' ],
53 brianr 1.2 + [ 'netgear-dg834g' => 'netgear-dg834g' ],
54 brianr 1.3 + [ 'Netgear RP614 FW' => 'netgear-rp614' ],
55     + [ 'Netgear FW' => 'netgear-rt3xx' ],
56     + [ 'Netgear WGT624' => 'netgear-wgt624' ],
57     + [ 'Netgear WPN824 FW' => 'netgear-wpn824' ],
58     + [ 'Netopia R910 FW' => 'netopia-r910' ],
59 brianr 1.2 + [ 'olitec-SX200' => 'olitec-SX200' ],
60 brianr 1.3 + [ 'Linksys RTP300' => 'rtp300' ],
61     + [ 'Siemens SpeedStream 4200' => 'siemens-ss4200' ],
62     + [ 'Sitecom DC-202 FW' => 'sitecom-dc202' ],
63     + [ 'SMC Barricade FW' => 'smc-barricade' ],
64     + [ 'SMC Barricade FW (7004VBR model config)' => 'smc-barricade-7004vbr' ],
65     + [ 'SMC Barricade 7401BRA FW' => 'smc-barricade-7401bra' ],
66     + [ 'SMC Barricade FW (alternate config)' => 'smc-barricade-alt' ],
67     + [ 'SOHOWare BroadGuard NBG800' => 'sohoware-nbg800' ],
68     + [ 'Sveasoft WRT54G/WRT54GS' => 'sveasoft' ],
69     + [ 'Thomson SpeedTouch 536v6' => 'thomson-st536v6' ],
70     + [ 'Thomson/Technicolor TG782' => 'thomson-tg782' ],
71     + [ 'Vigor 2200 USB' => 'vigor-2200usb' ],
72     + [ 'Watchguard Edge X FW' => 'watchguard-edge-x' ],
73     + [ 'Watchguard SOHO FW' => 'watchguard-soho' ],
74     + [ 'Westell C90-610015-06 DSL Router' => 'westell-6100' ],
75     + [ 'Xsense Aero' => 'xsense-aero' ]
76 brianr 1.1 + ] );
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 brianr 1.2 + [ '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 brianr 1.1 + ] );
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 brianr 1.3 -
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 brianr 1.2 + 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 brianr 1.1 - #[ [ $c->l('CUSTOMDNS'), 'CUSTOMDNS' ],
218 brianr 1.3 - #[ $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 brianr 1.1 + #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 brianr 1.3 }
261 brianr 1.1
262     sub main {
263 brianr 1.3 @@ -230,13 +304,15 @@
264 brianr 1.2 my $emptycust = ( scalar @FreeDomains == 0 );
265 brianr 1.1
266     my $Labels = (
267 brianr 1.2 - [ [ $c->l('SME external Interface'), "smeIF" ],
268 brianr 1.1 - [ $c->l('SME configuration DB'), "smeCMD" ],
269 brianr 1.2 - [ $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 brianr 1.3 + [ $c->l('Router/Firewall') => 'router' ],
279 brianr 1.2 + [ $c->l('Interface') => 'if' ],
280     + [ $c->l('IP') => 'ip' ],
281     + [ $c->l('Command') => 'cmd' ]
282     + ]
283     );
284    
285     $c->stash(
286 brianr 1.3 @@ -246,6 +322,9 @@
287 brianr 1.1 domains => \@domains,
288     freedomains => \@FreeDomains,
289     methodlabels => $Labels,
290 brianr 1.2 + dnslabels => get_dns_labels($c),
291 brianr 1.1 + devices => get_devices_names($c),
292     + webservices => get_web_services_names($c),
293     emptydom => $emptydom,
294     emptycust => $emptycust
295     );
296 brianr 1.3 @@ -260,6 +339,7 @@
297 brianr 1.2 # 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 brianr 1.3 @@ -269,6 +349,7 @@
305 brianr 1.1 #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 brianr 1.3 @@ -276,10 +357,11 @@
313 brianr 1.2 else {
314     $retmsg = performModifyDomain($c);
315     }
316     + $ddc_datas{"first"} = '';
317 brianr 1.1 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 brianr 1.3 @@ -296,7 +378,7 @@
326 brianr 1.1 # 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 brianr 1.3 @@ -305,18 +387,21 @@
335 brianr 1.1 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 brianr 1.2
346     sub do_create_custom_actual {
347     my $c = shift;
348     + $ddc_datas{"first"} = '';
349     my $retmsg = performCreateCustom($c);
350 brianr 1.1 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 brianr 1.3 @@ -334,7 +419,7 @@
359 brianr 1.1 # 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 brianr 1.3 @@ -349,7 +434,9 @@
368 brianr 1.1 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 brianr 1.3 @@ -360,21 +447,23 @@
379 brianr 1.1 # 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 brianr 1.3 @@ -386,10 +475,11 @@
406 brianr 1.1 #
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 brianr 1.2 + $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 brianr 1.3 @@ -400,7 +490,7 @@
419 brianr 1.1 }
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 brianr 1.3 @@ -415,15 +505,16 @@
428 brianr 1.1 #
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 brianr 1.2 + $ddc_datas{"first"} = '';
437    
438 brianr 1.1 #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 brianr 1.3 @@ -567,6 +658,8 @@
447     my $Extinterface = $ddretrieve->prop('Extinterface') || '';
448     my $cmd = $ddretrieve->prop('cmd') || '';
449     my $forceIP = $ddretrieve->prop('ForceIP') || '';
450     + my $fwlogin = $ddretrieve->prop('fwlogin') || '';
451     + my $fwpassword = $ddretrieve->prop('fwpassword') || '';
452     my $res = {
453     "ssl" => $ssl,
454     "DeamonUpdate" => $DeamonUpdate,
455     @@ -574,29 +667,43 @@
456     "Extinterface" => $Extinterface,
457     "cmd" => $cmd,
458     "ForceIP" => $forceIP,
459     - "urlcheckip" => $urlcheckip
460     + "urlcheckip" => $urlcheckip,
461     + "FWlogin" => $fwlogin,
462     + "FWpassword" => $fwpassword
463     };
464     return $res;
465     }
466    
467     sub pushParams {
468     my $c = shift;
469     - my $DeamonUpdate = $c->param('retrievedeamonupdate');
470     - my $urlcheckip = $c->param('retrieveurlcheckip');
471     - my $ssl = $c->param('retrievessl');
472     + my $retrievedeamonupdate = $c->param('retrievedeamonupdate');
473     + my $retrieverouter = $c->param('retrieverouter');
474     + my $retrievewebservice = $c->param('retrievewebservice');
475     + my $retrieveurlcheckip = $c->param('retrieveurlcheckip');
476     + my $retrievessl = $c->param('retrievessl');
477     my $retrievemethod = $c->param('retrievemethod');
478 brianr 1.2 my $retrieveinterface = $c->param('retrieveinterface');
479     my $retrievecmd = $c->param('retrievecmd');
480     my $retrieveip = $c->param('retrieveip');
481 brianr 1.3 + my $retrievefwlogin = $c->param('retrieverouterlogin');
482     + my $retrievefwpassword = $c->param('retrieverouterpassword');
483 brianr 1.2 +
484     + #print 1 / 0; #Crash
485    
486     my $ddclient = $db->get('ddclient');
487 brianr 1.3 - $ddclient->set_prop( 'urlcheckip' => $urlcheckip );
488     - $ddclient->set_prop( 'DeamonUpdate' => $DeamonUpdate );
489     - $ddclient->set_prop( 'SSL' => $ssl );
490     + $ddclient->set_prop( 'urlcheckip' => $retrievewebservice || $retrieveurlcheckip );
491     + $ddclient->set_prop( 'DeamonUpdate' => $retrievedeamonupdate );
492     + $ddclient->set_prop( 'SSL' => $retrievessl );
493     $ddclient->set_prop( 'method' => $retrievemethod );
494     - $ddclient->set_prop( 'Extinterface' => $retrieveinterface );
495     + if ($retrievemethod eq 'router') {
496     + $ddclient->set_prop( 'Extinterface' => $retrieverouter );
497     + } else {
498     + $ddclient->set_prop( 'Extinterface' => $retrieveinterface );
499     + }
500     $ddclient->set_prop( 'cmd' => $retrievecmd );
501     $ddclient->set_prop( 'ForceIP' => $retrieveip );
502     + $ddclient->set_prop( 'fwlogin' => $retrievefwlogin );
503     + $ddclient->set_prop( 'fwpassword' => $retrievefwpassword );
504    
505     $domaindb->reload();
506    
507     @@ -616,7 +723,7 @@
508 brianr 1.1 #------------------------------------------------------------
509    
510     my $domainName = $c->param('domainName');
511     - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
512     + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
513     $domainName = $1;
514     }
515     else {
516 brianr 1.3 @@ -624,7 +731,7 @@
517 brianr 1.1 }
518    
519     my $domainLogin = $c->param('login');
520     - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
521     + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
522     $domainLogin = $1;
523     }
524     else {
525 brianr 1.3 @@ -632,7 +739,7 @@
526 brianr 1.1 }
527    
528     my $domainPassword = $c->param('password');
529     - if ( $domainPassword =~ /^(.*)$/ ) {
530     + if ( $domainPassword =~ /(.*)$/ ) {
531     $domainPassword = $1;
532     }
533     else {
534 brianr 1.3 @@ -646,7 +753,7 @@
535 brianr 1.1
536     my $dns = $c->param('dns');
537     if ( $dns eq 'CUSTOMDNS' ) {
538     - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
539     + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
540     $customDNS = $1;
541     }
542     else
543 brianr 1.3 @@ -685,7 +792,7 @@
544 brianr 1.1 # Attempt to delete domain
545     #------------------------------------------------------------
546    
547     - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
548     + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) {
549     $domain = $1;
550     }
551     else {
552 brianr 1.3 @@ -726,7 +833,7 @@
553 brianr 1.1 #------------------------------------------------------------
554    
555     my $domainName = $c->param('domainName');
556     - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
557     + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
558     $domainName = $1;
559     }
560     else {
561 brianr 1.3 @@ -749,7 +856,7 @@
562 brianr 1.1
563     my $domainDesc = $c->param('desc');
564     my $domainLogin = $c->param('login');
565     - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
566     + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
567     $domainLogin = $1;
568     }
569     else {
570 brianr 1.3 @@ -757,7 +864,7 @@
571 brianr 1.1 }
572    
573     my $domainPassword = $c->param('password');
574     - if ( $domainPassword =~ /^(.*)$/ ) {
575     + if ( $domainPassword =~ /(.*)$/ ) {
576     $domainPassword = $1;
577     }
578     else {
579 brianr 1.3 @@ -771,7 +878,7 @@
580 brianr 1.1
581     my $dns = $c->param('dns');
582     if ( $dns eq 'CUSTOMDNS' ) {
583     - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
584     + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
585     $customDNS = $1;
586     }
587     else {
588 brianr 1.3 @@ -809,7 +916,7 @@
589 brianr 1.1 #------------------------------------------------------------
590    
591     my $domainName = $c->param('domainName');
592     - if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
593     + if ( $domainName =~ /([a-zA-Z0-9\-\.]+)$/ ) {
594     $domainName = $1;
595     }
596     else {
597 brianr 1.3 @@ -817,7 +924,7 @@
598 brianr 1.1 }
599    
600     my $domainLogin = $c->param('login');
601     - if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
602     + if ( $domainLogin =~ /([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
603     $domainLogin = $1;
604     }
605     else {
606 brianr 1.3 @@ -825,7 +932,7 @@
607 brianr 1.1 }
608    
609     my $domainPassword = $c->param('password');
610     - if ( $domainPassword =~ /^(.*)$/ ) {
611     + if ( $domainPassword =~ /(.*)$/ ) {
612     $domainPassword = $1;
613     }
614     else {
615 brianr 1.3 @@ -839,7 +946,7 @@
616 brianr 1.1
617     my $dns = $c->param('dns');
618     if ( $dns eq 'CUSTOMDNS' ) {
619     - if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
620     + if ( $customDNS =~ /([a-zA-Z0-9\-\.]+)$/ ) {
621     $customDNS = $1;
622     }
623     else
624 brianr 1.3 @@ -878,7 +985,7 @@
625 brianr 1.1 # Attempt to delete domain
626     #------------------------------------------------------------
627    
628     - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
629     + if ( $domain =~ /([a-zA-Z0-9\-\.]+)$/ ) {
630     $domain = $1;
631     }
632     else {
633     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
634     --- 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
635 brianr 1.2 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2023-12-01 16:35:00.000000000 +0000
636     @@ -80,7 +80,7 @@
637     'CLOUDNS'=>'CLOUDNS www.cloudns.net',
638     # End of Service descriptions
639    
640     -# v3.11.1 Service descriptions:
641     +# v3.11.x Service descriptions:
642     "1984" => "https://kb.1984hosting.com/doku.php?id=freedns",
643     "changeip" => "https://changeip.com",
644     "cloudflare" => "https://cloudflare.com",
645     @@ -118,7 +118,7 @@
646     "woima" => "http://woima.com",
647     "yandex" => "https://yandex.com",
648     "zoneedit" => "https://www.zoneedit.com/dynamic-dns/",
649     -# end of v3.11.1 Service descriptions:
650     +# end of v3.11.x Service descriptions:
651    
652     'CUSTOMDNS' => 'Custom Dynamic DNS Provider',
653     'CUSTOMDNS_LABEL' => 'Custom server Address',
654 brianr 1.1 @@ -136,8 +136,8 @@
655     'DESCRIPTION_LABEL' => 'Domain description',
656     'SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.',
657     'RETRIEVE_METHOD' => 'Method to retrieve new IP:',
658     -'RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method',
659     -'RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method',
660     +'RETRIEVE_IF' => 'Local interface to get new IP',
661     +'RETRIEVE_CMD' => 'Command to execute to get IP',
662     'SME external Interface' => 'SME external interface',
663     'SME configuration DB' => 'SME configuration DB',
664     'web' => 'Web query',
665     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
666     --- 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
667     +++ 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
668     @@ -1,6 +1,6 @@
669     <div id='ddc_createcustom'>
670     <h2>
671     - %= l 'ddc_CUSTOM_DESCRIPTION'
672     + %= l 'CUSTOM_DESCRIPTION'
673     </h2><br>
674     % my $btn = l('ddc_APPLY');
675     %= form_for '/ddclient7' => (method => 'POST') => begin
676     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
677     --- 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
678     +++ 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
679     @@ -1,4 +1,9 @@
680     <div id='modifydomain'>
681     + <script>
682     + window.onload = function() {
683     + SelectInput();
684     + };
685     + </script>
686     <h2>
687     %= l 'CUSTOM_DESCRIPTION'
688     </h2><br>
689     @@ -24,20 +29,41 @@
690     %=l 'SERVERS_LABEL'
691     </span><span class=data>
692     % param dns=>$ddc_datas->{"Domain_details"}->{"dns"};
693     - %=select_field dns=>$dnslabels
694     + %=select_field dns=>$dnslabels,id=>"dns",onchange=>"SelectInput()",onload=>"SelectInput()"
695     + %= javascript begin
696     + function SelectInput() {
697     + var method = document.querySelector("#dns");
698     + const types=['custom'];
699     + types.forEach((type)=>{
700     + var service = document.querySelector(`.${type}`);
701     + if (service != null) {
702     + if (method.value == type) {
703     + service.style.display = 'block';
704     + } else {
705     + service.style.display = 'none';
706     + }
707     + }
708     + })
709     + }
710     + %end
711     </span><br>
712     - <span class=label>
713     +
714     + %# Dependant on the custom choice from above
715     + <div class=custom>
716     + <span class=label custom>
717     %=l 'CUSTOMDNS_LABEL'
718     - </span><span class=data>
719     + </span><span class=data custom>
720     % param customdns=>$ddc_datas->{"Domain_details"}->{"customdns"};
721     %=text_field 'customdns'
722     </span><br>
723     - <span class=label>
724     + <span class=label custom>
725     %=l 'CUSTOM_PROTOCOL_LABEL'
726     - </span><span class=data>
727     + </span><span class=data custom>
728     % param customprotocol=>$ddc_datas->{"Domain_details"}->{"customprotocol"};
729     %=text_field 'customprotocol'
730     </span><br>
731     + </div>
732     +
733     <span class=label>
734     %=l 'NAME_LABEL'
735     </span><span class=data>
736     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
737     --- 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
738 brianr 1.3 +++ 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
739 brianr 1.1 @@ -1,4 +1,9 @@
740     <div id='paramlist'>
741     + <script>
742     + window.onload = function() {
743     + SelectInput();
744     + };
745     + </script>
746     <h2>
747     %= l 'Params_for_IP_Retrieval'
748     </h2>
749 brianr 1.2 @@ -7,11 +12,11 @@
750     <span class=label>
751     %=l 'RETRIEVE_SSL'
752     </span><span class=data>
753     - % param retrievessl=>$ddc_datas->{"params"}->{"ssl"};
754     + % param retrievessl=>$ddc_datas->{"params"}->{"ssl"} unless param 'retrievessl';
755 brianr 1.1 %=select_field retrievessl=>[['Yes'=>'yes'],['No'=>'no']]
756     </span><br>
757     <span class=label>
758     - %=l 'RETRIEVE_DEAMONUPDATE'
759     + %=l 'RETRIEVE_DEAMONUPDATE'
760     </span><span class=data>
761     % param retrievedeamonupdate=>$ddc_datas->{"params"}->{"DeamonUpdate"};
762     %=number_field 'retrievedeamonupdate',min=>0
763 brianr 1.3 @@ -19,33 +24,112 @@
764 brianr 1.2 <span class=label>
765 brianr 1.1 %=l 'RETRIEVE_METHOD'
766     </span><span class=data>
767 brianr 1.2 - % param retrievemethod=>$ddc_datas->{"params"}->{"method"};
768 brianr 1.1 - %=select_field retrievemethod=>$methodlabels
769     - </span><br>
770     - <span class=label>
771 brianr 1.3 - %=l 'RETRIEVE_IF'
772     - </span><span class=data>
773     - % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"};
774     - %=text_field 'retrieveinterface'
775     - </span><br>
776     - <span class=label>
777     - %=l 'RETRIEVE_CMD'
778     - </span><span class=data>
779     - % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"};
780     - %=text_field 'retrievecmd'
781     - </span><br>
782     - <span class=label>
783     - %=l 'RETRIEVE_IP'
784     - </span><span class=data>
785     - % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"};
786     - %=text_field 'retrieveip'
787     - </span><br>
788     - <span class=label>
789     - %=l 'RETRIEVE_URLCHECKIP'
790     - </span><span class=data>
791     - % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"};
792     - %=text_field 'retrieveurlcheckip'
793     - </span><br>
794 brianr 1.2 + % param retrievemethod=>$ddc_datas->{"params"}->{"method"} unless param 'retrievemethod';
795 brianr 1.1 + %=select_field retrievemethod=>$methodlabels,id=>"retrievemethod",onchange=>"SelectInput()"
796     + %= javascript begin
797     + function SelectInput() {
798     + var method = document.querySelector("#retrievemethod");
799 brianr 1.2 + const types=['smeIF','smeCMD','web','router','if','ip','cmd','custom'];
800 brianr 1.1 + types.forEach((type)=>{
801     + var service = document.querySelector(`.${type}`);
802     + if (service != null) {
803     + if (method.value == type) {
804     + service.style.display = 'block';
805     + } else {
806     + service.style.display = 'none';
807     + }
808     + }
809     + })
810     + }
811     + % end
812     + </span><br>
813     + %#
814     + %# From here the one that is shown depends on the choice above
815     + %#
816     + %# Only if "router" is chosen
817     + <div class = router>
818 brianr 1.3 + <span class=label>
819     + %=l 'Router type'
820     + </span><span class=data>
821     + % param retrieverouter=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieverouter';
822     + %=select_field retrieverouter=>$devices
823     + </span><br>
824     + %# Need login and password for router
825     + <span class=label>
826     + %=l 'Router login'
827     + </span><span class=data>
828     + % param retrieverouterlogin=>$ddc_datas->{"params"}->{"FWLogin"} unless param 'retrieverouter';
829     + %=text_field 'retrieverouterlogin'
830     + </span><br>
831     + <span class=label>
832     + %=l 'Router password'
833     + </span><span class=data>
834     + % param retrieverouterpassword=>$ddc_datas->{"params"}->{"FWPassword"} unless param 'retrieverouterpassword';
835     + %=password_field 'retrieverouterpassword', id=>'ddcPass'
836     + %=label_for show=>"Show"
837     + %=check_box show=>1,onclick=>"showPass()",style=>"vertical-align:middle;"
838     + %= javascript begin
839     + function showPass() {
840     + var x = document.getElementById("ddcPass");
841     + if (x.type === "password") {
842     + x.type = "text";
843     + } else {
844     + x.type = "password";
845     + }
846     + }
847     + % end
848     + </span><br>
849 brianr 1.1 + </div>
850     +
851     + %# Only if "web" is chosen"
852     + <div class = web>
853 brianr 1.3 + <span class=label>
854     + %=l 'Web service'
855     + </span><span class=data>
856     + % param retrievewebservice=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrievewebservice';
857     + %=select_field retrievewebservice=>$dnslabels
858     + </span><br />
859 brianr 1.1 + </div>
860     +
861     + %# Only if "Interface" is chosen
862     + <div class=if>
863 brianr 1.3 + <span class=label Interface>
864     + %=l 'RETRIEVE_IF'
865     + </span><span class=data Interface>
866     + % param retrieveinterface=>$ddc_datas->{"params"}->{"Extinterface"} unless param 'retrieveinterface';
867     + %=text_field 'retrieveinterface'
868     + </span><br>
869 brianr 1.1 + </div>
870     +
871     + %# Only if "cmd" is chosen
872     + <div class=cmd>
873 brianr 1.3 + <span class=label cmd>
874     + %=l 'RETRIEVE_CMD'
875     + </span><span class=data cmd>
876     + % param retrievecmd=>$ddc_datas->{"params"}->{"cmd"} unless param 'retrievecmd';
877     + %=text_field 'retrievecmd'
878     + </span><br>
879 brianr 1.1 + </div>
880     +
881     + %# Only if "ip" is chosen
882     + <div class=ip>
883 brianr 1.3 + <span class=label ip>
884     + %=l 'RETRIEVE_IP'
885     + </span><span class=data ip>
886     + % param retrieveip=>$ddc_datas->{"params"}->{"ForceIP"} unless param 'retrieveip';
887     + %=text_field 'retrieveip'
888     + </span><br>
889 brianr 1.1 + </div>
890     +
891     + %# Only if "custom web service"
892     + <div class=custom>
893 brianr 1.3 + <span class=label customweb>
894     + %=l 'RETRIEVE_URLCHECKIP'
895     + </span><span class=data customweb>
896     + % param retrieveurlcheckip=>$ddc_datas->{"params"}->{"urlcheckip"} unless param 'retrieveurlcheckip';
897     + %=text_field 'retrieveurlcheckip'
898     + </span><br>
899 brianr 1.1 + </div>
900    
901     %= submit_button "$btn", class => 'action'
902     % end

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