diff --git a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua index 1d19f4df9d..69f146a711 100644 --- a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua +++ b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua @@ -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 diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index c4c5985461..43fae11c9f 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -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 diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh index 969b4d89af..df2abdf158 100755 --- a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh @@ -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