luci-app-passwall: sync with upstream source

This commit is contained in:
CN_SZTL 2020-02-29 04:55:31 +08:00
parent 992499a86f
commit 6493f0cf68
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 37 additions and 12 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.6
PKG_RELEASE:=6
PKG_RELEASE:=7
PKG_DATE:=20200228
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -1,3 +1,3 @@
<%+cbi/valueheader%>
<span class="auto_ping_value" cbiid="<%=section%>">-- ms</span>
<span class="auto_ping_value" cbiid="<%=section%>"></span>
<%+cbi/valuefooter%>

View File

@ -161,7 +161,9 @@ table td, .table .td {
var address = document.getElementById("cbid.passwall." + cbi_id + ".address").value;
var port = document.getElementById("cbid.passwall." + cbi_id + ".port").value;
<% end %>
if ((address != null && address != "") && (port != null && port != "")) {
//判断是否含有汉字
var reg = new RegExp("[\\u4E00-\\u9FFF]+","g");
if ((address != null && address != "") && (port != null && port != "") && reg.test(address) == false) {
ajax.post('<%=dsp.build_url("admin/vpn/passwall/ping_node")%>', {
index: index,
address: address,

View File

@ -266,7 +266,17 @@ gen_start_config() {
remarks=$(config_n_get $node remarks)
server_host=$(config_n_get $node address)
port=$(config_n_get $node port)
[ -n "$server_host" -a -n "$port" ] && echolog "$redir_type节点$remarks,节点:${server_host}:${port},监听端口:$local_port"
[ -n "$server_host" -a -n "$port" ] && {
# 过滤URL
server_host=$(echo $server_host | sed 's/^\(http:\/\/\|https:\/\/\)//g' | awk -F '/' '{print $1}')
# 过滤包含汉字的节点SB机场
local tmp=$(echo -n $server_host | awk '{print gensub(/[!-~]/,"","g",$0)}')
[ -n "$tmp" ] && {
echolog "$redir_type节点,非法的地址,无法启动!"
return 1
}
echolog "$redir_type节点$remarks,节点:${server_host}:${port},监听端口:$local_port"
}
if [ "$redir_type" == "SOCKS5" ]; then
eval SOCKS5_NODE${5}_PORT=$port

View File

@ -197,14 +197,27 @@ filter_vpsip() {
[ "$use_ipv6" == "1" ] && network_type="ipv6"
local server=$(u_get $i address)
[ -n "$server" ] && {
[ "$network_type" == "ipv4" ] && {
isip=$(echo $server | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}")
if [ -n "$isip" ]; then
ipset -! add $IPSET_VPSIPLIST $isip >/dev/null 2>&1 &
else
has=$([ -f "$TMP_DNSMASQ_PATH/vpsiplist_host.conf" ] && cat $TMP_DNSMASQ_PATH/vpsiplist_host.conf | grep "$server")
[ -z "$has" ] && echo "$server" | sed -e "/^$/d" | sed "s/^/ipset=&\//g" | sed "s/$/\/&vpsiplist/g" | sort | awk '{if ($0!=line) print;line=$0}' >> $TMP_DNSMASQ_PATH/vpsiplist_host.conf
fi
# 过滤URL
server=$(echo $server | sed 's/^\(http:\/\/\|https:\/\/\)//g' | awk -F '/' '{print $1}')
# 过滤包含汉字的节点SB机场
local tmp=$(echo -n $server | awk '{print gensub(/[!-~]/,"","g",$0)}')
[ -z "$tmp" ] && {
[ "$network_type" == "ipv4" ] && {
isip=$(echo $server | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}")
if [ -n "$isip" ]; then
ipset -! add $IPSET_VPSIPLIST $isip >/dev/null 2>&1 &
else
# 判断节点的服务器地址是否包含在GFWLIST比如某SB机场的 www.google.com 导致不走google代理
local suffix=$(echo ${server##*.})
local top_host=$(echo ${server%.*} | awk -F '.' '{print $NF}')
[ -n "$suffix" -a -n "$top_host" ] && server="$top_host.$suffix"
is_gfwlist=$(cat $TMP_DNSMASQ_PATH/gfwlist.conf | grep -c "$server")
[ "$is_gfwlist" == 0 ] && {
has=$([ -f "$TMP_DNSMASQ_PATH/vpsiplist_host.conf" ] && cat $TMP_DNSMASQ_PATH/vpsiplist_host.conf | grep "$server")
[ -z "$has" ] && echo "$server" | sed -e "/^$/d" | sed "s/^/ipset=&\//g" | sed "s/$/\/&vpsiplist/g" | sort | awk '{if ($0!=line) print;line=$0}' >> $TMP_DNSMASQ_PATH/vpsiplist_host.conf
}
fi
}
}
}
done