mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-06-19 01:35:30 +08:00
luci-app-ssr-plus: Optimize and fix bugs (#3841)
This commit is contained in:
parent
033b0ec159
commit
830d3f946c
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-ssr-plus
|
PKG_NAME:=luci-app-ssr-plus
|
||||||
PKG_VERSION:=170
|
PKG_VERSION:=170
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
@ -77,9 +77,6 @@ define Package/$(PKG_NAME)/conffiles
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
define Package/$(PKG_NAME)/install
|
||||||
$(INSTALL_DIR) $(1)/etc
|
|
||||||
$(INSTALL_DATA) ./root/etc/china_ssr.txt $(1)/etc/china_ssr.txt
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
$(INSTALL_CONF) ./root/etc/config/shadowsocksr $(1)/etc/config/shadowsocksr
|
$(INSTALL_CONF) ./root/etc/config/shadowsocksr $(1)/etc/config/shadowsocksr
|
||||||
$(INSTALL_DATA) ./root/etc/config/*.list $(1)/etc/config/
|
$(INSTALL_DATA) ./root/etc/config/*.list $(1)/etc/config/
|
||||||
@ -118,27 +115,14 @@ endef
|
|||||||
|
|
||||||
define Package/$(PKG_NAME)/postinst
|
define Package/$(PKG_NAME)/postinst
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
rm -rf /tmp/luci-modulecache/*
|
||||||
( . /etc/uci-defaults/luci-ssr-plus ) && rm -f /etc/uci-defaults/luci-ssr-plus
|
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
/etc/init.d/shadowsocksr enable >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/prerm
|
|
||||||
#!/bin/sh
|
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
|
||||||
/etc/init.d/shadowsocksr disable
|
|
||||||
/etc/init.d/shadowsocksr stop
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/postrm
|
define Package/$(PKG_NAME)/postrm
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
rm -rf /etc/china_ssr.txt /etc/dnsmasq.ssr /etc/dnsmasq.oversea /etc/config/shadowsocksr /etc/config/black.list \
|
rm -rf /etc/china_ssr.txt /etc/dnsmasq.ssr /etc/dnsmasq.oversea /etc/config/shadowsocksr /etc/config/black.list \
|
||||||
/etc/config/gfw.list /etc/config/white.list >/dev/null 2>&1
|
/etc/config/gfw.list /etc/config/white.list /etc/config/netflix.list /etc/config/netflixip.list >/dev/null 2>&1
|
||||||
exit 0
|
exit 0
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -71,10 +71,10 @@ end
|
|||||||
|
|
||||||
function refresh_data()
|
function refresh_data()
|
||||||
local set =luci.http.formvalue("set")
|
local set =luci.http.formvalue("set")
|
||||||
|
local uci = luci.model.uci.cursor()
|
||||||
local icount =0
|
local icount =0
|
||||||
|
|
||||||
if set == "gfw_data" then
|
if set == "gfw_data" then
|
||||||
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
|
refresh_cmd = "wget-ssl --no-check-certificate -O - https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt > /tmp/gfw.b64"
|
||||||
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
if sret == 0 then
|
if sret == 0 then
|
||||||
luci.sys.call("/usr/bin/ssr-gfw")
|
luci.sys.call("/usr/bin/ssr-gfw")
|
||||||
@ -85,7 +85,7 @@ if set == "gfw_data" then
|
|||||||
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
|
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
|
||||||
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf")
|
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf")
|
||||||
luci.sys.call("/etc/init.d/dnsmasq restart")
|
luci.sys.call("/etc/init.d/dnsmasq restart")
|
||||||
retstring=tostring(math.ceil(tonumber(icount)/2))
|
retstring = tostring(tonumber(icount)/2)
|
||||||
else
|
else
|
||||||
retstring ="0"
|
retstring ="0"
|
||||||
end
|
end
|
||||||
@ -97,17 +97,14 @@ else
|
|||||||
retstring = "-1"
|
retstring = "-1"
|
||||||
end
|
end
|
||||||
elseif set == "ip_data" then
|
elseif set == "ip_data" then
|
||||||
if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute', '0') == '1') then
|
refresh_cmd = "wget-ssl --no-check-certificate -O - " .. uci:get_first('shadowsocksr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt'
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - " .. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt 2>/dev/null'
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
else
|
|
||||||
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
|
||||||
end
|
|
||||||
sret=luci.sys.call(refresh_cmd)
|
|
||||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||||
if sret == 0 and tonumber(icount) > 1000 then
|
if sret == 0 and tonumber(icount) > 1000 then
|
||||||
oldcount = luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
oldcount = luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
|
||||||
if tonumber(icount) ~= tonumber(oldcount) then
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
|
||||||
|
luci.sys.exec("/etc/init.d/shadowsocksr restart &")
|
||||||
retstring = tostring(tonumber(icount))
|
retstring = tostring(tonumber(icount))
|
||||||
else
|
else
|
||||||
retstring = "0"
|
retstring = "0"
|
||||||
@ -117,14 +114,10 @@ elseif set == "ip_data" then
|
|||||||
end
|
end
|
||||||
luci.sys.exec("rm -f /tmp/china_ssr.txt")
|
luci.sys.exec("rm -f /tmp/china_ssr.txt")
|
||||||
elseif set == "nfip_data" then
|
elseif set == "nfip_data" then
|
||||||
if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'netflix', '0') == '1') then
|
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'nfip_url','https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'nfip_url', 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
else
|
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt > /tmp/netflixip.list"
|
|
||||||
end
|
|
||||||
sret=luci.sys.call(refresh_cmd)
|
|
||||||
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
|
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
|
||||||
if sret== 0 and tonumber(icount)>1 then
|
if sret == 0 and tonumber(icount) > 5 then
|
||||||
oldcount = luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
|
oldcount = luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
|
||||||
if tonumber(icount) ~= tonumber(oldcount) then
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
|
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
|
||||||
@ -138,24 +131,22 @@ elseif set == "nfip_data" then
|
|||||||
end
|
end
|
||||||
luci.sys.exec("rm -f /tmp/netflixip.list")
|
luci.sys.exec("rm -f /tmp/netflixip.list")
|
||||||
else
|
else
|
||||||
if nixio.fs.access("/usr/bin/wget-ssl") then
|
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
|
||||||
end
|
|
||||||
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
if sret== 0 then
|
if sret== 0 then
|
||||||
luci.sys.call("/usr/bin/ssr-ad")
|
luci.sys.call("/usr/bin/ssr-ad")
|
||||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||||
if tonumber(icount)>1000 then
|
if tonumber(icount) > 100 then
|
||||||
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
||||||
oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
|
oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
|
||||||
else
|
else
|
||||||
oldcount=0
|
oldcount = "0"
|
||||||
end
|
end
|
||||||
if tonumber(icount) ~= tonumber(oldcount) then
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
|
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
|
||||||
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
|
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
|
||||||
luci.sys.call("/etc/init.d/dnsmasq restart")
|
luci.sys.call("/etc/init.d/dnsmasq restart")
|
||||||
retstring=tostring(math.ceil(tonumber(icount)))
|
retstring = tostring(tonumber(icount))
|
||||||
else
|
else
|
||||||
retstring = "0"
|
retstring = "0"
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
m = Map("shadowsocksr")
|
m = Map("shadowsocksr")
|
||||||
-- [[ global ]]--
|
-- [[ global ]]--
|
||||||
s = m:section(TypedSection, "global", translate("Server failsafe auto swith and custom update settings"))
|
s = m:section(TypedSection, "global", translate("Server failsafe auto swith and custom update settings"))
|
||||||
@ -27,12 +26,8 @@ o.datatype = "uinteger"
|
|||||||
o:depends("enable_switch", "1")
|
o:depends("enable_switch", "1")
|
||||||
o.default = 3
|
o.default = 3
|
||||||
|
|
||||||
o = s:option(Flag, "chnroute", translate("Enable Custom Chnroute"))
|
|
||||||
o.rmempty = false
|
|
||||||
|
|
||||||
o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
|
o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
|
||||||
o.default = "https://ispip.clang.cn/all_cn.txt"
|
o.default = "https://ispip.clang.cn/all_cn.txt"
|
||||||
o:depends("chnroute", "1")
|
|
||||||
|
|
||||||
o = s:option(Flag, "adblock", translate("Enable adblock"))
|
o = s:option(Flag, "adblock", translate("Enable adblock"))
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
@ -42,12 +37,8 @@ o.default = "https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-
|
|||||||
o:depends("adblock", "1")
|
o:depends("adblock", "1")
|
||||||
o.description = translate("Support AdGuardHome and DNSMASQ format list")
|
o.description = translate("Support AdGuardHome and DNSMASQ format list")
|
||||||
|
|
||||||
o = s:option(Flag, "netflix", translate("Enable Custom Netflix IP Url"))
|
|
||||||
o.rmempty = false
|
|
||||||
|
|
||||||
o = s:option(Value, "nfip_url", translate("nfip_url"))
|
o = s:option(Value, "nfip_url", translate("nfip_url"))
|
||||||
o.default = "https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
|
o.default = "https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
|
||||||
o:depends("netflix", "1")
|
|
||||||
o.description = translate("Customize Netflix IP Url")
|
o.description = translate("Customize Netflix IP Url")
|
||||||
|
|
||||||
-- [[ SOCKS Proxy ]]--
|
-- [[ SOCKS Proxy ]]--
|
||||||
|
@ -14,12 +14,10 @@ local function isKcptun(file)
|
|||||||
if not fs.access(file, "rwx", "rx", "rx") then
|
if not fs.access(file, "rwx", "rx", "rx") then
|
||||||
fs.chmod(file, 755)
|
fs.chmod(file, 755)
|
||||||
end
|
end
|
||||||
|
|
||||||
local str = sys.exec(file .. " -v | awk '{printf $1}'")
|
local str = sys.exec(file .. " -v | awk '{printf $1}'")
|
||||||
return (str:lower() == "kcptun")
|
return (str:lower() == "kcptun")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local server_table = {}
|
local server_table = {}
|
||||||
local encrypt_methods = {
|
local encrypt_methods = {
|
||||||
"none",
|
"none",
|
||||||
|
@ -12,8 +12,6 @@ end)
|
|||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
|
|
||||||
local ucic = luci.model.uci.cursor()
|
|
||||||
|
|
||||||
m = Map(shadowsocksr, translate("Servers subscription and manage"))
|
m = Map(shadowsocksr, translate("Servers subscription and manage"))
|
||||||
|
|
||||||
-- Server Subscribe
|
-- Server Subscribe
|
||||||
@ -117,9 +115,9 @@ o.width="10%"
|
|||||||
node = s:option(Button,"apply_node",translate("Apply"))
|
node = s:option(Button,"apply_node",translate("Apply"))
|
||||||
node.inputstyle = "apply"
|
node.inputstyle = "apply"
|
||||||
node.write = function(self, section)
|
node.write = function(self, section)
|
||||||
ucic:set("shadowsocksr", '@global[0]', 'global_server', section)
|
uci:set("shadowsocksr", '@global[0]', 'global_server', section)
|
||||||
ucic:save("shadowsocksr")
|
uci:save("shadowsocksr")
|
||||||
ucic:commit("shadowsocksr")
|
uci:commit("shadowsocksr")
|
||||||
luci.sys.exec("/etc/init.d/shadowsocksr restart")
|
luci.sys.exec("/etc/init.d/shadowsocksr restart")
|
||||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "client"))
|
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "client"))
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
|
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
|
||||||
-- Licensed to the public under the GNU General Public License v3.
|
-- Licensed to the public under the GNU General Public License v3.
|
||||||
|
|
||||||
local IPK_Version="3.0.9"
|
|
||||||
local m, s, o
|
local m, s, o
|
||||||
local redir_run=0
|
local redir_run=0
|
||||||
local reudp_run=0
|
local reudp_run=0
|
||||||
@ -9,13 +8,11 @@ local sock5_run=0
|
|||||||
local server_run=0
|
local server_run=0
|
||||||
local kcptun_run=0
|
local kcptun_run=0
|
||||||
local tunnel_run=0
|
local tunnel_run=0
|
||||||
local udp2raw_run=0
|
|
||||||
local udpspeeder_run=0
|
|
||||||
local gfw_count=0
|
local gfw_count=0
|
||||||
local ad_count=0
|
local ad_count=0
|
||||||
local ip_count=0
|
local ip_count=0
|
||||||
local nfip_count=0
|
local nfip_count=0
|
||||||
local ucic = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
local shadowsocksr = "shadowsocksr"
|
local shadowsocksr = "shadowsocksr"
|
||||||
-- html constants
|
-- html constants
|
||||||
font_blue = [[<font color="green">]]
|
font_blue = [[<font color="green">]]
|
||||||
@ -49,11 +46,11 @@ ad_count=tonumber(sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l"))
|
|||||||
end
|
end
|
||||||
|
|
||||||
if nixio.fs.access("/etc/china_ssr.txt") then
|
if nixio.fs.access("/etc/china_ssr.txt") then
|
||||||
ip_count = sys.exec("cat /etc/china_ssr.txt | wc -l")
|
ip_count = tonumber(sys.exec("cat /etc/china_ssr.txt | wc -l"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if nixio.fs.access("/etc/config/netflixip.list") then
|
if nixio.fs.access("/etc/config/netflixip.list") then
|
||||||
nfip_count = sys.exec("cat /etc/config/netflixip.list | wc -l")
|
nfip_count = tonumber(sys.exec("cat /etc/config/netflixip.list | wc -l"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local icount=sys.exec("busybox ps -w | grep ssr-reudp |grep -v grep| wc -l")
|
local icount=sys.exec("busybox ps -w | grep ssr-reudp |grep -v grep| wc -l")
|
||||||
@ -110,7 +107,7 @@ else
|
|||||||
s.value = translate("Not Running")
|
s.value = translate("Not Running")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ucic:get_first(shadowsocksr, 'global', 'pdnsd_enable', '0') ~= '0' then
|
if uci:get_first(shadowsocksr, 'global', 'pdnsd_enable', '0') ~= '0' then
|
||||||
s=m:field(DummyValue,"pdnsd_run",translate("DNS Anti-pollution"))
|
s=m:field(DummyValue,"pdnsd_run",translate("DNS Anti-pollution"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
if pdnsd_run == 1 then
|
if pdnsd_run == 1 then
|
||||||
@ -120,7 +117,7 @@ s.value = translate("Not Running")
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ucic:get_first(shadowsocksr, 'socks5_proxy', 'socks', '0') == '1' then
|
if uci:get_first(shadowsocksr, 'socks5_proxy', 'socks', '0') == '1' then
|
||||||
if nixio.fs.access("/usr/bin/microsocks") then
|
if nixio.fs.access("/usr/bin/microsocks") then
|
||||||
s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy Server"))
|
s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy Server"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
@ -146,7 +143,6 @@ if nixio.fs.access("/usr/bin/kcptun-client") then
|
|||||||
s=m:field(DummyValue,"kcp_version",translate("KcpTun Version"))
|
s=m:field(DummyValue,"kcp_version",translate("KcpTun Version"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
s.value =kcptun_version
|
s.value =kcptun_version
|
||||||
|
|
||||||
s=m:field(DummyValue,"kcptun_run",translate("KcpTun"))
|
s=m:field(DummyValue,"kcptun_run",translate("KcpTun"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
if kcptun_run == 1 then
|
if kcptun_run == 1 then
|
||||||
@ -167,7 +163,7 @@ s.template = "shadowsocksr/check"
|
|||||||
s=m:field(DummyValue,"gfw_data",translate("GFW List Data"))
|
s=m:field(DummyValue,"gfw_data",translate("GFW List Data"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
s.template = "shadowsocksr/refresh"
|
s.template = "shadowsocksr/refresh"
|
||||||
s.value =tostring(math.ceil(gfw_count)) .. " " .. translate("Records")
|
s.value = gfw_count .. " " .. translate("Records")
|
||||||
|
|
||||||
s=m:field(DummyValue,"ip_data",translate("China IP Data"))
|
s=m:field(DummyValue,"ip_data",translate("China IP Data"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
@ -179,7 +175,7 @@ s.rawhtml = true
|
|||||||
s.template = "shadowsocksr/refresh"
|
s.template = "shadowsocksr/refresh"
|
||||||
s.value = nfip_count .. " " .. translate("Records")
|
s.value = nfip_count .. " " .. translate("Records")
|
||||||
|
|
||||||
if ucic:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then
|
if uci:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then
|
||||||
s=m:field(DummyValue,"ad_data",translate("Advertising Data"))
|
s=m:field(DummyValue,"ad_data",translate("Advertising Data"))
|
||||||
s.rawhtml = true
|
s.rawhtml = true
|
||||||
s.template = "shadowsocksr/refresh"
|
s.template = "shadowsocksr/refresh"
|
||||||
|
@ -334,9 +334,6 @@ msgstr "启用广告屏蔽"
|
|||||||
msgid "adblock_url"
|
msgid "adblock_url"
|
||||||
msgstr "广告屏蔽订阅"
|
msgstr "广告屏蔽订阅"
|
||||||
|
|
||||||
msgid "Enable Custom Netflix IP Url"
|
|
||||||
msgstr "启用自定义Netflix IP更新URL"
|
|
||||||
|
|
||||||
msgid "nfip_url"
|
msgid "nfip_url"
|
||||||
msgstr "Netflix IP更新URL"
|
msgstr "Netflix IP更新URL"
|
||||||
|
|
||||||
@ -352,9 +349,6 @@ msgstr "【广告屏蔽】数据库"
|
|||||||
msgid "Chnroute Setting"
|
msgid "Chnroute Setting"
|
||||||
msgstr "国内IP段数据库更新设置"
|
msgstr "国内IP段数据库更新设置"
|
||||||
|
|
||||||
msgid "Enable custom chnroute"
|
|
||||||
msgstr "启用自定义更新地址"
|
|
||||||
|
|
||||||
msgid "Update url"
|
msgid "Update url"
|
||||||
msgstr "更新链接"
|
msgstr "更新链接"
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,6 @@ config global
|
|||||||
option switch_try_count '3'
|
option switch_try_count '3'
|
||||||
option adblock '0'
|
option adblock '0'
|
||||||
option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
|
option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
|
||||||
option chnroute '1'
|
|
||||||
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
|
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
|
||||||
option nfip_url 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt'
|
option nfip_url 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt'
|
||||||
option netflix_server 'same'
|
option netflix_server 'same'
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -68,7 +68,6 @@ add_cron() {
|
|||||||
sed -i '/shadowsocksr/d' $CRON_FILE
|
sed -i '/shadowsocksr/d' $CRON_FILE
|
||||||
sed -i '/ssrplus.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/ssrplus.log' >>$CRON_FILE
|
sed -i '/ssrplus.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/ssrplus.log' >>$CRON_FILE
|
||||||
[ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/share/shadowsocksr/ssrplusupdate.sh" >>$CRON_FILE
|
[ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/share/shadowsocksr/ssrplusupdate.sh" >>$CRON_FILE
|
||||||
|
|
||||||
crontab $CRON_FILE
|
crontab $CRON_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +431,6 @@ start_redir() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$UDP_RELAY_SERVER" ]; then
|
if [ -n "$UDP_RELAY_SERVER" ]; then
|
||||||
redir_udp=1
|
redir_udp=1
|
||||||
if [ "$utype" == "ss" -o "$utype" == "ssr" ]; then
|
if [ "$utype" == "ss" -o "$utype" == "ssr" ]; then
|
||||||
@ -725,4 +723,3 @@ stop() {
|
|||||||
fi
|
fi
|
||||||
del_cron
|
del_cron
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ uci -q batch <<-EOF >/dev/null
|
|||||||
commit firewall
|
commit firewall
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
killall -q -9 ssr-monitor ss-redir ssr-redir v2ray trojan ipt2socks ssr-server kcptun-client srelay
|
killall -q -9 ssr-monitor ss-redir ssr-redir ss-local ssr-local obfs-local v2ray-plugin v2ray trojan ipt2socks ssr-server kcptun-client dns2socks microsocks redsocks2
|
||||||
/usr/share/shadowsocksr/gfw2ipset.sh
|
/usr/share/shadowsocksr/gfw2ipset.sh
|
||||||
rm -f /tmp/luci-indexcache
|
rm -f /tmp/luci-indexcache
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -383,7 +383,6 @@ local execute = function()
|
|||||||
end
|
end
|
||||||
log('忽略手动添加的节点: ' .. old.alias)
|
log('忽略手动添加的节点: ' .. old.alias)
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
for k, v in ipairs(nodeResult) do
|
for k, v in ipairs(nodeResult) do
|
||||||
for kk, vv in ipairs(v) do
|
for kk, vv in ipairs(v) do
|
||||||
|
@ -8,14 +8,14 @@ require 'luci.util'
|
|||||||
require 'luci.jsonc'
|
require 'luci.jsonc'
|
||||||
require 'luci.sys'
|
require 'luci.sys'
|
||||||
local icount =0
|
local icount =0
|
||||||
local ucic = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
|
|
||||||
local log = function(...)
|
local log = function(...)
|
||||||
print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " "))
|
print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " "))
|
||||||
end
|
end
|
||||||
|
|
||||||
log('正在更新【GFW列表】数据库')
|
log('正在更新【GFW列表】数据库')
|
||||||
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
|
refresh_cmd = "wget-ssl --no-check-certificate -O - https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt > /tmp/gfw.b64"
|
||||||
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
if sret == 0 then
|
if sret == 0 then
|
||||||
luci.sys.call("/usr/bin/ssr-gfw")
|
luci.sys.call("/usr/bin/ssr-gfw")
|
||||||
@ -38,12 +38,8 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
log('正在更新【国内IP段】数据库')
|
log('正在更新【国内IP段】数据库')
|
||||||
if (ucic:get_first('shadowsocksr', 'global', 'chnroute','0') == '1' ) then
|
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'chnroute_url','https://ispip.clang.cn/all_cn.txt') .." > /tmp/china_ssr.txt"
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'chnroute_url','https://ispip.clang.cn/all_cn.txt') .." > /tmp/china_ssr.txt 2>/dev/null"
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
else
|
|
||||||
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
|
|
||||||
end
|
|
||||||
sret=luci.sys.call(refresh_cmd)
|
|
||||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||||
if sret == 0 then
|
if sret == 0 then
|
||||||
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
|
||||||
@ -63,20 +59,18 @@ else
|
|||||||
log('更新失败!')
|
log('更新失败!')
|
||||||
end
|
end
|
||||||
|
|
||||||
if ucic:get_first('shadowsocksr', 'global', 'adblock','0') == "1" then
|
if uci:get_first('shadowsocksr', 'global', 'adblock','0') == "1" then
|
||||||
log('正在更新【广告屏蔽】数据库')
|
log('正在更新【广告屏蔽】数据库')
|
||||||
if nixio.fs.access("/usr/bin/wget-ssl") then
|
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
||||||
refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
|
|
||||||
end
|
|
||||||
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
if sret == 0 then
|
if sret == 0 then
|
||||||
luci.sys.call("/usr/bin/ssr-ad")
|
luci.sys.call("/usr/bin/ssr-ad")
|
||||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||||
if tonumber(icount)>1000 then
|
if tonumber(icount) > 100 then
|
||||||
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
|
||||||
oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
|
oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
|
||||||
else
|
else
|
||||||
oldcount=0
|
oldcount = "0"
|
||||||
end
|
end
|
||||||
if tonumber(icount) ~= tonumber(oldcount) then
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
|
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
|
||||||
@ -94,4 +88,26 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
luci.sys.call("/etc/init.d/dnsmasq reload")
|
--[[
|
||||||
|
log('正在更新【Netflix IP段】数据库')
|
||||||
|
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'nfip_url','https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
|
||||||
|
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||||
|
if sret == 0 then
|
||||||
|
luci.sys.call("/usr/bin/ssr-gfw")
|
||||||
|
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
|
||||||
|
if tonumber(icount) > 5 then
|
||||||
|
oldcount = luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
|
||||||
|
if tonumber(icount) ~= tonumber(oldcount) then
|
||||||
|
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
|
||||||
|
log('更新成功! 新的总纪录数:'.. icount)
|
||||||
|
else
|
||||||
|
log('你已经是最新数据,无需更新!')
|
||||||
|
end
|
||||||
|
else
|
||||||
|
log('更新失败!')
|
||||||
|
end
|
||||||
|
luci.sys.exec("rm -f /tmp/netflixip.list")
|
||||||
|
else
|
||||||
|
log('更新失败!')
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user