diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index 754762d17..020a31c38 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=1.19-1 +PKG_VERSION:=1.19-2 PKG_RELEASE:= PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/socks_config.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/socks_config.lua index 10b141ba3..e0f321fde 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/socks_config.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/socks_config.lua @@ -64,18 +64,18 @@ o = s:option(Flag, "enable_autoswitch", translate("Auto Switch")) o.default = 0 o.rmempty = false -o = s:option(Value, "autoswitch_testing_time", translate("How often to test"), translate("Units:minutes")) -o.datatype = "uinteger" -o.default = 1 +o = s:option(Value, "autoswitch_testing_time", translate("How often to test"), translate("Units:seconds")) +o.datatype = "min(10)" +o.default = 30 o:depends("enable_autoswitch", true) o = s:option(Value, "autoswitch_connect_timeout", translate("Timeout seconds"), translate("Units:seconds")) -o.datatype = "uinteger" +o.datatype = "min(1)" o.default = 3 o:depends("enable_autoswitch", true) o = s:option(Value, "autoswitch_retry_num", translate("Timeout retry num")) -o.datatype = "uinteger" +o.datatype = "min(1)" o.default = 1 o:depends("enable_autoswitch", true) @@ -105,12 +105,11 @@ o:depends("enable_autoswitch", true) o = s:option(Value, "autoswitch_probe_url", translate("Probe URL"), translate("The URL used to detect the connection status.")) o.default = "https://www.google.com/generate_204" +o:depends("enable_autoswitch", true) for k, v in pairs(nodes_table) do - if v.node_type == "normal" then - autoswitch_backup_node:value(v.id, v["remark"]) - socks_node:value(v.id, v["remark"]) - end + autoswitch_backup_node:value(v.id, v["remark"]) + socks_node:value(v.id, v["remark"]) end m:append(Template(appname .. "/socks_auto_switch/footer")) diff --git a/luci-app-passwall2/root/usr/share/passwall2/socks_auto_switch.sh b/luci-app-passwall2/root/usr/share/passwall2/socks_auto_switch.sh index 4f91562a7..563bf57ea 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/socks_auto_switch.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/socks_auto_switch.sh @@ -156,7 +156,7 @@ start() { LOCK_FILE=${LOCK_FILE_DIR}/${CONFIG}_socks_auto_switch_${id}.lock main_node=$(config_n_get $id node nil) socks_port=$(config_n_get $id port 0) - delay=$(config_n_get $id autoswitch_testing_time 1) + delay=$(config_n_get $id autoswitch_testing_time 30) sleep 5s connect_timeout=$(config_n_get $id autoswitch_connect_timeout 3) retry_num=$(config_n_get $id autoswitch_retry_num 1) @@ -172,7 +172,7 @@ start() { backup_node=$(echo $backup_node | tr -s ' ' '\n' | uniq | tr -s '\n' ' ') test_auto_switch "$backup_node" rm -f $LOCK_FILE - sleep ${delay}m + sleep ${delay} done }