Skip to content

Commit

Permalink
luci-app-rp-pppoe-server: convert to JS
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Donald <[email protected]>
  • Loading branch information
systemcrash committed Oct 7, 2024
1 parent 25a4d07 commit 3aa6087
Show file tree
Hide file tree
Showing 44 changed files with 6,475 additions and 1,202 deletions.
2 changes: 1 addition & 1 deletion applications/luci-app-rp-pppoe-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LUCI_TITLE:=Roaring Penguin PPPoE Server
LUCI_DEPENDS:=+luci-base +luci-compat +rp-pppoe-server

PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Daniel F. Dickinson <[email protected]>
PKG_MAINTAINER:=Paul Donald <[email protected]>

include ../../luci.mk

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
'use strict';
'require form';
'require network';
'require tools.widgets as widgets';
'require view';

return view.extend({
load: function() {
return Promise.all([
network.getNetworks(),
]);
},

render: function (loaded_promises) {
var m, s, o;
const networks = loaded_promises[0];

m = new form.Map('pppoe', _('Roaring Penguin PPPoE Relay'),
_('PPPoE Relay Configuration'));

s = m.section(form.TypedSection, 'pppoe_relay', _('Relay Configuration'));
s.anonymous = true;
s.addremove = true;

o = s.option(form.Flag, 'enabled', _('Enabled'));

o = s.option(widgets.DeviceSelect, 'server_interface', _('Server Interface'), _('Interface on which to listen. Only PPPoE servers may be connected to this interface.'));
o.multiple = true;
o.optional = true;
o.nocreate = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(widgets.DeviceSelect, 'client_interface', _('Client Interface'), _('Interface from which to relay. Only PPPoE clients may be connected to this interface.'));
o.multiple = true;
o.optional = true;
o.nocreate = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(widgets.DeviceSelect, 'both_interface', _('Both Interface'), _('Interface upon which to listen and to relay. Both PPPoE clients and servers may be connected to this interface.'));
o.multiple = true;
o.optional = true;
o.nocreate = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Flag, 'use_non_uci_config', _('Use Non-UCI Config'), '<code>/etc/default/pppoe-relay</code>');
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'maxsessions', _('Maximum Sessions'));
o.datatype = 'range(1,65534)';
o.placeholder = 5000;
o.value('', _('Default: 5000'));
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'timeout', _('Timeout'));
o.optional = true;
o.datatype = 'uinteger';
o.placeholder = 600;
o.value('0', _('No timeout'));
o.value('', _('Default: 600'));
o.rmempty = true;
o.depends({ enabled: '1' });

return m.render();
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
'use strict';
'require form';
'require network';
'require tools.widgets as widgets';
'require view';

return view.extend({
load: function() {
return Promise.all([
network.getNetworks(),
]);
},

render: function (loaded_promises) {
var m, s, o;
const networks = loaded_promises[0];

m = new form.Map('pppoe', _('Roaring Penguin PPPoE Server'),
_('PPPoE Server Configuration'));

s = m.section(form.TypedSection, 'pppoe_server', _('Server Configuration'));
s.anonymous = true;
s.addremove = true;

o = s.option(form.Flag, 'enabled', _('Enabled'));

o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Interface on which to listen.'));
o.optional = true;
o.nocreate = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'localip', _('IP of listening side'), _('If specified as <code>0.0.0.0</code> the selection of local IP address is delegated to <code>pppd</code>'));
o.datatype = 'ipaddr';
o.placeholder = '10.0.0.1';
o.value('10.0.0.1');
o.value('0.0.0.0');
o.depends({ enabled: '1' });

o = s.option(form.Value, 'firstremoteip', _('First remote IP'), _('If specified as <code>0.0.0.0</code> remote IP allocation will be delegated to <code>pppd</code>'));
o.datatype = 'ipaddr';
o.placeholder = '10.67.15.1';
o.value('10.67.15.1');
o.value('0.0.0.0');
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'ac_name', _('Access Concentrator Name'));
o.rmempty = true;
o.value('', _('Default: hostname'));
o.depends({ enabled: '1' });

o = s.option(form.DynamicList, 'service_name', _('Service Name'), _('Each one causes the named service to be advertised in a Service-Name tag in the PADO frame. The first one specifies the default service, and is used if the PPPoE client requests a Service-Name of length zero.'));
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'maxsessions', _('Maximum Sessions'), _('Maximum concurrent sessions'));
o.datatype = 'range(1,65534)';
o.placeholder = 64;
o.value('', _('Default: 64'));
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'maxsessionsperpeer', _('Maximum sessions per peer'));
o.optional = true
o.datatype = 'range(0,65534)';
o.placeholder = 0;
o.value('0', _('No limit'));
o.value('10');
o.value('100');
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Flag, 'use_non_uci_config', _('Use Non-UCI Config'), '<code>/etc/default/pppoe-server</code>');
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'optionsfile', _('Options file'));
o.placeholder = '/etc/ppp/pppoe-server-options';
o.value('/etc/ppp/options');
o.value('/etc/ppp/pppoe-server-options');
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Flag, 'randomsessions', _('Random session selection'), _('Tells the PPPoE server to randomly permute session numbers.'));
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Flag, 'unit', _('Unit'), _('Invokes <code>pppd</code> with the unit flag'));
o.optional = true;
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'offset', _('Offset'), _('PPP Offset'), _('Instead of numbering PPPoE sessions starting at 1, numbering starts at %s'.format('<code>offset</code>+1')));
o.optional = true;
o.datatype = 'uinteger';
o.placeholder = 0;
o.value('0');
o.depends({ enabled: '1' });

o = s.option(form.Value, 'timeout', _('Timeout'), _('Causes <code>pppoe</code> to exit if no session traffic is detected for %s seconds.'.format('<code>timeout</code>')));
// no default timeout is assumed
o.optional = true;
o.datatype = 'uinteger';
o.value('0', _('No timeout'));
o.value('60');
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Value, 'mss', _('MSS'), _('Max Segment Size'));
o.optional = true;
o.datatype = 'uinteger';
o.placeholder = 1468;
o.value('1412');
o.value('1468');
o.rmempty = true;
o.depends({ enabled: '1' });

o = s.option(form.Flag, 'sync', _('Synchronous PPP encapsulation'), _('Reduces CPU usage, but may cause a race condition on slow CPUs'));
o.depends({ enabled: '1' });

return m.render();
}
});

This file was deleted.

Loading

0 comments on commit 3aa6087

Please sign in to comment.