1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 10:31:51 +00:00

A few changes and better description in OMR-ByPass interface

This commit is contained in:
Ycarus (Yannick Chabanois) 2025-01-14 19:23:33 +01:00
parent 3daacde7bc
commit 7a63841f86

View file

@ -17,7 +17,10 @@ return L.view.extend({
load: function() {
return Promise.all([
L.resolveDefault(fs.stat('/proc/net/xt_ndpi/proto'), null),
this.callHostHints()
this.callHostHints(),
L.resolveDefault(fs.read_direct('/proc/net/xt_ndpi/proto'), ''),
L.resolveDefault(fs.read_direct('/proc/net/xt_ndpi/host_proto'), ''),
fs.read_direct('/usr/share/omr-bypass/omr-bypass-proto.lst')
]);
},
@ -51,7 +54,7 @@ return L.view.extend({
o = s.option(form.Flag, 'vpn', _('VPN on server'),_('Bypass using VPN configured on server.'));
o.modalonly = true
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -85,7 +88,7 @@ return L.view.extend({
o = s.option(form.Flag, 'vpn', _('VPN on server'),_('Bypass using VPN configured on server.'));
o.modalonly = true
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -112,7 +115,7 @@ return L.view.extend({
o.value('udp');
o.value('icmp');
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -138,7 +141,7 @@ return L.view.extend({
o.value('udp');
o.value('icmp');
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -162,7 +165,7 @@ return L.view.extend({
o.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac);
});
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -188,7 +191,7 @@ return L.view.extend({
}
});
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -210,7 +213,7 @@ return L.view.extend({
o = s.option(form.Flag, 'vpn', _('VPN on server'),_('Bypass using VPN configured on server.'));
o.modalonly = true
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used.'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used.'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -230,47 +233,44 @@ return L.view.extend({
o = s.option(form.ListValue, 'proto', _('Protocol/Service'));
o.rmempty = false;
o.load = function(section_id) {
return Promise.all([
L.resolveDefault(fs.read_direct('/proc/net/xt_ndpi/proto'), ''),
L.resolveDefault(fs.read_direct('/proc/net/xt_ndpi/host_proto'), ''),
fs.read_direct('/usr/share/omr-bypass/omr-bypass-proto.lst')
]).then(L.bind(function(filesi) {
var proto = filesi[0].split(/\n/),
host = filesi[1].split(/\n/),
protofile = filesi[2].split(/\n/),
name = [];
if (proto.length > 2) {
for (var i = 0; i < proto.length; i++) {
var m = proto[i].split(/\s+/);
if (m && m[0] != "#id" && m[1] != "disabled")
name.push(m[2]);
}
var proto = testhosts[2].split(/\n/),
host = testhosts[3].split(/\n/),
protofile = testhosts[4].split(/\n/),
name = [];
if (proto.length > 2) {
for (var i = 0; i < proto.length; i++) {
var m = proto[i].split(/\s+/);
if (m && m[0] != "#id" && m[1] != "disabled")
name.push(m[2]);
}
if (host.length > 2) {
for (var i = 0; i < host.length; i++) {
var m = host[i].split(/:/);
if (m && m[0] != "#Proto")
name.push(m[0].toLowerCase());
}
}
if (host.length > 2) {
for (var i = 0; i < host.length; i++) {
var m = host[i].split(/:/);
if (m && m[0] != "#Proto")
name.push(m[0].toLowerCase());
}
if (proto.length == 1 && host.length == 1) {
for (var i = 0; i < protofile.length; i++) {
var m = protofile[i];
name.push(m);
}
}
if (proto.length == 1 && host.length == 1) {
for (var i = 0; i < protofile.length; i++) {
var m = protofile[i];
name.push(m);
}
}
if (host.length > 2) {
name = Array.from(new Set(name)).sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase())}).reduce(function(a, b){ if (a.slice(-1)[0] !== b) a.push(b);return a;},[]);
for (var i = 0; i < name.length; i++) {
this.value(name[i]);
}
return this.super('load', [section_id]);
},this));
}
for (var i = 0; i < name.length; i++) {
this.value(name[i]);
}
return this.super('load', [section_id]);
};
o = s.option(form.Flag, 'vpn', _('VPN on server'),_('Bypass using VPN configured on server.'));
o.modalonly = true
o = s.option(widgets.DeviceSelect, 'interface', _('Interface'),_('When none selected, MPTCP master interface is used (or an other interface if master is down).'));
o = s.option(widgets.DeviceSelect, 'interface', _('Output interface'),_('When none selected, MPTCP master interface is used (or an other interface if master is down).'));
o.noaliases = true;
o.noinactive = true;
o.nocreate = true;
@ -287,7 +287,7 @@ return L.view.extend({
o.modalonly = true
o = s.option(form.Flag, 'noipv6', _('Disable AAAA IPv6 DNS'));
o.default = o.enabled;
o.default = true;
o.modalonly = true
if (testhosts[0]) {