mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
sync (#596)
This commit is contained in:
commit
2c58a19ada
13 changed files with 102 additions and 21 deletions
|
@ -70,12 +70,58 @@ return view.extend({
|
||||||
o.value('5');
|
o.value('5');
|
||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
|
|
||||||
/*
|
|
||||||
o = s.option(form.Flag, 'check_quality', _('Check link quality'));
|
o = s.option(form.Flag, 'check_quality', _('Check link quality'));
|
||||||
o.depends('track_method', 'ping');
|
o.depends('type', 'ping');
|
||||||
|
o.depends('type', 'apiping');
|
||||||
o.default = false;
|
o.default = false;
|
||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
*/
|
|
||||||
|
o = s.option(form.Value, 'failure_latency', _('Failure latency [ms]'));
|
||||||
|
o.depends('check_quality', '1');
|
||||||
|
o.default = '1000';
|
||||||
|
o.value('25');
|
||||||
|
o.value('50');
|
||||||
|
o.value('75');
|
||||||
|
o.value('100');
|
||||||
|
o.value('150');
|
||||||
|
o.value('200');
|
||||||
|
o.value('250');
|
||||||
|
o.value('300');
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'failure_loss', _('Failure packet loss [%]'));
|
||||||
|
o.depends('check_quality', '1');
|
||||||
|
o.default = '40';
|
||||||
|
o.value('2');
|
||||||
|
o.value('5');
|
||||||
|
o.value('10');
|
||||||
|
o.value('20');
|
||||||
|
o.value('25');
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'recovery_latency', _('Recovery latency [ms]'));
|
||||||
|
o.depends('check_quality', '1');
|
||||||
|
o.default = '500';
|
||||||
|
o.value('25');
|
||||||
|
o.value('50');
|
||||||
|
o.value('75');
|
||||||
|
o.value('100');
|
||||||
|
o.value('150');
|
||||||
|
o.value('200');
|
||||||
|
o.value('250');
|
||||||
|
o.value('300');
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'recovery_loss', _('Recovery packet loss [%]'));
|
||||||
|
o.depends('check_quality', '1');
|
||||||
|
o.default = '10';
|
||||||
|
o.value('2');
|
||||||
|
o.value('5');
|
||||||
|
o.value('10');
|
||||||
|
o.value('20');
|
||||||
|
o.value('25');
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
o = s.option(form.ListValue, "timeout", _("Test timeout"));
|
o = s.option(form.ListValue, "timeout", _("Test timeout"));
|
||||||
o.default = '4';
|
o.default = '4';
|
||||||
o.value('1', _('%d second').format('1'));
|
o.value('1', _('%d second').format('1'));
|
||||||
|
|
|
@ -1463,6 +1463,10 @@ function settings_add()
|
||||||
local status_getip_timeout = luci.http.formvalue("status_getip_timeout") or "1"
|
local status_getip_timeout = luci.http.formvalue("status_getip_timeout") or "1"
|
||||||
ucic:set("openmptcprouter","settings","status_getip_timeout",status_getip_timeout)
|
ucic:set("openmptcprouter","settings","status_getip_timeout",status_getip_timeout)
|
||||||
|
|
||||||
|
-- Whois timeout
|
||||||
|
local status_whois_timeout = luci.http.formvalue("status_whois_timeout") or "2"
|
||||||
|
ucic:set("openmptcprouter","settings","status_whois_timeout",status_whois_timeout)
|
||||||
|
|
||||||
-- Enable/disable loop detection
|
-- Enable/disable loop detection
|
||||||
local disableloopdetection = luci.http.formvalue("disableloopdetection") or "0"
|
local disableloopdetection = luci.http.formvalue("disableloopdetection") or "0"
|
||||||
ucic:set("openmptcprouter","settings","disableloopdetection",disableloopdetection)
|
ucic:set("openmptcprouter","settings","disableloopdetection",disableloopdetection)
|
||||||
|
|
|
@ -286,7 +286,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cbi-value">
|
||||||
|
<label class="cbi-value-title"><%:Whois WAN IPs retrieve timeout%></label>
|
||||||
|
<div class="cbi-value-field">
|
||||||
|
<input type="text" name="status_whois_timeout" class="cbi-input-text" value="<%=luci.model.uci.cursor():get("openmptcprouter","settings","status_whois_timeout")%>">
|
||||||
|
<br />
|
||||||
|
<div class="cbi-value-description">
|
||||||
|
<%:Timeout for retrieving Whois WANs IP on status pages%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="cbi-value">
|
<div class="cbi-value">
|
||||||
<label class="cbi-value-title"><%:Disable interfaces auto rename%></label>
|
<label class="cbi-value-title"><%:Disable interfaces auto rename%></label>
|
||||||
<div class="cbi-value-field">
|
<div class="cbi-value-field">
|
||||||
|
|
|
@ -11,7 +11,13 @@
|
||||||
local ifttyu = nixio.fs.glob("/dev/ttyUSB*")
|
local ifttyu = nixio.fs.glob("/dev/ttyUSB*")
|
||||||
local ifttyc = nixio.fs.glob("/dev/cdc-wdm*")
|
local ifttyc = nixio.fs.glob("/dev/cdc-wdm*")
|
||||||
local sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
|
local sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
|
||||||
|
if sqm == "0" then
|
||||||
|
sqm = luci.sys.exec("apk list | grep installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
|
||||||
|
end
|
||||||
local qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
|
local qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
|
||||||
|
if qos == "0" then
|
||||||
|
qos = luci.sys.exec("apk list | grep installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
|
||||||
|
end
|
||||||
menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter"
|
menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter"
|
||||||
function device_notvirtual(dev)
|
function device_notvirtual(dev)
|
||||||
if dev:match("^eth.*") or dev:match("^wwan.*") or dev:match("^tun.*") or dev:match("/") then
|
if dev:match("^eth.*") or dev:match("^wwan.*") or dev:match("^tun.*") or dev:match("/") then
|
||||||
|
|
|
@ -98,6 +98,12 @@ if [ "$(uci -q get openmptcprouter.settings.status_getip_timeout)" = "" ]; then
|
||||||
commit openmptcprouter
|
commit openmptcprouter
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
if [ "$(uci -q get openmptcprouter.settings.status_whois_timeout)" = "" ]; then
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
set openmptcprouter.settings.status_whois_timeout=2
|
||||||
|
commit openmptcprouter
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
if [ "$(uci -q get openmptcprouter.settings.enable_nodelay)" = "" ]; then
|
if [ "$(uci -q get openmptcprouter.settings.enable_nodelay)" = "" ]; then
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
set openmptcprouter.settings.enable_nodelay=1
|
set openmptcprouter.settings.enable_nodelay=1
|
||||||
|
|
|
@ -230,6 +230,7 @@ return L.Class.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
option_install_package: function(s, tab) {
|
option_install_package: function(s, tab) {
|
||||||
var bin = s.sectiontype.replace('_', '-'),
|
var bin = s.sectiontype.replace('_', '-'),
|
||||||
opkg_package = 'shadowsocks-libev-' + bin, o;
|
opkg_package = 'shadowsocks-libev-' + bin, o;
|
||||||
|
@ -246,6 +247,7 @@ return L.Class.extend({
|
||||||
'?query=' + opkg_package, '_blank', 'noopener');
|
'?query=' + opkg_package, '_blank', 'noopener');
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
parse_uri: function(uri) {
|
parse_uri: function(uri) {
|
||||||
var scheme = 'ss://';
|
var scheme = 'ss://';
|
||||||
if (uri && uri.indexOf(scheme) === 0) {
|
if (uri && uri.indexOf(scheme) === 0) {
|
||||||
|
|
|
@ -76,9 +76,11 @@ return L.view.extend({
|
||||||
s.tab('advanced', _('Advanced Settings'));
|
s.tab('advanced', _('Advanced Settings'));
|
||||||
s.taboption('general', form.Value, 'label', _('Label'));
|
s.taboption('general', form.Value, 'label', _('Label'));
|
||||||
s.taboption('general', form.Flag, 'disabled', _('Disable'));
|
s.taboption('general', form.Flag, 'disabled', _('Disable'));
|
||||||
|
/*
|
||||||
if (!res[0]) {
|
if (!res[0]) {
|
||||||
ss.option_install_package(s, 'general');
|
ss.option_install_package(s, 'general');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
ss.options_common(s, 'advanced');
|
ss.options_common(s, 'advanced');
|
||||||
|
|
||||||
if (stype === 'ss_server') {
|
if (stype === 'ss_server') {
|
||||||
|
|
|
@ -213,6 +213,7 @@ return L.Class.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
option_install_package: function(s, tab) {
|
option_install_package: function(s, tab) {
|
||||||
var bin = s.sectiontype.replace('_', '-'),
|
var bin = s.sectiontype.replace('_', '-'),
|
||||||
opkg_package = 'shadowsocks-rust-' + bin, o;
|
opkg_package = 'shadowsocks-rust-' + bin, o;
|
||||||
|
@ -229,6 +230,7 @@ return L.Class.extend({
|
||||||
'?query=' + opkg_package, '_blank', 'noopener');
|
'?query=' + opkg_package, '_blank', 'noopener');
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
parse_uri: function(uri) {
|
parse_uri: function(uri) {
|
||||||
var scheme = 'ss://';
|
var scheme = 'ss://';
|
||||||
if (uri && uri.indexOf(scheme) === 0) {
|
if (uri && uri.indexOf(scheme) === 0) {
|
||||||
|
|
|
@ -76,9 +76,11 @@ return L.view.extend({
|
||||||
s.tab('advanced', _('Advanced Settings'));
|
s.tab('advanced', _('Advanced Settings'));
|
||||||
s.taboption('general', form.Value, 'label', _('Label'));
|
s.taboption('general', form.Value, 'label', _('Label'));
|
||||||
s.taboption('general', form.Flag, 'disabled', _('Disable'));
|
s.taboption('general', form.Flag, 'disabled', _('Disable'));
|
||||||
|
/*
|
||||||
if (!res[0]) {
|
if (!res[0]) {
|
||||||
ss.option_install_package(s, 'general');
|
ss.option_install_package(s, 'general');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
ss.options_common(s, 'advanced');
|
ss.options_common(s, 'advanced');
|
||||||
|
|
||||||
if (stype === 'ss_server') {
|
if (stype === 'ss_server') {
|
||||||
|
|
|
@ -330,7 +330,7 @@ return view.extend({
|
||||||
var e = map.querySelector('[id="cbi-network-%s"] .cbi-button-edit'.format(ifc.getName()));
|
var e = map.querySelector('[id="cbi-network-%s"] .cbi-button-edit'.format(ifc.getName()));
|
||||||
if (e) e.disabled = true;
|
if (e) e.disabled = true;
|
||||||
|
|
||||||
var link = L.url('admin/system/opkg') + '?query=luci-proto';
|
var link = L.url('admin/system/package-manager') + '?query=luci-proto';
|
||||||
dom.content(dsc, [
|
dom.content(dsc, [
|
||||||
E('em', _('Unsupported protocol type.')), E('br'),
|
E('em', _('Unsupported protocol type.')), E('br'),
|
||||||
E('a', { href: link }, _('Install protocol extensions...'))
|
E('a', { href: link }, _('Install protocol extensions...'))
|
||||||
|
@ -371,7 +371,6 @@ return view.extend({
|
||||||
network.getDSLModemType(),
|
network.getDSLModemType(),
|
||||||
network.getDevices(),
|
network.getDevices(),
|
||||||
fs.lines('/etc/iproute2/rt_tables'),
|
fs.lines('/etc/iproute2/rt_tables'),
|
||||||
L.resolveDefault(fs.read('/usr/lib/opkg/info/netifd.control')),
|
|
||||||
uci.changes()
|
uci.changes()
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
@ -471,14 +470,10 @@ return view.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function(data) {
|
render: function(data) {
|
||||||
var netifdVersion = (data[3] || '').match(/Version: ([^\n]+)/);
|
if (this.interfaceBridgeWithIfnameSections().length)
|
||||||
|
return this.renderBridgeMigration();
|
||||||
if (netifdVersion && netifdVersion[1] >= "2021-05-26") {
|
else if (this.deviceWithIfnameSections().length || this.interfaceWithIfnameSections().length)
|
||||||
if (this.interfaceBridgeWithIfnameSections().length)
|
return this.renderIfnameMigration();
|
||||||
return this.renderBridgeMigration();
|
|
||||||
else if (this.deviceWithIfnameSections().length || this.interfaceWithIfnameSections().length)
|
|
||||||
return this.renderIfnameMigration();
|
|
||||||
}
|
|
||||||
|
|
||||||
var dslModemType = data[0],
|
var dslModemType = data[0],
|
||||||
netDevs = data[1],
|
netDevs = data[1],
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
"/proc/sys/net/ipv6/conf/*/mtu": [ "read" ],
|
"/proc/sys/net/ipv6/conf/*/mtu": [ "read" ],
|
||||||
"/proc/sys/net/ipv6/conf/*/hop_limit": [ "read" ],
|
"/proc/sys/net/ipv6/conf/*/hop_limit": [ "read" ],
|
||||||
"/usr/libexec/luci-peeraddr": [ "exec" ],
|
"/usr/libexec/luci-peeraddr": [ "exec" ],
|
||||||
"/usr/lib/opkg/info/netifd.control": [ "read" ],
|
|
||||||
"/proc/sys/net/ipv[46]/conf/*": [ "read" ],
|
"/proc/sys/net/ipv[46]/conf/*": [ "read" ],
|
||||||
"/sys/class/net/*/brport/*": [ "read" ]
|
"/sys/class/net/*/brport/*": [ "read" ]
|
||||||
},
|
},
|
||||||
|
|
|
@ -50,7 +50,9 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && { [ "$(uci -q get openmptcprouter.$OMR_TRA
|
||||||
if [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ]; then
|
if [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ]; then
|
||||||
#asn="$(wget -4 -qO- -T 4 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -q -e '@.as_description')"
|
#asn="$(wget -4 -qO- -T 4 http://api.iptoasn.com/v1/as/ip/$ipaddr | jsonfilter -q -e '@.as_description')"
|
||||||
#[ -z "$asn" ] && {
|
#[ -z "$asn" ] && {
|
||||||
asn="$(timeout 2 whois $ipaddr 2>/dev/null | grep -m 1 -i 'netname' | awk '{print $2}')"
|
whoistimeout=$(uci -q get openmptcprouter.settings.status_whois_timeout)
|
||||||
|
[ -z "$whoistimeout" ] && whoistimeout=2
|
||||||
|
asn="$(timeout $whoistimeout whois $ipaddr 2>/dev/null | grep -m 1 -i 'netname' | awk '{print $2}')"
|
||||||
#}
|
#}
|
||||||
fi
|
fi
|
||||||
[ -z "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE)" ] && {
|
[ -z "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE)" ] && {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2020-2024 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
# Copyright (C) 2020-2025 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
# Released under GPL 3. See LICENSE for the full terms.
|
# Released under GPL 3. See LICENSE for the full terms.
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -11,10 +11,16 @@
|
||||||
start_service()
|
start_service()
|
||||||
{
|
{
|
||||||
if [ -f /etc/backup/installed_packages.txt ]; then
|
if [ -f /etc/backup/installed_packages.txt ]; then
|
||||||
opkg -V0 update >/dev/null 2>&1
|
if [ -e /usr/bin/apk ]; then
|
||||||
if [ -z "$(grep '\toverlay' /etc/backup/installed_packages.txt | cut -f1 | xargs -r opkg -V0 install)" ]; then
|
apk update >/dev/null 2>&1
|
||||||
rm /etc/backup/installed_packages.txt
|
if [ -z "$(grep '\toverlay' /etc/backup/installed_packages.txt | cut -f1 | xargs -r apk add)" ]; then
|
||||||
fi
|
rm /etc/backup/installed_packages.txt
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
opkg -V0 update >/dev/null 2>&1
|
||||||
|
if [ -z "$(grep '\toverlay' /etc/backup/installed_packages.txt | cut -f1 | xargs -r opkg -V0 install)" ]; then
|
||||||
|
rm /etc/backup/installed_packages.txt
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue