luci-app-ssr-plus: sync with upstream source

This commit is contained in:
CN_SZTL 2020-08-27 21:21:27 +08:00
parent fe76bf3564
commit 3df5ee0d2b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 18 additions and 3 deletions

View File

@ -97,7 +97,7 @@ function refresh_data()
if file2 then luci.sys.exec("cp -f /tmp/ssr-update." .. type .. " " .. file2) end
retstring = tostring(tonumber(icount)/Num)
if type == "gfw_data" or type == "ad_data" then
luci.sys.exec("/usr/share/shadowsocksr/gfw2ipset.sh gfw_data")
luci.sys.exec("/usr/share/shadowsocksr/gfw2ipset.sh")
else
luci.sys.exec("/etc/init.d/shadowsocksr restart &")
end

View File

@ -749,10 +749,20 @@ start() {
cp -rf /etc/ssr/gfw_list.conf /tmp/dnsmasq.ssr/
cp -rf /etc/ssr/gfw_base.conf /tmp/dnsmasq.ssr/
fi
/usr/share/shadowsocksr/gfw2ipset.sh
/usr/share/shadowsocksr/gfw2ipset.sh $switch_server
else
/usr/bin/ssr-rules -f
fi
else
awk '!/^$/&&!/^#/{printf("address=/%s/''\n",$0)}' /etc/ssr/deny.list >/tmp/dnsmasq.ssr/denylist.conf
if [ "$(uci_get_by_type global adblock 0)" == "1" ]; then
[ "$1" == "" ] && cp -f /etc/ssr/ad.conf /tmp/dnsmasq.ssr/
if [ -f "/tmp/dnsmasq.ssr/ad.conf" ]; then
for line in $(cat /etc/ssr/black.list); do sed -i "/$line/d" /tmp/dnsmasq.ssr/ad.conf; done
for line in $(cat /etc/ssr/white.list); do sed -i "/$line/d" /tmp/dnsmasq.ssr/ad.conf; done
for line in $(cat /etc/ssr/deny.list); do sed -i "/$line/d" /tmp/dnsmasq.ssr/ad.conf; done
fi
fi
fi
/etc/init.d/dnsmasq restart >/dev/null 2>&1
start_server

View File

@ -1,10 +1,15 @@
#!/bin/sh
NAME=shadowsocksr
switch_server=$1
uci_get_by_type() {
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
echo ${ret:=$3}
}
GLOBAL_SERVER=$(uci_get_by_type global global_server)
if [ -z "$switch_server" ]; then
GLOBAL_SERVER=$(uci_get_by_type global global_server nil)
else
GLOBAL_SERVER=$switch_server
fi
NETFLIX_SERVER=$(uci_get_by_type global netflix_server nil)
[ "$NETFLIX_SERVER" == "same" ] && NETFLIX_SERVER=$GLOBAL_SERVER
if [ "$NETFLIX_SERVER" != "nil" ]; then