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