small-packages/liep/other/lean/luci-app-frps/luasrc/controller/frps.lua
2026-05-10 09:48:30 +08:00

25 lines
833 B
Lua

-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
module("luci.controller.frps", package.seeall)
function index()
if not nixio.fs.access("/etc/config/frps") then
return
end
entry({"admin", "services", "frps"}, alias("admin", "services", "frps", "common"), _("Frps"), 99).dependent = true
entry({"admin", "services", "frps", "common"}, cbi("frps/common"), _("Settings"), 1).leaf = true
entry({"admin", "services", "frps", "server"}, cbi("frps/server"), _("Server"), 2).leaf = true
entry({"admin", "services", "frps", "status"}, call("action_status")).leaf = true
end
function action_status()
local e = {}
e.running = luci.sys.call("pidof frps >/dev/null") == 0
e.bin_version = luci.sys.exec("frps -v")
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end