From 19de3acddec1fa63cd895b3e0aa41fa0cae0ee88 Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Tue, 25 May 2021 10:34:05 +0800 Subject: [PATCH] luci-app-samba4: support listen on multiple interfaces /etc/init.d/samba4 already support that Signed-off-by: Liangbin Lian (cherry picked from commit 169ab9979eee780758256c2859f7c2ee86a0b0ae) --- .../htdocs/luci-static/resources/view/samba4.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/applications/luci-app-samba4/htdocs/luci-static/resources/view/samba4.js b/applications/luci-app-samba4/htdocs/luci-static/resources/view/samba4.js index 608be887be..3c6319f93d 100644 --- a/applications/luci-app-samba4/htdocs/luci-static/resources/view/samba4.js +++ b/applications/luci-app-samba4/htdocs/luci-static/resources/view/samba4.js @@ -1,6 +1,7 @@ 'use strict'; 'require view'; 'require fs'; +'require uci'; 'require form'; 'require tools.widgets as widgets'; @@ -30,8 +31,22 @@ return view.extend({ s.tab('general', _('General Settings')); s.tab('template', _('Edit Template')); - s.taboption('general', widgets.NetworkSelect, 'interface', _('Interface'), + o = s.taboption('general', widgets.NetworkSelect, 'interface', _('Interface'), _('Listen only on the given interface or, if unspecified, on lan')); + o.multiple = true; + o.cfgvalue = function(section_id) { + return uci.get('samba4', section_id, 'interface').split(' '); + }; + o.write = function(section_id, formvalue) { + var cfgvalue = this.cfgvalue(section_id), + oldNetworks = L.toArray(cfgvalue), + newNetworks = L.toArray(formvalue); + oldNetworks.sort(); + newNetworks.sort(); + if (oldNetworks.join(' ') == newNetworks.join(' ')) + return; + return uci.set('samba4', section_id, 'interface', newNetworks.join(' ')); + }; o = s.taboption('general', form.Value, 'workgroup', _('Workgroup')); o.placeholder = 'WORKGROUP'; -- 2.30.2