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

Merge pull request #273 from Ysurac/develop

sync
This commit is contained in:
suyuan 2022-09-13 14:02:03 +08:00 committed by GitHub
commit 54cf729555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 16 deletions

View file

@ -85,6 +85,7 @@
function bandwidth_label(bytes, br)
{
if (bytes < 0) bytes = 0;
var uby = '<%:kB/s%>';
var kby = (bytes / 1024);

View file

@ -634,6 +634,8 @@ function wizard_add()
ucic:set("unbound","ub_main","dns64","0")
end
ucic:save("unbound")
ucic:commit("unbound")
-- Get Proxy set by default
local default_proxy = luci.http.formvalue("default_proxy") or "shadowsocks"
@ -981,7 +983,7 @@ function wizard_add()
ucic:set("openvpn","omr","enabled",1)
ucic:set("network","omrvpn","proto","none")
else
ucic:set("openvpn","omr","enabled",0)
ucic:delete("openvpn","omr","enabled")
end
ucic:save("openvpn")
ucic:commit("openvpn")
@ -1156,7 +1158,7 @@ function settings_add()
ucic:set("openmptcprouter","settings","shadowsocksudp",shadowsocksudp)
-- Enable/disable v2ray udp
local shadowsocksudp = luci.http.formvalue("v2rayudp") or "1"
local v2rayudp = luci.http.formvalue("v2rayudp") or "1"
ucic:set("v2ray","main_transparent_proxy","redirect_udp",v2rayudp)
-- Enable/disable nDPI
@ -1233,16 +1235,6 @@ function settings_add()
-- Enable/disable SIP ALG
local sipalg = luci.http.formvalue("sipalg") or "0"
ucic:set("openmptcprouter","settings","sipalg",sipalg)
ucic:foreach("firewall", "zone", function (section)
ucic:set("firewall",section[".name"],"auto_helper",sipalg)
end)
if sipalg == "1" then
luci.sys.call("modprobe -q nf_conntrack_sip >/dev/null 2>/dev/null")
luci.sys.call("modprobe -q nf_nat_sip >/dev/null 2>/dev/null")
else
luci.sys.call("rmmod nf_nat_sip >/dev/null 2>/dev/null")
luci.sys.call("rmmod nf_conntrack_sip >/dev/null 2>/dev/null")
end
ucic:save("openmptcprouter")
ucic:commit("openmptcprouter")

View file

@ -181,6 +181,28 @@ start_service() {
rmmod fast_classifier 2>&1 >/dev/null
fi
if [ "$(uci -q get openmptcprouter.settings.sipalg)" = "0" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.zone_lan.auto_helper='0'
set firewall.zone_wan.auto_helper='0'
set firewall.zone_vpn.auto_helper='0'
commit firewall
EOF
rmmod nf_nat_sip 2>&1 >/dev/null
sleep 2
rmmod nf_conntrack_sip 2>&1 >/dev/null
else
uci -q batch <<-EOF >/dev/null
set firewall.zone_lan.auto_helper='1'
set firewall.zone_wan.auto_helper='1'
set firewall.zone_vpn.auto_helper='1'
commit firewall
EOF
modprobe -q nf_conntrack_sip 2>&1 >/dev/null
sleep 2
modprobe -q nf_nat_sip 2>&1 >/dev/null
fi
if [ "$(uci -q get rpcd.@rpcd[0].socket)" != "/var/run/ubus/ubus.sock" ]; then
uci -q batch <<-EOF >/dev/null
set rpcd.@rpcd[0].socket='/var/run/ubus/ubus.sock'

View file

@ -159,7 +159,7 @@ function set_status(type, message, loading, show_log) {
function upgrade_check() {
var current_version = data.release.version.toLowerCase();
var current_branch = current_version.split('.').slice(0, 2).join('.')
var current_branch = current_version.split('-')[0].split('.').slice(0, 2).join('.')
var candidates = []
hide("#status_box");
hide("#server_div");

View file

@ -1322,7 +1322,7 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get openmptcprouter.$OMR_TRAC
local latestversions="$(curl -4 -s -m 3 https://www.openmptcprouter.com/version/version.json)"
[ -n "$latestversions" ] && {
uci -q set openmptcprouter.latest_versions=latest_versions
uci -q set openmptcprouter.latest_versions.omr=$(echo $latestversions | jsonfilter -q -e '@.omr')
uci -q set openmptcprouter.latest_versions.omr=$(echo $latestversions | jsonfilter -q -e '@.omr')-$(ubus call system board | jsonfilter -e '@.kernel' | cut -d'.' -f1,2)
uci -q set openmptcprouter.latest_versions.vps=$(echo $latestversions | jsonfilter -q -e '@.vps')
uci -q set openmptcprouter.latest_versions.lc=$(date +"%s")
}

View file

@ -1461,8 +1461,12 @@ _set_config_from_vps() {
uci -q batch <<-EOF >/dev/null
set openvpn.omr.port=$openvpn_port
set openvpn.omr.secret="/etc/luci-uploads/openvpn.key"
set openvpn.omr.enabled=$openvpn_state
EOF
if [ "$openvpn_state" = "1" ]; then
uci -q set openvpn.omr.enabled=$openvpn_state
else
uci -q del openvpn.omr.enabled
fi
if [ "$(uci -q get openvpn.omr.remote)" != "127.0.0.1" ]; then
uci -q set openvpn.omr.remote="$vpsip"
fi

View file

@ -242,7 +242,13 @@ uci -q batch <<-EOF >/dev/null
set firewall.@include[0].reload='1'
commit firewall
EOF
if [ "$(uci -q get openmptcprouter.settings.sipalg)" != "1" ]; then
if [ "$(uci -q get openmptcprouter.settings.sipalg)" = "" ]; then
uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.sipalg='1'
commit openmptcprouter
EOF
fi
if [ "$(uci -q get openmptcprouter.settings.sipalg)" = "0" ]; then
uci -q batch <<-EOF >/dev/null
set firewall.zone_lan.auto_helper='0'
set firewall.zone_wan.auto_helper='0'