luci-app-ddns: show the URL which will be used.
authorJan Pazdziora <jan.pazdziora@code.adelton.com>
Sat, 11 Jan 2025 10:39:10 +0000 (11:39 +0100)
committerPaul Donald <newtwen+github@gmail.com>
Wed, 22 Jan 2025 14:37:08 +0000 (15:37 +0100)
Signed-off-by: Jan Pazdziora <jan.pazdziora@code.adelton.com>
applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js

index 8c86bf217942d652be3a2f9285ed3181fd6bdcd2..46f05a3fc8ebba0adc3df897f93963a333d859e0 100644 (file)
@@ -586,6 +586,7 @@ return view.extend({
                        return _this.handleGetServiceData(service).then(L.bind(function (service_data) {
                                s.service_available = true;
                                s.service_supported = true;
+                               s.url = null;
 
                                if (service != '-') {
                                        if (!service_data)
@@ -594,6 +595,11 @@ return view.extend({
                                                service_data = JSON.parse(service_data);
                                                if (ipv6 == "1" && !service_data.ipv6)
                                                        s.service_supported = false;
+                                               else if (ipv6 == "1") {
+                                                       s.url = service_data.ipv6.url;
+                                               } else {
+                                                       s.url = service_data.ipv4.url;
+                                               }
                                        }
                                }
 
@@ -674,6 +680,14 @@ return view.extend({
                                        };
                                }
 
+                               if (Boolean(s.url)) {
+                                       o = s.taboption('basic', form.DummyValue, '_url', _("Update URL"));
+                                       o.rawhtml = true;
+                                       o.default = '<div style="font-family: monospace;">'
+                                               + s.url.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")
+                                               + '</div>';
+                               }
+
                                var service_switch = s.taboption('basic', form.Button, '_switch_proto');
                                service_switch.modalonly  = true;
                                service_switch.title      = _('Really switch service?');