diff --git a/gecoosac/LICENSE b/gecoosac/LICENSE new file mode 100644 index 00000000..a41ac4b8 --- /dev/null +++ b/gecoosac/LICENSE @@ -0,0 +1,9 @@ +GNU Affero General Public License v3.0 only + +The gecoosac package in this directory is distributed under the GNU +Affero General Public License version 3 only. + +SPDX-License-Identifier: AGPL-3.0-only + +Canonical license text: +https://www.gnu.org/licenses/agpl-3.0.txt diff --git a/gecoosac/Makefile b/gecoosac/Makefile index 5fee3550..c556f5c7 100644 --- a/gecoosac/Makefile +++ b/gecoosac/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gecoosac PKG_VERSION:=2.2.20251015 -PKG_RELEASE:=6 +PKG_RELEASE:=7 ifeq ($(ARCH),aarch64) PKG_ARCH:=ac_linux_arm64 diff --git a/luci-app-gecoosac/Makefile b/luci-app-gecoosac/Makefile index 2915b155..76dc4e49 100644 --- a/luci-app-gecoosac/Makefile +++ b/luci-app-gecoosac/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-gecoosac PKG_VERSION:=2.2 -PKG_RELEASE:=5 +PKG_RELEASE:=6 LUCI_TITLE:=LuCI Support for gecoosac LUCI_DEPENDS:=+luci-compat +gecoosac diff --git a/luci-app-gecoosac/luasrc/controller/gecoosac.lua b/luci-app-gecoosac/luasrc/controller/gecoosac.lua index 3d42b442..fee2602d 100644 --- a/luci-app-gecoosac/luasrc/controller/gecoosac.lua +++ b/luci-app-gecoosac/luasrc/controller/gecoosac.lua @@ -1,10 +1,17 @@ - module("luci.controller.gecoosac", package.seeall) local fs = require "nixio.fs" local sys = require "luci.sys" local uci = require "luci.model.uci" +local function service_running() + if not fs.access("/etc/init.d/gecoosac") then + return false + end + + return sys.call("/etc/init.d/gecoosac status >/dev/null 2>&1") == 0 +end + function index() if not fs.access("/etc/config/gecoosac") then return @@ -20,7 +27,7 @@ function act_status() local cur = uci.cursor() local enabled = cur:get("gecoosac", "config", "enabled") == "1" local e = { - running = enabled and sys.call("pidof gecoosac >/dev/null 2>&1") == 0 + running = enabled and service_running() } luci.http.prepare_content("application/json") luci.http.write_json(e) diff --git a/luci-app-gecoosac/luasrc/view/gecoosac/gecoosac_status.htm b/luci-app-gecoosac/luasrc/view/gecoosac/gecoosac_status.htm index acbf5d1e..34f831da 100644 --- a/luci-app-gecoosac/luasrc/view/gecoosac/gecoosac_status.htm +++ b/luci-app-gecoosac/luasrc/view/gecoosac/gecoosac_status.htm @@ -2,10 +2,22 @@ local uci=require"luci.model.uci".cursor() local json=require"luci.jsonc" +local function valid_port(value, default) + value = tostring(value or default) + if value:match("^%d+$") then + local port = tonumber(value) + if port and port >= 1 and port <= 65535 then + return tostring(port) + end + end + + return default +end + local isonlyoneprot = uci:get("gecoosac", "config", "isonlyoneprot") or "1" local https = uci:get("gecoosac", "config", "https") or "0" -local port = uci:get("gecoosac", "config", "port") or "60650" -local m_port = uci:get("gecoosac", "config", "m_port") or "8080" +local port = valid_port(uci:get("gecoosac", "config", "port"), "60650") +local m_port = valid_port(uci:get("gecoosac", "config", "m_port"), "8080") local http = "http://" if isonlyoneprot == "0" then port = m_port @@ -14,19 +26,58 @@ if isonlyoneprot == "0" then end end -%> + +
- - diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 1b7b36ca..a82e6ea5 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=26.6.2 -PKG_RELEASE:=156 +PKG_RELEASE:=157 PKG_PO_VERSION:=$(PKG_VERSION) PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 44bf97cb..fc7f6772 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -1606,27 +1606,23 @@ end function parse_realm_uri(uri) if type(uri) ~= "string" then return nil end - -- realm://token@server/realm_id?query - local token, server_url, realm_id, query = trim(uri):match("^realm://([^@]+)@([^/]+)/([^?]*)%??(.*)$") - if not token or not server_url or not realm_id then return nil end + -- realm[+http]://token@server/realm_id?query + local scheme, token, server_url, realm_id, query = trim(uri):match("^(realm%+http|realm)://([^@]+)@([^/]+)/([^?]*)%??(.*)$") + if not scheme or not token or not server_url or not realm_id then return nil end realm_id = realm_id:gsub("/+$", "") local realm = { + scheme = scheme, token = token, server_url = server_url, realm_id = realm_id } -- 解析 query 中的 stun= - if query and query ~= "" then - local stun_servers = {} - for key, value in query:gmatch("([^&=?]+)=([^&]+)") do - if key == "stun" and value ~= "" then - stun_servers[#stun_servers + 1] = value - end - end - if #stun_servers > 0 then - realm.stun_servers = stun_servers - end + local stun_servers + for value in (query or ""):gmatch("[?&]?[Ss][Tt][Uu][Nn]=([^&]+)") do + if not stun_servers then stun_servers = {} end + stun_servers[#stun_servers + 1] = value end + realm.stun_servers = stun_servers return realm end diff --git a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua index 89049692..b8497914 100644 --- a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua +++ b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua @@ -67,7 +67,8 @@ function gen_config(var) server_host = api.get_ipv6_full(server_host) end - local server = server_host .. ":" .. ((server_port or "") .. "," .. (node.hysteria2_hop or "")):gsub("^[%s,]+", ""):gsub("[%s,]+$", ""):gsub(":", "-") + local port_hop = ((server_port or "") .. "," .. (node.hysteria2_hop or "")):gsub("^[%s,]+", ""):gsub("[%s,]+$", ""):gsub(":", "-") + local server = server_host .. ":" .. (port_hop ~= "" and port_hop or "443") local config = { server = (function() diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index ad76c2a9..9b6747b3 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -583,8 +583,9 @@ function gen_outbound(flag, node, tag, proxy_table) result.server_port = nil local realm = api.parse_realm_uri(node.hysteria2_realm_url) if realm then - realm.server_url = realm.server_url and "https://" .. realm.server_url or nil + realm.server_url = (realm.scheme == "realm+http" and "http://" or "https://") .. realm.server_url realm.stun_servers = realm.stun_servers or node.hysteria2_realm_stun + realm.scheme = nil return realm end return nil @@ -929,8 +930,9 @@ function gen_config_server(node) realm = node.hysteria2_realms and (function() local realm = api.parse_realm_uri(node.hysteria2_realm_url) if realm then - realm.server_url = realm.server_url and "https://" .. realm.server_url or nil + realm.server_url = (realm.scheme == "realm+http" and "http://" or "https://") .. realm.server_url realm.stun_servers = realm.stun_servers or node.hysteria2_realm_stun + realm.scheme = nil realm.stun_domain_resolver = "direct" return realm end diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index fbdc8312..9f2ad6cb 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -294,9 +294,7 @@ function gen_outbound(flag, node, tag, proxy_table) local realm = api.parse_realm_uri(node.hysteria2_realm_url) local url, stun if realm then - if realm.token and realm.server_url and realm.realm_id then - url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id - end + url = realm.scheme .. "://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id stun = realm.stun_servers or node.hysteria2_realm_stun end local r = { @@ -754,9 +752,7 @@ function gen_config_server(node) local realm = api.parse_realm_uri(node.hysteria2_realm_url) local url, stun if realm then - if realm.token and realm.server_url and realm.realm_id then - url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id - end + url = realm.scheme .. "://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id stun = realm.stun_servers or node.hysteria2_realm_stun end local r = {