🌈 Sync 2026-09-24 15:19:50

This commit is contained in:
github-actions[bot] committed 2026-09-24 15:19:50 +08:00
1 parent 765ac2b267
commit 87101cc7f2
126 files changed
+4403 -2879

No files matched your search

+21 -31
View File
@@ -1,44 +1,34 @@
module("luci.controller.fastnet", package.seeall)
function index()
local fs = require "nixio.fs"
if not fs.access("/etc/config/fastnet") then
return
end
if not nixio.fs.access("/etc/config/fastnet") then return end
entry({"admin", "services", "fastnet"}, cbi("fastnet"), _("FastNet"), 50).dependent = true
entry({"admin", "services", "fastnet", "status"}, call("action_status")).leaf = true
local open = entry({"admin", "services", "fastnet", "open"}, call("action_open"))
open.leaf = true
open.dependent = false
open.sysauth = false
end
local function compat()
local dispatcher = require "luci.dispatcher"
return require("luci.model.linkease.apps_compat").new({
http = require "luci.http",
resolver = require("luci.model.linkease.apps_openwrt").new(),
auth_url = dispatcher.build_url("admin", "services", "linkease_auth", "auth")
})
end
function action_status()
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local http = require "luci.http"
local function get_host()
local host = http.getenv("HTTP_HOST") or http.getenv("SERVER_NAME") or ""
host = host:gsub(":%d+$", "")
if host == "_redirect2ssl" or host == "redirect2ssl" or host == "" then
host = http.getenv("SERVER_ADDR") or "localhost"
end
return host
end
local running = (sys.call("pidof FastNet >/dev/null") == 0)
local host = get_host()
local port = uci:get_first("fastnet", "fastnet", "port") or "3200"
local token = uci:get_first("fastnet", "fastnet", "token") or ""
local url = "http://" .. host .. ":" .. port .. "/"
if token ~= "" then
url = url .. "?token=" .. token
end
http.prepare_content("application/json")
http.write_json({
running = running,
host = host,
port = port,
url = url
compat():legacy_status("fastnet", {
running = sys.call("pidof FastNet >/dev/null") == 0,
port = uci:get_first("fastnet", "fastnet", "port") or "3200"
})
end
function action_open()
compat():open("fastnet")
end