luci-app-passwall: bump to 3.9-42

This commit is contained in:
CN_SZTL 2020-08-23 03:20:20 +08:00
parent ecdf1da9df
commit 914357882c
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
10 changed files with 1961 additions and 5 deletions

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.9
PKG_RELEASE:=41
PKG_DATE:=20200820
PKG_RELEASE:=42
PKG_DATE:=20200822
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -21,7 +21,6 @@ function to_check(arch)
end
file_tree = "_linux_" .. file_tree
if file_tree == "_linux_amd64" then file_tree = "" end
local json = api.get_api_json(brook_api)

View File

@ -33,6 +33,12 @@ o:value("https://ispip.clang.cn/all_cn_cidr.txt", translate("Clang.CN.CIDR"))
o.default = "https://ispip.clang.cn/all_cn.txt"
--o:depends("enable_custom_url", 1)
----chnroute6 URL
o = s:option(Value, "chnroute6_url", translate("China IPv6s(chnroute6) Update URL"))
o:value("https://ispip.clang.cn/all_cn_ipv6.txt", translate("Clang.CN.IPv6"))
o.default = "https://ispip.clang.cn/all_cn_ipv6.txt"
--o:depends("enable_custom_url", 1)
---- Auto Update
o = s:option(Flag, "auto_update", translate("Enable auto update rules"))
o.default = 0

View File

@ -3,10 +3,12 @@ local api = require "luci.model.cbi.passwall.api.api"
local gfwlist_version = api.uci_get_type("global_rules", "gfwlist_version")
local chnroute_version = api.uci_get_type("global_rules", "chnroute_version")
local chnroute6_version = api.uci_get_type("global_rules", "chnroute6_version")
local chnlist_version = api.uci_get_type("global_rules", "chnlist_version")
local gfwlist_update = api.uci_get_type("global_rules", "gfwlist_update", "1") == "1" and "checked='checked'" or ""
local chnroute_update = api.uci_get_type("global_rules", "chnroute_update", "1") == "1" and "checked='checked'" or ""
local chnroute6_update = api.uci_get_type("global_rules", "chnroute6_update", "1") == "1" and "checked='checked'" or ""
local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") == "1" and "checked='checked'" or ""
-%>
@ -66,6 +68,18 @@ local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") =
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnroute6
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=chnroute6_version%> 】</span>
<input type="checkbox" name="chnroute6_update" value="1" <%=chnroute6_update%> />
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">chnlist

View File

@ -622,6 +622,9 @@ msgstr "防火墙域名列表(gfwlist)更新URL"
msgid "China IPs(chnroute) Update URL"
msgstr "中国IP段(chnroute)更新URL"
msgid "China IPv6s(chnroute) Update URL"
msgstr "中国IPv6段(chnroute)更新URL"
msgid "Rule status"
msgstr "规则版本"
@ -880,6 +883,9 @@ msgstr "原版Trojan不支持'none'请选择TLS。"
msgid "Domain"
msgstr "域名"
msgid "allowInsecure"
msgstr "允许不安全连接"
msgid "Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."
msgstr "是否允许不安全连接。当勾选时,将跳过证书验证。"

View File

@ -40,13 +40,16 @@ config global_rules
option auto_update '0'
option chnlist_update '1'
option chnroute_update '1'
option chnroute6_update '0'
option gfwlist_update '1'
option gfwlist_version '2020-08-20'
option chnroute_version '2020-08-20'
option chnroute6_version '2020-08-20'
option chnlist_version '2020-08-20'
option enable_custom_url '0'
option gfwlist_url 'https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt'
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
option chnroute6_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
config global_app
option v2ray_file '/usr/bin/v2ray/'

View File

@ -772,6 +772,7 @@ add_dnsmasq() {
[ -n "${gfwlist}" ] || [ "${filtered_dns}" = "1" ] && [ -z "${returnhome}" ] && {
[ "${filtered_dns}" = "1" ] && [ "${DNS_MODE}" != "chinadns-ng" ] && unset fwd_dns
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/gfwlist.conf"
#sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}"
}

View File

@ -3,7 +3,9 @@
IPSET_LANIPLIST="laniplist"
IPSET_VPSIPLIST="vpsiplist"
IPSET_GFW="gfwlist"
#IPSET_GFW6="gfwlist6"
IPSET_CHN="chnroute"
IPSET_CHN6="chnroute6"
IPSET_BLACKLIST="blacklist"
IPSET_WHITELIST="whitelist"
@ -333,11 +335,14 @@ add_firewall_rule() {
ipset -! create $IPSET_LANIPLIST nethash
ipset -! create $IPSET_VPSIPLIST nethash
ipset -! create $IPSET_GFW nethash
#ipset -! create $IPSET_GFW6 nethash family inet6
ipset -! create $IPSET_CHN nethash
ipset -! create $IPSET_CHN6 nethash family inet6
ipset -! create $IPSET_BLACKLIST nethash
ipset -! create $IPSET_WHITELIST nethash
cat $RULES_PATH/chnroute | sed -e "/^$/d" | sed -e "s/^/add $IPSET_CHN &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/chnroute6 | sed -e "/^$/d" | sed -e "s/^/add $IPSET_CHN6 &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/proxy_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_BLACKLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
cat $RULES_PATH/direct_ip | sed -e "/^$/d" | sed -e "s/^/add $IPSET_WHITELIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
@ -577,7 +582,9 @@ del_firewall_rule() {
ipset -F $IPSET_LANIPLIST >/dev/null 2>&1 && ipset -X $IPSET_LANIPLIST >/dev/null 2>&1 &
ipset -F $IPSET_VPSIPLIST >/dev/null 2>&1 && ipset -X $IPSET_VPSIPLIST >/dev/null 2>&1 &
#ipset -F $IPSET_GFW >/dev/null 2>&1 && ipset -X $IPSET_GFW >/dev/null 2>&1 &
#ipset -F $IPSET_GFW6 >/dev/null 2>&1 && ipset -X $IPSET_GFW6 >/dev/null 2>&1 &
#ipset -F $IPSET_CHN >/dev/null 2>&1 && ipset -X $IPSET_CHN >/dev/null 2>&1 &
#ipset -F $IPSET_CHN6 >/dev/null 2>&1 && ipset -X $IPSET_CHN6 >/dev/null 2>&1 &
#ipset -F $IPSET_BLACKLIST >/dev/null 2>&1 && ipset -X $IPSET_BLACKLIST >/dev/null 2>&1 &
ipset -F $IPSET_WHITELIST >/dev/null 2>&1 && ipset -X $IPSET_WHITELIST >/dev/null 2>&1 &
#echolog "删除相关防火墙规则完成。"
@ -587,7 +594,9 @@ flush_ipset() {
ipset -F $IPSET_LANIPLIST >/dev/null 2>&1 && ipset -X $IPSET_LANIPLIST >/dev/null 2>&1 &
ipset -F $IPSET_VPSIPLIST >/dev/null 2>&1 && ipset -X $IPSET_VPSIPLIST >/dev/null 2>&1 &
ipset -F $IPSET_GFW >/dev/null 2>&1 && ipset -X $IPSET_GFW >/dev/null 2>&1 &
#ipset -F $IPSET_GFW6 >/dev/null 2>&1 && ipset -X $IPSET_GFW6 >/dev/null 2>&1 &
ipset -F $IPSET_CHN >/dev/null 2>&1 && ipset -X $IPSET_CHN >/dev/null 2>&1 &
ipset -F $IPSET_CHN6 >/dev/null 2>&1 && ipset -X $IPSET_CHN6 >/dev/null 2>&1 &
ipset -F $IPSET_BLACKLIST >/dev/null 2>&1 && ipset -X $IPSET_BLACKLIST >/dev/null 2>&1 &
ipset -F $IPSET_WHITELIST >/dev/null 2>&1 && ipset -X $IPSET_WHITELIST >/dev/null 2>&1 &
}

View File

@ -11,13 +11,14 @@ local url_main = 'https://cdn.jsdelivr.net/gh/hq450/fancyss/rules'
local reboot = 0
local gfwlist_update = 0
local chnroute_update = 0
local chnroute6_update = 0
local chnlist_update = 0
-- match comments/title/whitelist/ip address/excluded_domain
local comment_pattern = "^[!\\[@]+"
local ip_pattern = "^%d+%.%d+%.%d+%.%d+"
local domain_pattern = "([%w%-%_]+%.[%w%.%-%_]+)[%/%*]*"
local excluded_domain = {"apple.com", "sina.cn","sina.com.cn","baidu.com","byr.cn","jlike.com","weibo.com","zhongsou.com","youdao.com","sogou.com","so.com","soso.com","aliyun.com","taobao.com","jd.com","qq.com"}
local excluded_domain = {"apple.com","sina.cn","sina.com.cn","baidu.com","byr.cn","jlike.com","weibo.com","zhongsou.com","youdao.com","sogou.com","so.com","soso.com","aliyun.com","taobao.com","jd.com","qq.com"}
-- gfwlist parameter
local mydnsip = '127.0.0.1'
@ -29,6 +30,7 @@ local enable_custom_url = ucic:get_first(name, 'global_rules', "enable_custom_ur
enable_custom_url = 1
local gfwlist_url = ucic:get_first(name, 'global_rules', "gfwlist_url", "https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt")
local chnroute_url = ucic:get_first(name, 'global_rules', "chnroute_url", "https://ispip.clang.cn/all_cn.txt")
local chnroute6_url = ucic:get_first(name, 'global_rules', "chnroute6_url", "https://ispip.clang.cn/all_cn_ipv6.txt")
local chnlist_url_1 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf'
local chnlist_url_2 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf'
local chnlist_url_3 = 'https://cdn.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/google.china.conf'
@ -125,6 +127,13 @@ local function fetch_chnroute()
return sret;
end
--获取chnroute6
local function fetch_chnroute6()
--请求chnroute6
local sret = curl(chnroute6_url, "/tmp/chnroute6_tmp")
return sret;
end
--获取chnlist
local function fetch_chnlist()
--请求chnlist
@ -213,6 +222,9 @@ if arg[2] then
end
if arg[2]:find("chnroute") then
chnroute_update = 1
end
if arg[2]:find("chnroute6") then
chnroute6_update = 1
end
if arg[2]:find("chnlist") then
chnlist_update = 1
@ -220,9 +232,10 @@ if arg[2] then
else
gfwlist_update = ucic:get_first(name, 'global_rules', "gfwlist_update", 1)
chnroute_update = ucic:get_first(name, 'global_rules', "chnroute_update", 1)
chnroute6_update = ucic:get_first(name, 'global_rules', "chnroute6_update", 1)
chnlist_update = ucic:get_first(name, 'global_rules', "chnlist_update", 1)
end
if gfwlist_update == 0 and chnroute_update == 0 and chnlist_update == 0 then
if gfwlist_update == 0 and chnroute_update == 0 and chnroute6_update == 0 and chnlist_update == 0 then
os.exit(0)
end
@ -271,6 +284,26 @@ if tonumber(enable_custom_url) == 1 then
end
os.remove("/tmp/chnroute_tmp")
end
if tonumber(chnroute6_update) == 1 then
log("开始更新chnroute6...")
local old_md5 = luci.sys.exec("echo -n $(md5sum " .. rule_path .. "/chnroute6 | awk '{print $1}')")
local status = fetch_chnroute6()
if status == 200 then
local new_md5 = luci.sys.exec("echo -n $([ -f '/tmp/chnroute6_tmp' ] && md5sum /tmp/chnroute6_tmp | awk '{print $1}')")
if old_md5 ~= new_md5 then
luci.sys.exec("mv -f /tmp/chnroute6_tmp " .. rule_path .. "/chnroute6")
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute6_version", new_version)
reboot = 1
log("更新chnroute6成功...")
else
log("chnroute6版本一致不用更新。")
end
else
log("chnroute6文件下载失败")
end
os.remove("/tmp/chnroute6_tmp")
end
if tonumber(chnlist_update) == 1 then
log("开始更新chnlist...")
@ -382,6 +415,7 @@ end
ucic:set(name, ucic:get_first(name, 'global_rules'), "gfwlist_update", gfwlist_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute_update", chnroute_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnroute6_update", chnroute6_update)
ucic:set(name, ucic:get_first(name, 'global_rules'), "chnlist_update", chnlist_update)
ucic:save(name)
luci.sys.call("uci commit " .. name)

File diff suppressed because it is too large Load Diff