luci-app-nps: tidy up luci (#8218)
This commit is contained in:
parent
2e5f50cde9
commit
e3373ca72e
@ -10,7 +10,7 @@ LUCI_TITLE:=LuCI for Nps
|
||||
LUCI_DEPENDS:=+wget +npc
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
7
package/lean/luci-app-nps/luasrc/controller/nps.lua
Executable file → Normal file
7
package/lean/luci-app-nps/luasrc/controller/nps.lua
Executable file → Normal file
@ -1,14 +1,15 @@
|
||||
module("luci.controller.nps",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/nps") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "nps"}, cbi("nps"), _("Nps Setting"), 100).dependent = true
|
||||
entry({"admin", "services", "nps", "status"}, call("status")).leaf = true
|
||||
entry({"admin", "services", "nps"}, cbi("nps"), _("Nps"), 100).dependent = true
|
||||
entry({"admin", "services", "nps", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function status()
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep npc > /dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
|
41
package/lean/luci-app-nps/luasrc/model/cbi/nps.lua
Executable file → Normal file
41
package/lean/luci-app-nps/luasrc/model/cbi/nps.lua
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
m = Map("nps")
|
||||
m.title=translate("Nps Setting")
|
||||
m.title = translate("Nps")
|
||||
m.description = translate("Nps is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.")
|
||||
|
||||
m:section(SimpleSection).template = "nps/nps_status"
|
||||
@ -8,38 +8,47 @@ s=m:section(TypedSection,"nps")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
s:tab("basic",translate("Basic Setting"))
|
||||
enable=s:taboption("basic",Flag,"enabled",translate("Enable"))
|
||||
enable = s:option(Flag, "enabled", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
server=s:taboption("basic",Value,"server_addr",translate("Server"),translate("Must an IPv4 address"))
|
||||
|
||||
server = s:option(Value, "server_addr", translate("Server"))
|
||||
server.description = translate("Must an IPv4 address")
|
||||
server.datatype = "ipaddr"
|
||||
server.optional = false
|
||||
server.rmempty = false
|
||||
port=s:taboption("basic",Value,"server_port",translate("Port"))
|
||||
|
||||
port = s:option(Value, "server_port", translate("Port"))
|
||||
port.datatype = "port"
|
||||
port.default = "8024"
|
||||
port.optional = false
|
||||
port.rmempty = false
|
||||
protocol=s:taboption("basic",ListValue,"protocol",translate("Protocol Type"))
|
||||
protocol.default="tcp"
|
||||
|
||||
protocol = s:option(ListValue, "protocol", translate("Protocol Type"))
|
||||
protocol:value("tcp", translate("TCP Protocol"))
|
||||
protocol:value("kcp", translate("KCP Protocol"))
|
||||
vkey=s:taboption("basic",Value,"vkey",translate("vkey"))
|
||||
protocol.default = "tcp"
|
||||
|
||||
vkey = s:option(Value, "vkey", translate("vkey"))
|
||||
vkey.optional = false
|
||||
vkey.password = true
|
||||
vkey.rmempty = false
|
||||
compress=s:taboption("basic",Flag,"compress",translate("Enable Compression"),translate("The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources."))
|
||||
|
||||
compress = s:option(Flag, "compress", translate("Enable Compression"))
|
||||
compress.description = translate("The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources.")
|
||||
compress.default = "1"
|
||||
compress.rmempty = false
|
||||
crypt=s:taboption("basic",Flag,"crypt",translate("Enable Encryption"),translate("Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted."))
|
||||
|
||||
crypt = s:option(Flag, "crypt", translate("Enable Encryption"))
|
||||
crypt.description = translate("Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted.")
|
||||
crypt.default = "1"
|
||||
crypt.rmempty = false
|
||||
log_level=s:taboption("basic",ListValue,"log_level",translate("Log Level"))
|
||||
log_level:value(0,"Emergency")
|
||||
log_level:value(2,"Critical")
|
||||
log_level:value(3,"Error")
|
||||
log_level:value(4,"Warning")
|
||||
log_level:value(7,"Debug")
|
||||
|
||||
log_level = s:option(ListValue,"log_level",translate("Log Level"))
|
||||
log_level:value(0,"Emergency", translate("Emergency"))
|
||||
log_level:value(2,"Critical", translate("Critical"))
|
||||
log_level:value(3,"Error", translate("Error"))
|
||||
log_level:value(4,"Warning", translate("Warning"))
|
||||
log_level:value(7,"Debug", translate("Debug"))
|
||||
log_level.default = "3"
|
||||
|
||||
return m
|
||||
|
@ -4,10 +4,10 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[nps]], [[status]])%>', null,
|
||||
var tb = document.getElementById('nps_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = "<em><b style='color:green;'>Nps <%:RUNNING%></b></em>";
|
||||
var links = "<em><b><font color=green>Nps <%:RUNNING%></font></b></em>";
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = "<em><b style='color:red;'>Nps <%:NOT RUNNING%></b></em>";
|
||||
tb.innerHTML = "<em><b><font color=red>Nps <%:NOT RUNNING%></font></b></em>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
msgid "Nps Setting"
|
||||
msgid "Nps"
|
||||
msgstr "Nps 内网穿透"
|
||||
|
||||
msgid "Nps is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."
|
||||
@ -22,11 +22,11 @@ msgstr "压缩传输内容,加快流量转发速度,会额外消耗 CPU 资
|
||||
msgid "Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted."
|
||||
msgstr "加密传输 npc 与 nps 之间的通信内容,会有效防止流量被拦截。"
|
||||
|
||||
msgid "<b style='color:green;'>Nps is running.</b>"
|
||||
msgstr "<b style='color:green;'>Nps 运行中</b>"
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "<b style='color:red;'>Nps is not running.</b>"
|
||||
msgstr "<b style='color:red;'>Nps 未运行</b>"
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Basic Setting"
|
||||
msgstr "基本设置"
|
||||
@ -42,3 +42,6 @@ msgstr "TCP"
|
||||
|
||||
msgid "KCP Protocol"
|
||||
msgstr "KCP"
|
||||
|
||||
msgid "Log Level"
|
||||
msgstr "日志级别"
|
||||
|
Loading…
x
Reference in New Issue
Block a user