Skip to content

Commit

Permalink
Merge pull request #6631 from raenye/ksmbd-multi-iface
Browse files Browse the repository at this point in the history
luci-app-ksmbd: add UI for multiple interfaces
  • Loading branch information
jow- authored Oct 10, 2023
2 parents 88d1893 + 55643d2 commit bd9e79b
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'require view';
'require fs';
'require form';
'require uci';
'require tools.widgets as widgets';

return view.extend({
Expand Down Expand Up @@ -32,8 +33,20 @@ return view.extend({
s.tab('general', _('General Settings'));
s.tab('template', _('Edit Template'), _('Edit the template that is used for generating the ksmbd configuration.'));

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 = (section_id => L.toArray(uci.get('ksmbd', section_id, 'interface')));
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('ksmbd', section_id, 'interface', newNetworks.join(' '));
};

o = s.taboption('general', form.Value, 'workgroup', _('Workgroup'));
o.placeholder = 'WORKGROUP';
Expand Down

0 comments on commit bd9e79b

Please sign in to comment.