mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 09:35:13 +08:00
🔥 Sync 2026-06-09 21:02:42
This commit is contained in:
1 parent
7631f7bfff
commit
dccbeb60e0
10 files changed
+101
-42
No files matched your search
@@ -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
|
||||||
+1
-1
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=gecoosac
|
PKG_NAME:=gecoosac
|
||||||
PKG_VERSION:=2.2.20251015
|
PKG_VERSION:=2.2.20251015
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=7
|
||||||
|
|
||||||
ifeq ($(ARCH),aarch64)
|
ifeq ($(ARCH),aarch64)
|
||||||
PKG_ARCH:=ac_linux_arm64
|
PKG_ARCH:=ac_linux_arm64
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-gecoosac
|
PKG_NAME:=luci-app-gecoosac
|
||||||
PKG_VERSION:=2.2
|
PKG_VERSION:=2.2
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI Support for gecoosac
|
LUCI_TITLE:=LuCI Support for gecoosac
|
||||||
LUCI_DEPENDS:=+luci-compat +gecoosac
|
LUCI_DEPENDS:=+luci-compat +gecoosac
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
|
|
||||||
module("luci.controller.gecoosac", package.seeall)
|
module("luci.controller.gecoosac", package.seeall)
|
||||||
|
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local uci = require "luci.model.uci"
|
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()
|
function index()
|
||||||
if not fs.access("/etc/config/gecoosac") then
|
if not fs.access("/etc/config/gecoosac") then
|
||||||
return
|
return
|
||||||
@@ -20,7 +27,7 @@ function act_status()
|
|||||||
local cur = uci.cursor()
|
local cur = uci.cursor()
|
||||||
local enabled = cur:get("gecoosac", "config", "enabled") == "1"
|
local enabled = cur:get("gecoosac", "config", "enabled") == "1"
|
||||||
local e = {
|
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.prepare_content("application/json")
|
||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
|
|||||||
@@ -2,10 +2,22 @@
|
|||||||
local uci=require"luci.model.uci".cursor()
|
local uci=require"luci.model.uci".cursor()
|
||||||
local json=require"luci.jsonc"
|
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 isonlyoneprot = uci:get("gecoosac", "config", "isonlyoneprot") or "1"
|
||||||
local https = uci:get("gecoosac", "config", "https") or "0"
|
local https = uci:get("gecoosac", "config", "https") or "0"
|
||||||
local port = uci:get("gecoosac", "config", "port") or "60650"
|
local port = valid_port(uci:get("gecoosac", "config", "port"), "60650")
|
||||||
local m_port = uci:get("gecoosac", "config", "m_port") or "8080"
|
local m_port = valid_port(uci:get("gecoosac", "config", "m_port"), "8080")
|
||||||
local http = "http://"
|
local http = "http://"
|
||||||
if isonlyoneprot == "0" then
|
if isonlyoneprot == "0" then
|
||||||
port = m_port
|
port = m_port
|
||||||
@@ -14,19 +26,58 @@ if isonlyoneprot == "0" then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-%>
|
-%>
|
||||||
|
<style>
|
||||||
|
#gecoosac_status .gecoosac-running { color: green; }
|
||||||
|
#gecoosac_status .gecoosac-stopped { color: red; }
|
||||||
|
#gecoosac_status .cbi-button { margin-left: 1em; }
|
||||||
|
.gecoosac-status-text { display: none; }
|
||||||
|
</style>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="gecoosac_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
<span class="gecoosac-status-text" id="gecoosac_text_running"><%:The GecoosAC service is running.%></span>
|
||||||
|
<span class="gecoosac-status-text" id="gecoosac_text_stopped"><%:The GecoosAC service is not running.%></span>
|
||||||
|
<span class="gecoosac-status-text" id="gecoosac_text_open"><%:Open the mgmt page%></span>
|
||||||
|
</fieldset>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var Port = <%=json.stringify(port)%>;
|
var Port = <%=json.stringify(port)%>;
|
||||||
var Http = <%=json.stringify(http)%>;
|
var Http = <%=json.stringify(http)%>;
|
||||||
|
var StatusText = {
|
||||||
|
running: document.getElementById('gecoosac_text_running').textContent,
|
||||||
|
stopped: document.getElementById('gecoosac_text_stopped').textContent,
|
||||||
|
open: document.getElementById('gecoosac_text_open').textContent
|
||||||
|
};
|
||||||
|
|
||||||
|
function clearStatus(node) {
|
||||||
|
while (node.firstChild) {
|
||||||
|
node.removeChild(node.firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStatus(node, running) {
|
||||||
|
var status = document.createElement('span');
|
||||||
|
status.className = running ? 'gecoosac-running' : 'gecoosac-stopped';
|
||||||
|
status.textContent = running ? StatusText.running : StatusText.stopped;
|
||||||
|
|
||||||
|
clearStatus(node);
|
||||||
|
node.appendChild(status);
|
||||||
|
|
||||||
|
if (running) {
|
||||||
|
var button = document.createElement('input');
|
||||||
|
button.className = 'cbi-button cbi-button-reload';
|
||||||
|
button.type = 'button';
|
||||||
|
button.value = StatusText.open;
|
||||||
|
button.onclick = openClient;
|
||||||
|
node.appendChild(button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[gecoosac]], [[status]])%>', null,
|
XHR.poll(3, '<%=url([[admin]], [[services]], [[gecoosac]], [[status]])%>', null,
|
||||||
function(x, data) {
|
function(x, data) {
|
||||||
var tb = document.getElementById('gecoosac_status');
|
var tb = document.getElementById('gecoosac_status');
|
||||||
if (data && tb) {
|
if (data && tb) {
|
||||||
if (data.running) {
|
setStatus(tb, data.running);
|
||||||
var links = '<font color=green><%:The GecoosAC service is running.%></font> <input class="cbi-button cbi-button-reload " type="button" value="<%:Open the mgmt page%>" onclick="openClient();" />';
|
|
||||||
tb.innerHTML = links;
|
|
||||||
} else {
|
|
||||||
tb.innerHTML = '<font color=red><%:The GecoosAC service is not running.%></font>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -41,13 +92,10 @@ function clientHost() {
|
|||||||
|
|
||||||
function openClient() {
|
function openClient() {
|
||||||
var url = Http + clientHost() + ":" + Port;
|
var url = Http + clientHost() + ":" + Port;
|
||||||
window.open(url);
|
var client = window.open(url, '_blank', 'noopener');
|
||||||
|
if (client) {
|
||||||
|
client.opener = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<p id="gecoosac_status">
|
|
||||||
<em><%:Collecting data...%></em>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=26.6.2
|
PKG_VERSION:=26.6.2
|
||||||
PKG_RELEASE:=156
|
PKG_RELEASE:=157
|
||||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|||||||
@@ -1606,27 +1606,23 @@ end
|
|||||||
|
|
||||||
function parse_realm_uri(uri)
|
function parse_realm_uri(uri)
|
||||||
if type(uri) ~= "string" then return nil end
|
if type(uri) ~= "string" then return nil end
|
||||||
-- realm://token@server/realm_id?query
|
-- realm[+http]://token@server/realm_id?query
|
||||||
local token, server_url, realm_id, query = trim(uri):match("^realm://([^@]+)@([^/]+)/([^?]*)%??(.*)$")
|
local scheme, token, server_url, realm_id, query = trim(uri):match("^(realm%+http|realm)://([^@]+)@([^/]+)/([^?]*)%??(.*)$")
|
||||||
if not token or not server_url or not realm_id then return nil end
|
if not scheme or not token or not server_url or not realm_id then return nil end
|
||||||
realm_id = realm_id:gsub("/+$", "")
|
realm_id = realm_id:gsub("/+$", "")
|
||||||
local realm = {
|
local realm = {
|
||||||
|
scheme = scheme,
|
||||||
token = token,
|
token = token,
|
||||||
server_url = server_url,
|
server_url = server_url,
|
||||||
realm_id = realm_id
|
realm_id = realm_id
|
||||||
}
|
}
|
||||||
-- 解析 query 中的 stun=
|
-- 解析 query 中的 stun=
|
||||||
if query and query ~= "" then
|
local stun_servers
|
||||||
local stun_servers = {}
|
for value in (query or ""):gmatch("[?&]?[Ss][Tt][Uu][Nn]=([^&]+)") do
|
||||||
for key, value in query:gmatch("([^&=?]+)=([^&]+)") do
|
if not stun_servers then stun_servers = {} end
|
||||||
if key == "stun" and value ~= "" then
|
stun_servers[#stun_servers + 1] = value
|
||||||
stun_servers[#stun_servers + 1] = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if #stun_servers > 0 then
|
|
||||||
realm.stun_servers = stun_servers
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
realm.stun_servers = stun_servers
|
||||||
return realm
|
return realm
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ function gen_config(var)
|
|||||||
server_host = api.get_ipv6_full(server_host)
|
server_host = api.get_ipv6_full(server_host)
|
||||||
end
|
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 = {
|
local config = {
|
||||||
server = (function()
|
server = (function()
|
||||||
|
|||||||
@@ -583,8 +583,9 @@ function gen_outbound(flag, node, tag, proxy_table)
|
|||||||
result.server_port = nil
|
result.server_port = nil
|
||||||
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
||||||
if realm then
|
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.stun_servers = realm.stun_servers or node.hysteria2_realm_stun
|
||||||
|
realm.scheme = nil
|
||||||
return realm
|
return realm
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
@@ -929,8 +930,9 @@ function gen_config_server(node)
|
|||||||
realm = node.hysteria2_realms and (function()
|
realm = node.hysteria2_realms and (function()
|
||||||
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
||||||
if realm then
|
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.stun_servers = realm.stun_servers or node.hysteria2_realm_stun
|
||||||
|
realm.scheme = nil
|
||||||
realm.stun_domain_resolver = "direct"
|
realm.stun_domain_resolver = "direct"
|
||||||
return realm
|
return realm
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -294,9 +294,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
|||||||
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
||||||
local url, stun
|
local url, stun
|
||||||
if realm then
|
if realm then
|
||||||
if realm.token and realm.server_url and realm.realm_id then
|
url = realm.scheme .. "://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
||||||
url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
|
||||||
end
|
|
||||||
stun = realm.stun_servers or node.hysteria2_realm_stun
|
stun = realm.stun_servers or node.hysteria2_realm_stun
|
||||||
end
|
end
|
||||||
local r = {
|
local r = {
|
||||||
@@ -754,9 +752,7 @@ function gen_config_server(node)
|
|||||||
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
local realm = api.parse_realm_uri(node.hysteria2_realm_url)
|
||||||
local url, stun
|
local url, stun
|
||||||
if realm then
|
if realm then
|
||||||
if realm.token and realm.server_url and realm.realm_id then
|
url = realm.scheme .. "://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
||||||
url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
|
||||||
end
|
|
||||||
stun = realm.stun_servers or node.hysteria2_realm_stun
|
stun = realm.stun_servers or node.hysteria2_realm_stun
|
||||||
end
|
end
|
||||||
local r = {
|
local r = {
|
||||||
|
|||||||
Reference in new issue
Block a user