diff --git a/package/lean/luci-app-n2n_v2/Makefile b/package/lean/luci-app-n2n_v2/Makefile index 55eecd40d..a92981d3b 100755 --- a/package/lean/luci-app-n2n_v2/Makefile +++ b/package/lean/luci-app-n2n_v2/Makefile @@ -10,7 +10,7 @@ LUCI_TITLE:=n2n_v2 VPN Configuration module LUCI_DEPENDS:=+n2n_v2 LUCI_PKGARCH:=all PKG_VERSION:=1.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua b/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua index a1d599886..b761feec5 100644 --- a/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua +++ b/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua @@ -11,8 +11,16 @@ function index() end entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false + entry({"admin", "vpn", "n2n_v2", "status"}, call("n2n_status")).leaf = true local page page = entry({"admin", "vpn", "n2n_v2"}, cbi("n2n_v2"), _("N2N v2 VPN"), 45) page.dependent = true end + +function n2n_status() + local status = {} + status.running = luci.sys.call("pgrep edge >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(status) +end diff --git a/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua b/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua index 338e066e2..83e09a487 100644 --- a/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua +++ b/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua @@ -8,6 +8,8 @@ local fs = require "nixio.fs" m = Map("n2n_v2", translate("N2N v2 VPN"), translatef("n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level.")) +m:section(SimpleSection).template = "n2n_v2/status" + s = m:section(TypedSection, "edge", translate("N2N Edge Settings")) s.anonymous = true s.addremove = true diff --git a/package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm b/package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm new file mode 100644 index 000000000..b6e57da76 --- /dev/null +++ b/package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm @@ -0,0 +1,20 @@ + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po b/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po index beedc04ae..93e86e0a9 100755 --- a/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po +++ b/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po @@ -52,3 +52,9 @@ msgstr "Supernode节点端口" msgid "Encryption key" msgstr "加密密钥" + +msgid "N2N v2 VPN is running." +msgstr "N2N v2 VPN 运行中" + +msgid "N2N v2 VPN is not running." +msgstr "N2N v2 VPN 未运行" diff --git a/package/lean/n2n_v2/Makefile b/package/lean/n2n_v2/Makefile index 01f0415c5..a0e45ada3 100644 --- a/package/lean/n2n_v2/Makefile +++ b/package/lean/n2n_v2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=n2n_v2 PKG_VERSION:=2.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_REV=25563f31d9aba5f61b3e2fb42941b66dad1f531f PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REV).tar.bz2 diff --git a/package/lean/n2n_v2/files/n2n_v2.init b/package/lean/n2n_v2/files/n2n_v2.init index f4d2b4717..65103d2a8 100644 --- a/package/lean/n2n_v2/files/n2n_v2.init +++ b/package/lean/n2n_v2/files/n2n_v2.init @@ -60,5 +60,5 @@ start() { stop() { config_load 'n2n_v2' killall -9 edge - killall -9 supernode + ps | grep supernode | grep -v grep 2>&1 >/dev/null && killall -9 supernode }