mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
luci-app-ssr-plus: add subscribe keyword filter
This commit is contained in:
parent
08b73fa42d
commit
cdf1ae96c3
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=175
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -36,6 +36,10 @@ o.rmempty = false
|
||||
o = s:option(DynamicList, "subscribe_url", translate("Subscribe URL"))
|
||||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "filter_words", translate("Subscribe Filter Words"))
|
||||
o.rmempty = true
|
||||
o.description = translate("Filter Words splited by /")
|
||||
|
||||
o = s:option(Button,"update_Sub",translate("Update Subscribe List"))
|
||||
o.inputstyle = "reload"
|
||||
o.description = translate("Update subscribe url list first")
|
||||
|
@ -430,6 +430,12 @@ msgstr "自动更新服务器订阅、GFW列表和 CHN路由表"
|
||||
msgid "Subscribe URL"
|
||||
msgstr "SS/SSR/V2/TROJAN订阅URL"
|
||||
|
||||
msgid "Subscribe Filter Words"
|
||||
msgstr "订阅节点关键字过滤"
|
||||
|
||||
msgid "Filter Words splited by /"
|
||||
msgstr "命中关键字的节点将被丢弃。多个关键字用 / 分隔"
|
||||
|
||||
msgid "Update"
|
||||
msgstr "更新"
|
||||
|
||||
@ -569,7 +575,7 @@ msgid "Update Subscribe List"
|
||||
msgstr "更新订阅URL列表"
|
||||
|
||||
msgid "Update subscribe url list first"
|
||||
msgstr "订阅服务器节点前,请先更新订阅URL列表"
|
||||
msgstr "修改订阅URL和节点关键字后,请先点击更新"
|
||||
|
||||
msgid "Update All Subscribe Severs"
|
||||
msgstr "更新所有订阅服务器节点"
|
||||
|
@ -40,6 +40,4 @@ config server_subscribe
|
||||
option proxy '0'
|
||||
option auto_update_time '2'
|
||||
option auto_update '1'
|
||||
|
||||
|
||||
|
||||
option filter_words '过期时间/剩余流量/QQ群/官网/防失联地址/回国'
|
||||
|
@ -23,6 +23,7 @@ local ucic = uci.cursor()
|
||||
local proxy = ucic:get_first(name, 'server_subscribe', 'proxy', '0')
|
||||
local switch = ucic:get_first(name, 'server_subscribe', 'switch', '1')
|
||||
local subscribe_url = ucic:get_first(name, 'server_subscribe', 'subscribe_url', {})
|
||||
local filter_words = ucic:get_first(name, 'server_subscribe', 'filter_words', 'QQ群')
|
||||
|
||||
local log = function(...)
|
||||
print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " "))
|
||||
@ -274,10 +275,22 @@ local function processData(szType, content)
|
||||
end
|
||||
-- wget
|
||||
local function wget(url)
|
||||
local stdout = luci.sys.exec('wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' .. url .. '"')
|
||||
local stdout = luci.sys.exec('wget-ssl -q --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' .. url .. '"')
|
||||
return trim(stdout)
|
||||
end
|
||||
|
||||
local function check_filer(result)
|
||||
do
|
||||
local filter_word = split(filter_words, "/")
|
||||
for i, v in pairs(filter_word) do
|
||||
if result.alias:find(v) then
|
||||
log('订阅节点关键字过滤:“' .. v ..'” ,该节点被丢弃')
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local execute = function()
|
||||
-- exec
|
||||
do
|
||||
@ -335,13 +348,10 @@ local execute = function()
|
||||
end
|
||||
-- log(result)
|
||||
if result then
|
||||
if result.alias:find("过期时间") or
|
||||
result.alias:find("剩余流量") or
|
||||
result.alias:find("QQ群") or
|
||||
result.alias:find("官网") or
|
||||
result.alias:find("防失联地址") or
|
||||
not result.server or
|
||||
result.server:match("[^0-9a-zA-Z%-%.%s]") -- 中文做地址的 也没有人拿中文域名搞,就算中文域也有Puny Code SB 机场
|
||||
if
|
||||
not result.server or
|
||||
check_filer(result) or
|
||||
result.server:match("[^0-9a-zA-Z%-%.%s]") -- 中文做地址的 也没有人拿中文域名搞,就算中文域也有Puny Code SB 机场
|
||||
then
|
||||
log('丢弃无效节点: ' .. result.type ..' 节点, ' .. result.alias)
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user