From: Paul Donald Date: Sat, 7 Dec 2024 01:31:54 +0000 (+0100) Subject: luci-app-ddns: fix fileUpload X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=35e89dd554e35b657b5d737624b36a0d8de7c73c;p=project%2Fluci.git luci-app-ddns: fix fileUpload some extra validation checks for "custom" service type uci.set(..., null) -> uci.unset() Signed-off-by: Paul Donald --- diff --git a/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js b/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js index 405468cc75..95451be6f0 100644 --- a/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js +++ b/applications/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js @@ -514,7 +514,8 @@ return view.extend({ service_name.value('-',"📝 " + _("custom") ); Object.keys(_this.services).sort().forEach(name => service_name.value(name)); service_name.validate = function(section_id, value) { - if (value == '') return _("Select a service"); + if (value == '-') return true; + if (!value) return _("Select a service"); if (!s2.service_supported) return _("Service doesn't support this IP type"); return true; }; @@ -639,14 +640,15 @@ return view.extend({ }; service_name.write = function(section_id, service) { if (service != '-') { - uci.set('ddns', section_id, 'update_url', null); - uci.set('ddns', section_id, 'update_script', null); + uci.unset('ddns', section_id, 'update_url'); + uci.unset('ddns', section_id, 'update_script'); return uci.set('ddns', section_id, 'service_name', service); } - return uci.set('ddns', section_id, 'service_name', null); + return uci.unset('ddns', section_id, 'service_name'); }; service_name.validate = function(section_id, value) { - if (value == '') return _("Select a service"); + if (value == '-') return true; + if (!value) return _("Select a service"); if (!s.service_available) return _('Service not installed'); if (!s.service_supported) return _("Service doesn't support this IP type"); return true; @@ -710,7 +712,7 @@ return view.extend({ _("Custom update-script"), _("Custom update script for updating your DDNS Provider.")); o.root_directory = '/usr/lib/ddns/'; - o.browser = true; + o.datatype = 'file'; o.show_hidden = true; o.enable_upload = true; o.enable_remove = true;