luci-app-passwall: sync with upstream source

This commit is contained in:
CN_SZTL 2019-12-31 15:05:34 +08:00
parent 1beef3fa80
commit 1290c6b034
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 47 additions and 33 deletions

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=3.0
PKG_RELEASE:=142-20191228
PKG_RELEASE:=145-20191231
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PO2LMO:=./po2lmo

View File

@ -2,13 +2,14 @@ local ucursor = require"luci.model.uci".cursor()
local json = require "luci.jsonc"
local node_section = arg[1]
local run_type = arg[2]
local proxy_port = arg[3]
local local_addr = arg[3]
local local_port = arg[4]
local node = ucursor:get_all("passwall", node_section)
local trojan = {
run_type = run_type,
local_addr = "0.0.0.0",
local_port = proxy_port,
local_addr = local_addr,
local_port = local_port,
remote_addr = node.address,
remote_port = tonumber(node.port),
password = {node.password},

View File

@ -39,7 +39,7 @@ table td, .table .td {
var xhr = new XMLHttpRequest();
var code = ajax.encode(data);
xhr.open("POST", url, true);
xhr.timeout = 2000;
xhr.timeout = 1000;
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.ontimeout = function() {
fn_timeout(xhr);
@ -102,9 +102,13 @@ table td, .table .td {
function ping_node(cbi_id,dom) {
<% if compact_display_nodes and tonumber(compact_display_nodes) == 1 then %>
var remarks = document.getElementById("cbid.passwall." + cbi_id + ".remarks").value;
var address_full = remarks.substring(remarks.lastIndexOf("") + 1, remarks.lastIndexOf(""));
var address = address_full.substring(0, address_full.lastIndexOf(":"));
var port = address_full.substring(address_full.lastIndexOf(":") + 1);
var address = null;
var port = null;
if (remarks.lastIndexOf("") != -1 && remarks.lastIndexOf("") != -1) {
var address_full = remarks.substring(remarks.lastIndexOf("") + 1, remarks.lastIndexOf(""));
address = address_full.substring(0, address_full.lastIndexOf(":"));
port = address_full.substring(address_full.lastIndexOf(":") + 1);
}
<% else %>
var address = document.getElementById("cbid.passwall." + cbi_id + ".address").value;
var port = document.getElementById("cbid.passwall." + cbi_id + ".port").value;
@ -133,9 +137,13 @@ table td, .table .td {
var cbi_id = auto_ping_value[i].getAttribute("cbiid");
<% if compact_display_nodes and tonumber(compact_display_nodes) == 1 then %>
var remarks = document.getElementById("cbid.passwall." + cbi_id + ".remarks").value;
var address_full = remarks.substring(remarks.lastIndexOf("") + 1, remarks.lastIndexOf(""));
var address = address_full.substring(0, address_full.lastIndexOf(":"));
var port = address_full.substring(address_full.lastIndexOf(":") + 1);
var address = null;
var port = null;
if (remarks.lastIndexOf("") != -1 && remarks.lastIndexOf("") != -1) {
var address_full = remarks.substring(remarks.lastIndexOf("") + 1, remarks.lastIndexOf(""));
address = address_full.substring(0, address_full.lastIndexOf(":"));
port = address_full.substring(address_full.lastIndexOf(":") + 1);
}
<% else %>
var address = document.getElementById("cbid.passwall." + cbi_id + ".address").value;
var port = document.getElementById("cbid.passwall." + cbi_id + ".port").value;
@ -167,6 +175,7 @@ table td, .table .td {
auto_ping();
},
function(x) {
auto_ping_value[index].innerHTML = "<font style='color:red'><%:Timeout%></font>";
index++;
auto_ping();
},

View File

@ -241,6 +241,9 @@ msgstr "服务器吗?"
msgid "You choose node is:"
msgstr "你选择的节点是:"
msgid "Timeout"
msgstr "超时"
msgid "The server client can also use this rule to scientifically surf the Internet"
msgstr "本机服务器的客户端也可以使用这个代理模式上网"

View File

@ -276,7 +276,7 @@ gen_config_file() {
elif [ "$type" == "brook" ]; then
BROOK_SOCKS5_CMD="client -l 0.0.0.0:$local_port -i 0.0.0.0 -s $server_ip:$port -p $(config_n_get $node password)"
elif [ "$type" == "trojan" ]; then
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_trojan_client_config_file.lua $node client $local_port >$config_file_path
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_trojan_client_config_file.lua $node client "0.0.0.0" $local_port >$config_file_path
fi
fi
@ -294,9 +294,10 @@ gen_config_file() {
elif [ "$type" == "brook" ]; then
BROOK_UDP_CMD="tproxy -l 0.0.0.0:$local_port -s $server_ip:$port -p $(config_n_get $node password)"
elif [ "$type" == "trojan" ]; then
local_port=$(get_not_exists_port_after $SOCKS5_PROXY_PORT1 tcp)
SOCKS5_PROXY_PORT4=$(expr $SOCKS5_PROXY_PORT3 + 1)
local_port=$(get_not_exists_port_after $SOCKS5_PROXY_PORT4 tcp)
socks5_port=$local_port
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_trojan_client_config_file.lua $node client $socks5_port >$config_file_path
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_trojan_client_config_file.lua $node client "127.0.0.1" $socks5_port >$config_file_path
fi
fi
@ -310,7 +311,7 @@ gen_config_file() {
if [ "$type" == "v2ray" ]; then
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_v2ray_client_config_file.lua $node tcp $local_port nil >$config_file_path
elif [ "$type" == "trojan" ]; then
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_trojan_client_config_file.lua $node nat $local_port >$config_file_path
lua /usr/lib/lua/luci/model/cbi/passwall/api/gen_trojan_client_config_file.lua $node nat "0.0.0.0" $local_port >$config_file_path
else
local kcptun_use kcptun_server_host kcptun_port kcptun_config
kcptun_use=$(config_n_get $node use_kcp)
@ -389,7 +390,7 @@ start_tcp_redir() {
if [ -f "${v2ray_path}/v2ray" ]; then
${v2ray_path}/v2ray -config=$config_file >/dev/null &
else
v2ray_bin=$(find_bin V2ray)
v2ray_bin=$(find_bin v2ray)
[ -n "$v2ray_bin" ] && $v2ray_bin -config=$config_file >/dev/null &
fi
elif [ "$TYPE" == "brook" ]; then
@ -397,25 +398,25 @@ start_tcp_redir() {
if [ -f "$brook_bin" ]; then
$brook_bin $BROOK_TCP_CMD &>/dev/null &
else
brook_bin=$(find_bin Brook)
brook_bin=$(find_bin brook)
[ -n "$brook_bin" ] && $brook_bin $BROOK_TCP_CMD &>/dev/null &
fi
elif [ "$TYPE" == "trojan" ]; then
trojan_bin=$(find_bin trojan)
[ -n "$trojan_bin" ] && $trojan_bin -c $config_file >/dev/null 2>&1 &
elif [ "$TYPE" == "socks5" ]; then
local address=$(config_n_get $temp_server address)
local port=$(config_n_get $temp_server port)
local node_address=$(config_n_get $temp_server address)
local node_port=$(config_n_get $temp_server port)
local server_username=$(config_n_get $temp_server username)
local server_password=$(config_n_get $temp_server password)
ipt2socks_bin=$(find_bin ipt2socks)
[ -n "$ipt2socks_bin" ] && {
$ipt2socks_bin -T -l $port -b 0.0.0.0 -s $address -p $port -R >/dev/null &
$ipt2socks_bin -T -l $port -b 0.0.0.0 -s $node_address -p $socks5_port -R >/dev/null &
}
#redsocks_bin=$(find_bin redsocks2)
#[ -n "$redsocks_bin" ] && {
# local redsocks_config_file=$CONFIG_PATH/TCP_$i.conf
# gen_redsocks_config $redsocks_config_file tcp $port $address $port $server_username $server_password
# gen_redsocks_config $redsocks_config_file tcp $port $node_address $socks5_port $server_username $server_password
# $redsocks_bin -c $redsocks_config_file >/dev/null &
#}
elif [ "$TYPE" == "ssr" ]; then
@ -468,7 +469,7 @@ start_udp_redir() {
if [ -f "${v2ray_path}/v2ray" ]; then
${v2ray_path}/v2ray -config=$config_file >/dev/null &
else
v2ray_bin=$(find_bin V2ray)
v2ray_bin=$(find_bin v2ray)
[ -n "$v2ray_bin" ] && $v2ray_bin -config=$config_file >/dev/null &
fi
elif [ "$TYPE" == "brook" ]; then
@ -476,14 +477,14 @@ start_udp_redir() {
if [ -f "$brook_bin" ]; then
$brook_bin $BROOK_UDP_CMD >/dev/null &
else
brook_bin=$(find_bin Brook)
brook_bin=$(find_bin brook)
[ -n "$brook_bin" ] && $brook_bin $BROOK_UDP_CMD >/dev/null &
fi
elif [ "$TYPE" == "trojan" ]; then
trojan_bin=$(find_bin trojan)
[ -n "$trojan_bin" ] && $trojan_bin -c $config_file >/dev/null 2>&1 &
local address=$(config_n_get $temp_server address)
local port=$(config_n_get $temp_server port)
local node_address=$(config_n_get $temp_server address)
local node_port=$(config_n_get $temp_server port)
local server_username=$(config_n_get $temp_server username)
local server_password=$(config_n_get $temp_server password)
ipt2socks_bin=$(find_bin ipt2socks)
@ -498,19 +499,19 @@ start_udp_redir() {
# $redsocks_bin -c $redsocks_config_file >/dev/null &
#}
elif [ "$TYPE" == "socks5" ]; then
local address=$(config_n_get $temp_server address)
local port=$(config_n_get $temp_server port)
local node_address=$(config_n_get $temp_server address)
local node_port=$(config_n_get $temp_server port)
local server_username=$(config_n_get $temp_server username)
local server_password=$(config_n_get $temp_server password)
ipt2socks_bin=$(find_bin ipt2socks)
[ -n "$ipt2socks_bin" ] && {
$ipt2socks_bin -U -l $port -b 0.0.0.0 -s $address -p $port -R >/dev/null &
$ipt2socks_bin -U -l $port -b 0.0.0.0 -s $node_address -p $node_port -R >/dev/null &
}
#redsocks_bin=$(find_bin redsocks2)
#[ -n "$redsocks_bin" ] && {
# local redsocks_config_file=$CONFIG_PATH/UDP_$i.conf
# gen_redsocks_config $redsocks_config_file udp $port $address $port $server_username $server_password
# gen_redsocks_config $redsocks_config_file udp $port $node_address $node_port $server_username $server_password
# $redsocks_bin -c $redsocks_config_file >/dev/null &
#}
elif [ "$TYPE" == "ssr" ]; then
@ -557,7 +558,7 @@ start_socks5_proxy() {
if [ -f "${v2ray_path}/v2ray" ]; then
${v2ray_path}/v2ray -config=$config_file >/dev/null &
else
v2ray_bin=$(find_bin V2ray)
v2ray_bin=$(find_bin v2ray)
[ -n "$v2ray_bin" ] && $v2ray_bin -config=$config_file >/dev/null &
fi
elif [ "$TYPE" == "brook" ]; then
@ -565,7 +566,7 @@ start_socks5_proxy() {
if [ -f "$brook_bin" ]; then
$brook_bin $BROOK_SOCKS5_CMD >/dev/null &
else
brook_bin=$(find_bin Brook)
brook_bin=$(find_bin brook)
[ -n "$brook_bin" ] && $brook_bin $BROOK_SOCKS5_CMD >/dev/null &
fi
elif [ "$TYPE" == "trojan" ]; then
@ -575,7 +576,7 @@ start_socks5_proxy() {
echolog "Socks5节点不能使用Socks5代理节点"
elif [ "$TYPE" == "ssr" ]; then
ssr_bin=$(find_bin ssr-local)
[ -n "$ssr_bin" ] && $ssr_bin -c $config_file -b 0.0.0.0 >/dev/null 2>&1 &
[ -n "$ssr_bin" ] && $ssr_bin -c $config_file -b 0.0.0.0 -u >/dev/null 2>&1 &
elif [ "$TYPE" == "ss" ]; then
ss_bin=$(find_bin ss-local)
[ -n "$ss_bin" ] && {
@ -594,7 +595,7 @@ start_socks5_proxy() {
fi
}
fi
$ss_bin -c $config_file -b 0.0.0.0 $plugin_params >/dev/null 2>&1 &
$ss_bin -c $config_file -b 0.0.0.0 -u $plugin_params >/dev/null 2>&1 &
}
fi
echo $port > $CONFIG_PATH/port/Socks5_${i}