diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index ee7af1f0b..5172ce6bd 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -5,8 +5,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=24.11.18 -PKG_RELEASE:=2 +PKG_VERSION:=24.11.19 +PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ diff --git a/luci-app-passwall2/luasrc/controller/passwall2.lua b/luci-app-passwall2/luasrc/controller/passwall2.lua index 0f4b00371..5521ece0f 100644 --- a/luci-app-passwall2/luasrc/controller/passwall2.lua +++ b/luci-app-passwall2/luasrc/controller/passwall2.lua @@ -76,6 +76,7 @@ function index() entry({"admin", "services", appname, "update_rules"}, call("update_rules")).leaf = true --[[Components update]] + entry({"admin", "services", appname, "check_passwall2"}, call("app_check")).leaf = true local coms = require "luci.passwall2.com" local com for com, _ in pairs(coms) do @@ -403,6 +404,11 @@ function server_clear_log() luci.sys.call("echo '' > /tmp/log/passwall2_server.log") end +function app_check() + local json = api.to_check_self() + http_write_json(json) +end + function com_check(comname) local json = api.to_check("", comname) http_write_json(json) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua index 222ff7d13..e561c2cea 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe.lua @@ -100,6 +100,14 @@ if #hysteria2_type > 0 then end end +o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node.")) +o.default = "" +o:value("", translate("Auto")) +o:value("prefer_ipv4", translate("Prefer IPv4")) +o:value("prefer_ipv6", translate("Prefer IPv6")) +o:value("ipv4_only", translate("IPv4 Only")) +o:value("ipv6_only", translate("IPv6 Only")) + ---- Subscribe Delete All o = s:option(Button, "_stop", translate("Delete All Subscribe Node")) o.inputstyle = "remove" diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua index 9f88ff268..cd13e9aaa 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/node_subscribe_config.lua @@ -121,6 +121,15 @@ if #hysteria2_type > 0 then end end +o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node.")) +o.default = "global" +o:value("global", translate("Use global config")) +o:value("", translate("Auto")) +o:value("prefer_ipv4", translate("Prefer IPv4")) +o:value("prefer_ipv6", translate("Prefer IPv6")) +o:value("ipv4_only", translate("IPv4 Only")) +o:value("ipv6_only", translate("IPv6 Only")) + ---- Enable auto update subscribe o = s:option(Flag, "auto_update", translate("Enable auto update subscribe")) o.default = 0 @@ -163,11 +172,11 @@ o:depends("week_update", "8") o.rmempty = true o = s:option(Value, "user_agent", translate("User-Agent")) -o.default = "sing-box/9.9.9" -o:value("curl", "Curl Default") +o.default = "v2rayN/9.99" +o:value("curl", "Curl") o:value("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0", "Edge for Linux") o:value("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0", "Edge for Windows") o:value("Passwall2/OpenWrt", "PassWall2") -o:value("sing-box/9.9.9", "Xboard(V2board)") +o:value("v2rayN/9.99", "V2rayN") return m diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua index 63ab75fce..9aec55d44 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua @@ -321,7 +321,7 @@ o = s:option(ListValue, option_name("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" }) o = s:option(Flag, option_name("tls"), translate("TLS")) o.default = 0 diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua index c7e27de05..ce424b751 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -666,11 +666,23 @@ o = s:option(Value, option_name("plugin_opts"), translate("opts")) o:depends({ [option_name("plugin_enabled")] = true }) o = s:option(ListValue, option_name("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect.")) -o.default = "prefer_ipv6" -o:value("prefer_ipv4") -o:value("prefer_ipv6") -o:value("ipv4_only") -o:value("ipv6_only") +o.default = "" +o:value("", translate("Auto")) +o:value("prefer_ipv4", translate("Prefer IPv4")) +o:value("prefer_ipv6", translate("Prefer IPv6")) +o:value("ipv4_only", translate("IPv4 Only")) +o:value("ipv6_only", translate("IPv6 Only")) +o:depends({ [option_name("protocol")] = "socks" }) +o:depends({ [option_name("protocol")] = "http" }) +o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [option_name("protocol")] = "shadowsocksr" }) +o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [option_name("protocol")] = "trojan" }) +o:depends({ [option_name("protocol")] = "wireguard" }) +o:depends({ [option_name("protocol")] = "hysteria" }) +o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [option_name("protocol")] = "tuic" }) +o:depends({ [option_name("protocol")] = "hysteria2" }) o = s:option(ListValue, option_name("to_node"), translate("Landing node"), translate("Only support a layer of proxy.")) o.default = "" diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua index bf11e18ec..fe75553d5 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua @@ -109,7 +109,7 @@ o = s:option(ListValue, option_name("flow"), translate("flow")) o.default = "" o:value("", translate("Disable")) o:value("xtls-rprx-vision") -o:depends({ [option_name("protocol")] = "vless" }) +o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" }) o = s:option(Flag, option_name("tls"), translate("TLS")) o.default = 0 @@ -197,7 +197,7 @@ o.validate = function(self, value, t) end o = s:option(ListValue, option_name("transport"), translate("Transport")) -o:value("tcp", "TCP") +o:value("raw", "RAW") o:value("mkcp", "mKCP") o:value("ws", "WebSocket") o:value("h2", "HTTP/2") @@ -205,7 +205,7 @@ o:value("ds", "DomainSocket") o:value("quic", "QUIC") o:value("grpc", "gRPC") o:value("httpupgrade", "HttpUpgrade") -o:value("splithttp", "SplitHTTP") +o:value("xhttp", "XHTTP") o:depends({ [option_name("protocol")] = "vmess" }) o:depends({ [option_name("protocol")] = "vless" }) o:depends({ [option_name("protocol")] = "socks" }) @@ -235,12 +235,20 @@ o = s:option(Value, option_name("h2_path"), translate("HTTP/2 Path")) o:depends({ [option_name("transport")] = "h2" }) -- [[ SplitHTTP部分 ]]-- -o = s:option(Value, option_name("splithttp_host"), translate("SplitHTTP Host")) -o:depends({ [option_name("transport")] = "splithttp" }) +o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host")) +o:depends({ [option_name("transport")] = "xhttp" }) -o = s:option(Value, option_name("splithttp_path"), translate("SplitHTTP Path")) +o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path")) o.placeholder = "/" -o:depends({ [option_name("transport")] = "splithttp" }) +o:depends({ [option_name("transport")] = "xhttp" }) + +o = s:option(Value, option_name("xhttp_maxuploadsize"), translate("maxUploadSize")) +o.default = "1000000" +o:depends({ [option_name("transport")] = "xhttp" }) + +o = s:option(Value, option_name("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads")) +o.default = "10" +o:depends({ [option_name("transport")] = "xhttp" }) o = s:option(Value, option_name("splithttp_maxuploadsize"), translate("maxUploadSize")) o.default = "1000000" @@ -256,7 +264,7 @@ o:depends({ [option_name("transport")] = "splithttp" }) o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type")) o:value("none", "none") o:value("http", "http") -o:depends({ [option_name("transport")] = "tcp" }) +o:depends({ [option_name("transport")] = "raw" }) -- HTTP域名 o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host")) @@ -328,8 +336,8 @@ o.default = "0" -- [[ Fallback部分 ]]-- o = s:option(Flag, option_name("fallback"), translate("Fallback")) -o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "tcp" }) -o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "tcp" }) +o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "raw" }) +o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "raw" }) --[[ o = s:option(Value, option_name("fallback_alpn"), "Fallback alpn") diff --git a/luci-app-passwall2/luasrc/passwall2/api.lua b/luci-app-passwall2/luasrc/passwall2/api.lua index bd969d484..16fa181f2 100644 --- a/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/luci-app-passwall2/luasrc/passwall2/api.lua @@ -964,6 +964,47 @@ function to_move(app_name,file) return {code = 0} end +function get_version() + local version = sys.exec("opkg list-installed luci-app-passwall2 2>/dev/null | awk '{print $3}'") + if not version or #version == 0 then + version = sys.exec("apk info luci-app-passwall2 2>/dev/null | awk 'NR == 1 {print $1}' | cut -d'-' -f4-") + end + return version or "" +end + +function to_check_self() + local url = "https://raw.githubusercontent.com/xiaorouji/openwrt-passwall2/main/luci-app-passwall2/Makefile" + local tmp_file = "/tmp/passwall2_makefile" + local return_code, result = curl_logic(url, tmp_file, curl_args) + result = return_code == 0 + if not result then + exec("/bin/rm", {"-f", tmp_file}) + return { + code = 1, + error = i18n.translatef("Failed") + } + end + local local_version = get_version() + local remote_version = sys.exec("echo -n $(grep 'PKG_VERSION' /tmp/passwall2_makefile|awk -F '=' '{print $2}')") + .. "-" .. sys.exec("echo -n $(grep 'PKG_RELEASE' /tmp/passwall2_makefile|awk -F '=' '{print $2}')") + + local has_update = compare_versions(local_version, "<", remote_version) + if not has_update then + return { + code = 0, + local_version = local_version, + remote_version = remote_version + } + end + return { + code = 1, + has_update = true, + local_version = local_version, + remote_version = remote_version, + error = i18n.translatef("The latest version: %s, currently does not support automatic update, if you need to update, please compile or download the ipk and then manually install.", remote_version) + } +end + function cacheFileCompareToLogic(file, str) local result = nil if file and str then diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 121d4d96a..ad61cefda 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -264,7 +264,7 @@ function gen_outbound(flag, node, tag, proxy_table) level = 0, security = (node.protocol == "vmess") and node.security or nil, encryption = node.encryption or "none", - flow = (node.protocol == "vless" and node.tls == '1' and node.flow) and node.flow or nil + flow = (node.protocol == "vless" and node.tls == "1" and node.transport == "raw" and node.flow and node.flow ~= "") and node.flow or nil } } } @@ -367,7 +367,7 @@ function gen_config_server(node) for i = 1, #node.uuid do clients[i] = { id = node.uuid[i], - flow = ("vless" == node.protocol and "1" == node.tls and node.flow) and node.flow or nil + flow = ("vless" == node.protocol and "1" == node.tls and "raw" == node.transport and node.flow and node.flow ~= "") and node.flow or nil } end settings = { @@ -561,11 +561,11 @@ function gen_config_server(node) path = node.httpupgrade_path or "/", host = node.httpupgrade_host } or nil, - splithttpSettings = (node.transport == "splithttp") and { - path = node.splithttp_path or "/", - host = node.splithttp_host, - maxUploadSize = node.splithttp_maxuploadsize, - maxConcurrentUploads = node.splithttp_maxconcurrentuploads + xhttpSettings = (node.transport == "xhttp") and { + path = node.xhttp_path or "/", + host = node.xhttp_host, + maxUploadSize = node.xhttp_maxuploadsize, + maxConcurrentUploads = node.xhttp_maxconcurrentuploads } or nil, sockopt = { acceptProxyProtocol = (node.acceptProxyProtocol and node.acceptProxyProtocol == "1") and true or false diff --git a/luci-app-passwall2/luasrc/view/passwall2/app_update/app_version.htm b/luci-app-passwall2/luasrc/view/passwall2/app_update/app_version.htm index 107c87222..98e58061c 100644 --- a/luci-app-passwall2/luasrc/view/passwall2/app_update/app_version.htm +++ b/luci-app-passwall2/luasrc/view/passwall2/app_update/app_version.htm @@ -177,6 +177,18 @@ local version = {} //]]> +