diff --git a/package/lean/luci-app-nps/Makefile b/package/lean/luci-app-nps/Makefile index 6f3ec99fc..11dc18020 100644 --- a/package/lean/luci-app-nps/Makefile +++ b/package/lean/luci-app-nps/Makefile @@ -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 diff --git a/package/lean/luci-app-nps/luasrc/controller/nps.lua b/package/lean/luci-app-nps/luasrc/controller/nps.lua old mode 100755 new mode 100644 index de4c3c276..a9d04bc8d --- a/package/lean/luci-app-nps/luasrc/controller/nps.lua +++ b/package/lean/luci-app-nps/luasrc/controller/nps.lua @@ -1,16 +1,17 @@ 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() - local e={} - e.running=luci.sys.call("pgrep npc > /dev/null")==0 +function act_status() + local e = {} + e.running = luci.sys.call("pgrep npc > /dev/null") == 0 luci.http.prepare_content("application/json") luci.http.write_json(e) end diff --git a/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua b/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua old mode 100755 new mode 100644 index 829e1bea3..9c37fc6b6 --- a/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua +++ b/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua @@ -1,45 +1,54 @@ -m=Map("nps") -m.title=translate("Nps Setting") -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 = Map("nps") +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" +m:section(SimpleSection).template = "nps/nps_status" -s=m:section(TypedSection,"nps") -s.addremove=false -s.anonymous=true +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.rmempty=false -server=s:taboption("basic",Value,"server_addr",translate("Server"),translate("Must an IPv4 address")) -server.datatype="ipaddr" -server.optional=false -server.rmempty=false -port=s:taboption("basic",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:value("tcp",translate("TCP Protocol")) -protocol:value("kcp",translate("KCP Protocol")) -vkey=s:taboption("basic",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.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.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.default="3" +enable = s:option(Flag, "enabled", translate("Enable")) +enable.rmempty = false + +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:option(Value, "server_port", translate("Port")) +port.datatype = "port" +port.default = "8024" +port.optional = false +port.rmempty = false + +protocol = s:option(ListValue, "protocol", translate("Protocol Type")) +protocol:value("tcp", translate("TCP Protocol")) +protocol:value("kcp", translate("KCP Protocol")) +protocol.default = "tcp" + +vkey = s:option(Value, "vkey", translate("vkey")) +vkey.optional = false +vkey.password = true +vkey.rmempty = false + +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: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: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 diff --git a/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm b/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm index aef743b9c..be7f9dafd 100755 --- a/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm +++ b/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm @@ -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 = "Nps <%:RUNNING%>"; + var links = "Nps <%:RUNNING%>"; tb.innerHTML = links; } else { - tb.innerHTML = "Nps <%:NOT RUNNING%>"; + tb.innerHTML = "Nps <%:NOT RUNNING%>"; } } } diff --git a/package/lean/luci-app-nps/po/zh-cn/nps.po b/package/lean/luci-app-nps/po/zh-cn/nps.po index 3891bc0c8..cb89ed59c 100644 --- a/package/lean/luci-app-nps/po/zh-cn/nps.po +++ b/package/lean/luci-app-nps/po/zh-cn/nps.po @@ -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 "Nps is running." -msgstr "Nps 运行中" +msgid "RUNNING" +msgstr "运行中" -msgid "Nps is not running." -msgstr "Nps 未运行" +msgid "NOT RUNNING" +msgstr "未运行" msgid "Basic Setting" msgstr "基本设置" @@ -42,3 +42,6 @@ msgstr "TCP" msgid "KCP Protocol" msgstr "KCP" + +msgid "Log Level" +msgstr "日志级别"