1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

omr-bypass: New way to bypass services without nDPI

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-05-25 13:09:49 +02:00
parent 9c1c926ad4
commit 7fcfd3be07
6 changed files with 310 additions and 20 deletions

View file

@ -15,11 +15,15 @@ return L.view.extend({
}),
load: function() {
return this.callHostHints();
return Promise.all([
L.resolveDefault(fs.stat('/proc/net/xt_ndpi/proto'), null),
this.callHostHints()
]);
},
render: function(hosts) {
var m, s, o;
render: function(testhosts) {
var m, s, o, hosts;
hosts = testhosts[1];
m = new form.Map('omr-bypass', _('OMR-Bypass'),_('OpenMPTCProuter IP must be used as DNS.'));
@ -215,21 +219,33 @@ return L.view.extend({
o.rmempty = false;
o.load = function(section_id) {
return Promise.all([
fs.read_direct('/proc/net/xt_ndpi/proto'),
fs.read_direct('/proc/net/xt_ndpi/host_proto')
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 = [];
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 (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]);
}
}
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);
}
}
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++) {
@ -258,9 +274,11 @@ return L.view.extend({
o.default = o.enabled;
o.modalonly = true
o = s.option(form.Flag, 'ndpi', _('Enable ndpi'));
o.default = o.enabled;
o.modalonly = true
if (testhosts[0]) {
o = s.option(form.Flag, 'ndpi', _('Enable ndpi'));
o.default = o.enabled;
o.modalonly = true
}
return m.render();
}