update 2026-07-28 01:38:11

This commit is contained in:
action committed 2026-07-28 01:38:11 +08:00
1 parent 20b786ab77
commit 25d570431d
6243 files changed
+2850542

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for fastnet
LUCI_DEPENDS:=+fastnet
LUCI_PKGARCH:=all
PKG_VERSION:=0.7.2-r1
# PKG_RELEASE MUST be empty for luci.mk
PKG_RELEASE:=
LUCI_MINIFY_CSS:=0
LUCI_MINIFY_JS:=0
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,44 @@
module("luci.controller.fastnet", package.seeall)
function index()
local fs = require "nixio.fs"
if not 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
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
})
end
@@ -0,0 +1,47 @@
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local http = require "luci.http"
local m = Map("fastnet", translate("FastNet"))
m.description = translate("FastNet provides network testing tools and a Web UI.")
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 st = m:section(SimpleSection, translate("Status"))
local running = (sys.call("pidof FastNet >/dev/null") == 0)
local listen_port = uci:get_first("fastnet", "fastnet", "port") or "3200"
local token = uci:get_first("fastnet", "fastnet", "token") or ""
local url = "http://" .. get_host() .. ":" .. listen_port .. "/"
if token ~= "" then
url = url .. "?token=" .. token
end
st.template = "fastnet/status"
st.running = running
st.url = url
local s = m:section(TypedSection, "fastnet", translate("Settings"))
s.anonymous = true
local enabled = s:option(Flag, "enabled", translate("Enable"))
enabled.default = enabled.enabled
local port = s:option(Value, "port", translate("Listen Port"))
port.datatype = "port"
port.default = "3200"
local token = s:option(Value, "token", translate("API Token"))
token.password = true
token.rmempty = true
local logger = s:option(Flag, "logger", translate("Enable Logging"))
logger.rmempty = true
return m
@@ -0,0 +1,21 @@
<fieldset class="cbi-section">
<legend><%:Status%></legend>
<div class="cbi-section-node">
<div class="cbi-value">
<label class="cbi-value-title"><%:Status%></label>
<div class="cbi-value-field">
<% if self.running then %>
<span style="color: green; font-weight: bold"><%:Running%></span>
<% else %>
<span style="color: red; font-weight: bold"><%:Not running%></span>
<% end %>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Open Web UI%></label>
<div class="cbi-value-field">
<a href="<%=self.url%>" target="_blank" rel="noreferrer"><%:Open Web UI%></a>
</div>
</div>
</div>
</fieldset>
+39
View File
@@ -0,0 +1,39 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "FastNet"
msgstr "FastNet"
msgid "FastNet provides network testing tools and a Web UI."
msgstr "FastNet 提供网络测试工具与 Web 界面。"
msgid "Settings"
msgstr "设置"
msgid "Enable"
msgstr "启用"
msgid "Listen Host"
msgstr "监听地址"
msgid "Listen Port"
msgstr "监听端口"
msgid "API Token"
msgstr "访问 Token"
msgid "Enable Logging"
msgstr "启用日志"
msgid "Status"
msgstr "状态"
msgid "Running"
msgstr "运行中"
msgid "Not running"
msgstr "未运行"
msgid "Open Web UI"
msgstr "打开 Web 界面"
+39
View File
@@ -0,0 +1,39 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "FastNet"
msgstr "FastNet"
msgid "FastNet provides network testing tools and a Web UI."
msgstr "FastNet 提供网络测试工具与 Web 界面。"
msgid "Settings"
msgstr "设置"
msgid "Enable"
msgstr "启用"
msgid "Listen Host"
msgstr "监听地址"
msgid "Listen Port"
msgstr "监听端口"
msgid "API Token"
msgstr "访问 Token"
msgid "Enable Logging"
msgstr "启用日志"
msgid "Status"
msgstr "状态"
msgid "Running"
msgstr "运行中"
msgid "Not running"
msgstr "未运行"
msgid "Open Web UI"
msgstr "打开 Web 界面"
@@ -0,0 +1,5 @@
#!/bin/sh
rm -f /tmp/luci-indexcache
exit 0