From a9654b20f29e757c92d45fc663a6f353822ca66f Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 19 Mar 2025 12:50:29 +0100 Subject: [PATCH] luci-app-xinetd: make the server configuration option mandatory Signed-off-by: Florian Eckert (cherry picked from commit 790302ce856c1bf77d9e4e2d782a147fb48e1c7a) --- .../luci-static/resources/view/xinetd/xinetd.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/applications/luci-app-xinetd/htdocs/luci-static/resources/view/xinetd/xinetd.js b/applications/luci-app-xinetd/htdocs/luci-static/resources/view/xinetd/xinetd.js index 8f5583f7bd..6d06e247bb 100644 --- a/applications/luci-app-xinetd/htdocs/luci-static/resources/view/xinetd/xinetd.js +++ b/applications/luci-app-xinetd/htdocs/luci-static/resources/view/xinetd/xinetd.js @@ -159,15 +159,25 @@ return view.extend({ o.rmempty = false; o.modalonly = true; + o = s.taboption('basic', form.Flag, '_redirect', _('Use redirect')); + o.modalonly = true; + o.load = function(section_id) { + var redirect = uci.get(this.config, section_id, 'redirect'); + return redirect ? 1 : 0 + }; + o.write = function(section_id, formvalue) {}; + o = s.taboption('basic', form.Value, 'redirect', _('Redirect'), _('Redirect incoming TCP requests to this IP address:port.')); o.datatype = 'ipaddrport(1)'; + o.rmempty = false; o.modalonly = true; + o.depends('_redirect', '1'); o = s.taboption('basic', form.Value, 'server', _('Server'), _('Complete path to the executable server file')); o.datatype = 'string'; o.rmempty = false; o.modalonly = true; - o.depends('type', 'UNLISTED'); + o.depends({ 'type': 'UNLISTED', '_redirect': '0' }); o.validate = validateEmpty; o.write = function(section, value) { return fs.stat(value).then(function(res) { @@ -186,7 +196,7 @@ return view.extend({ o = s.taboption('basic', form.Value, 'server_args', _('Server arguments'), _('Additional arguments passed to the server. There is no validation of this input.')); o.datatype = 'string'; o.modalonly = true; - o.depends('type', 'UNLISTED'); + o.depends({ 'type': 'UNLISTED', '_redirect': '0' }); // Advanced settings o = s.taboption('advanced', widgets.UserSelect, 'user', _('User (UID)'), _('User ID for the server process for this service')); -- 2.30.2