diff --git a/doc/lucky1.png b/doc/lucky1.png new file mode 100644 index 00000000..a5b41b6e Binary files /dev/null and b/doc/lucky1.png differ diff --git a/doc/lucky2.png b/doc/lucky2.png new file mode 100644 index 00000000..ba4c026f Binary files /dev/null and b/doc/lucky2.png differ diff --git a/doc/lucky3.png b/doc/lucky3.png new file mode 100644 index 00000000..6fa7982f Binary files /dev/null and b/doc/lucky3.png differ diff --git a/doc/taskplan1.png b/doc/taskplan1.png deleted file mode 100644 index 1f8db7be..00000000 Binary files a/doc/taskplan1.png and /dev/null differ diff --git a/doc/taskplan2.png b/doc/taskplan2.png deleted file mode 100644 index edb45d6d..00000000 Binary files a/doc/taskplan2.png and /dev/null differ diff --git a/doc/taskplan3.png b/doc/taskplan3.png deleted file mode 100644 index d4794702..00000000 Binary files a/doc/taskplan3.png and /dev/null differ diff --git a/doc/view.png b/doc/view.png deleted file mode 100644 index 169e112f..00000000 Binary files a/doc/view.png and /dev/null differ diff --git a/doc/view2.png b/doc/view2.png deleted file mode 100644 index 9058c632..00000000 Binary files a/doc/view2.png and /dev/null differ diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index d74edbb4..e354e723 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=26.10.3 +PKG_VERSION:=26.10.4 PKG_RELEASE:=1 PKG_PO_VERSION:=$(PKG_VERSION) diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index 9bfd7839..8fdc263d 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -105,7 +105,8 @@ function index() entry({"admin", "services", appname, "read_rulelist"}, call("read_rulelist")).leaf = true --[[Components update]] - entry({"admin", "services", appname, "check_passwall"}, call("app_check")).leaf = true + entry({"admin", "services", appname, "check_" .. appname}, call("app_check")).leaf = true + entry({"admin", "services", appname, "update_" .. appname}, call("app_update")).leaf = true local coms = require "luci.passwall.com" local com for _, com in ipairs(coms.order) do @@ -809,6 +810,23 @@ function app_check() http_write_json(json) end +function app_update() + local id = http.formvalue("id") + if not id or not id:match("^[%w_-]+$") then http_write_json({code = 1}); return end + local task = http.formvalue("task") + local result + if task == "progress" then + result = api.to_download_progress(appname, id, http.formvalue("total_size")) + elseif task == "install" then + if not luci.dispatcher.test_post_security() then return end + result = api.to_install_self(id, http.formvalue("force")) + else + local part = http.formvalue("part") == "2" and "2" or "1" + result = api.to_download(appname, http.formvalue("url"), http.formvalue("size"), id .. part, part == "2") + end + http_write_json(result) +end + function com_check(comname) local json = api.to_check("",comname) http_write_json(json) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/1_sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/1_sing-box.lua index 73926d3f..d52f6037 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/1_sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/1_sing-box.lua @@ -429,6 +429,16 @@ if singbox_tags:find("with_quic") then o = s:option(Value, "hysteria2_down_mbps", translate("Max download Mbps")) o:depends({ protocol = "hysteria2" }) + o = s:option(Value, "hysteria2_stream_recv_win", translate("QUIC stream receive window")) + o.datatype = "uinteger" + o.placeholder = "8388608" + o:depends({ protocol = "hysteria2" }) + + o = s:option(Value, "hysteria2_conn_recv_win", translate("QUIC connection receive window")) + o.datatype = "uinteger" + o.placeholder = "20971520" + o:depends({ protocol = "hysteria2" }) + o = s:option(Value, "hysteria2_idle_timeout", translate("Idle Timeout"), translate("Units:seconds") .. " (4~120)") o.datatype = "range(4,120)" o:depends({ protocol = "hysteria2"}) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/2_xray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/2_xray.lua index 24ac84e9..2b3163c0 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/2_xray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/2_xray.lua @@ -361,6 +361,16 @@ o:depends({ protocol = "hysteria2" }) o = s:option(Value, "hysteria2_down_mbps", translate("Max download Mbps")) o:depends({ protocol = "hysteria2" }) +o = s:option(Value, "hysteria2_stream_recv_win", translate("QUIC stream receive window")) +o.datatype = "uinteger" +o.placeholder = "8388608" +o:depends({ protocol = "hysteria2" }) + +o = s:option(Value, "hysteria2_conn_recv_win", translate("QUIC connection receive window")) +o.datatype = "uinteger" +o.placeholder = "20971520" +o:depends({ protocol = "hysteria2" }) + o = s:option(Value, "hysteria2_idle_timeout", translate("Idle Timeout"), translate("Units:seconds") .. " (4~120)") o.datatype = "range(4,120)" o:depends({ protocol = "hysteria2"}) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/5_hysteria2.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/5_hysteria2.lua index bd9a4130..e57fedfe 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/5_hysteria2.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/5_hysteria2.lua @@ -109,10 +109,14 @@ o.rewrite_option = o.option o = s:option(Value, "down_mbps", translate("Max download Mbps")) o.rewrite_option = o.option -o = s:option(Value, "recv_window", translate("QUIC stream receive window")) +o = s:option(Value, "stream_recv_win", translate("QUIC stream receive window")) +o.datatype = "uinteger" +o.placeholder = "8388608" o.rewrite_option = o.option -o = s:option(Value, "recv_window_conn", translate("QUIC connection receive window")) +o = s:option(Value, "conn_recv_win", translate("QUIC connection receive window")) +o.datatype = "uinteger" +o.placeholder = "20971520" o.rewrite_option = o.option o = s:option(Value, "idle_timeout", translate("Idle Timeout"), translate("Units:seconds") .. " (4~120)") diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 074e1a35..ac51a549 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -12,7 +12,6 @@ datatypes = require "luci.cbi.datatypes" jsonc = require "luci.jsonc" i18n = require "luci.i18n" -appname = "passwall" curl_args = { "-skfL", "--connect-timeout 3", "--retry 3", "-H 'Accept: */*'" } command_timeout = 300 OPENWRT_ARCH = nil @@ -1239,8 +1238,8 @@ function to_check(arch, app_name) } end -function to_download(app_name, url, size, task_id) - local result = check_path(app_name) +function to_download(app_name, url, size, task_id, keep_files) + local result = app_name == appname and {code = 0} or check_path(app_name) if result.code ~= 0 then return result end @@ -1249,7 +1248,7 @@ function to_download(app_name, url, size, task_id) return {code = 1, error = i18n.translate("Download url is required.")} end - remove("/tmp/" .. app_name .. "_download.*") + if not keep_files then remove("/tmp/" .. app_name .. "_download.*") end local tmp_file if task_id and task_id:match("^[%w_-]+$") then @@ -1298,6 +1297,9 @@ function to_download_progress(app_name, task_id, total_size) total_size = tonumber(total_size) or 0 local tmp_file = "/tmp/" .. app_name .. "_download." .. task_id local downloaded = tonumber(fs.stat(tmp_file, "size")) or 0 + if app_name == appname then + downloaded = (tonumber(fs.stat(tmp_file .. "1", "size")) or 0) + (tonumber(fs.stat(tmp_file .. "2", "size")) or 0) + end local percent if total_size > 0 then -- The download request has not completed yet, so leave 100% for its success callback. @@ -1455,7 +1457,7 @@ function get_version() end function to_check_self() - local release = get_api_json(com.passwall:get_url()) + local release = get_api_json(com[appname]:get_url()) if type(release) == "table" and #release > 0 then release = release[1] end @@ -1469,26 +1471,56 @@ function to_check_self() -- Keep the release suffix (-1, -2, ...) so package revisions are compared too. local remote_version = release.tag_name:gsub("^v", "") 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, - html_url = release.html_url, - data = release.assets or {} - } + local prefix, extension + if sys.call("command -v apk >/dev/null 2>&1") == 0 then + prefix, extension = "25.12+_", ".apk" + else + if sys.call("command -v uname >/dev/null 2>&1") ~= 0 then return {code = 1} end + local kernel = trim(sys.exec("uname -r 2>/dev/null")):match("^(%d+%.%d+)") + if not kernel then return {code = 1} end + prefix = compare_versions(kernel, "<", "5.11") and "22.03-_" or "23.05-24.10_" + extension = ".ipk" end + local main, i18n_package + for _, asset in ipairs(release.assets or {}) do + local name = asset.name or "" + if name:find(prefix, 1, true) == 1 and name:sub(-#extension) == extension then + name = name:sub(#prefix + 1) + if name:match("^luci%-app%-" .. appname .. "[_%-]%d") then main = asset end + if name:match("^luci%-i18n%-" .. appname .. "%-zh%-cn[_%-]%d") then i18n_package = asset end + end + end + if not main or not i18n_package then return {code = 1} end return { - code = 1, - has_update = true, - local_version = local_version, - remote_version = remote_version, - html_url = release.html_url, - data = release.assets or {}, - 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) + code = 0, has_update = has_update, local_version = local_version, + remote_version = remote_version, html_url = release.html_url, + data = main, i18n = i18n_package } end +function to_install_self(id, force) + if not id or not id:match("^[%w_-]+$") then return {code = 1} end + local dir = "/tmp/" .. appname .. "_luci_update." .. id + local manager = sys.call("command -v apk >/dev/null 2>&1") == 0 and "apk" or "opkg" + local extension = manager == "apk" and ".apk" or ".ipk" + local status_dir = "/www/luci-static/resources/" .. appname .. "-update" + local status = status_dir .. "/" .. id .. ".json" + fs.mkdir(dir) + fs.mkdir(status_dir) + exec("/bin/mv", {"/tmp/" .. appname .. "_download." .. id .. "1", dir .. "/luci-app-" .. appname .. extension}) + exec("/bin/mv", {"/tmp/" .. appname .. "_download." .. id .. "2", dir .. "/luci-i18n-" .. appname .. "-zh-cn" .. extension}) + local script = dir .. "/luci_update.sh" + if exec("/bin/cp", {"/usr/share/" .. appname .. "/luci_update.sh", script}) ~= 0 then + remove(dir) + return {code = 1} + end + fs.chmod(script, 755) + fs.writefile(status, '{"installing":true}') + sys.call("nohup " .. script .. " " .. dir .. " " .. status .. " " .. manager .. " " .. + (force == "1" and "1" or "0") .. " >/dev/null 2>&1 = 4 and t <= 120) and t .. "s" or "30s" diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index a7de4ffe..9a09e475 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -623,7 +623,9 @@ function gen_outbound(flag, node, tag, proxy_table) t = tonumber(tostring(t or "0"):match("^%d+")) return (t and t >= 2 and t <= 60) and t .. "s" or nil end)(node.hysteria2_keep_alive_period), - disable_path_mtu_discovery = version_ge_1_14_0 and (tonumber(node.hysteria2_disable_mtu_discovery) == 1) or nil, + stream_receive_window = tonumber(node.hysteria2_stream_recv_win) and tonumber(node.hysteria2_stream_recv_win)/1048576 .. " MB" or nil, + connection_receive_window = tonumber(node.hysteria2_conn_recv_win) and tonumber(node.hysteria2_conn_recv_win)/1048576 .. " MB" or nil, + disable_path_mtu_discovery = version_ge_1_14_0 and (node.hysteria2_disable_mtu_discovery == "1") or nil, tls = tls, realm = node.hysteria2_realms and (function() result.server = nil diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index ce1f5700..4e7b7de4 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -364,7 +364,9 @@ function gen_outbound(flag, node, tag, proxy_table) t = tonumber(tostring(t or "0"):match("^%d+")) return (t and t >= 2 and t <= 60) and t or nil end)(node.hysteria2_keep_alive_period), - disablePathMTUDiscovery = tonumber(node.hysteria2_disable_mtu_discovery) == 1 + disablePathMTUDiscovery = node.hysteria2_disable_mtu_discovery == "1", + initStreamReceiveWindow = node.hysteria2_stream_recv_win and tonumber(node.hysteria2_stream_recv_win) or nil, + initConnectionReceiveWindow = node.hysteria2_conn_recv_win and tonumber(node.hysteria2_conn_recv_win) or nil, } end if fragment and fragment_table and ({raw=1, ws=1, httpupgrade=1, grpc=1, xhttp=1})[TP] then diff --git a/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm b/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm index a0d2fec2..c64fee75 100644 --- a/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm +++ b/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm @@ -7,6 +7,7 @@ local com = self.com @@ -228,9 +302,11 @@ local com = self.com