n2n_v2 & luci-app-n2n_v2: Fix stop error info for supernode and add n2n_v2 running status view (#3539)
* n2n_v2: Fix stop error info for supernode * luci-app-n2n_v2: Add n2n_v2 running status view * n2n: Bump pkg release version
This commit is contained in:
parent
2c22779b42
commit
19c07d3c26
@ -10,7 +10,7 @@ LUCI_TITLE:=n2n_v2 VPN Configuration module
|
|||||||
LUCI_DEPENDS:=+n2n_v2
|
LUCI_DEPENDS:=+n2n_v2
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_VERSION:=1.0
|
PKG_VERSION:=1.0
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
@ -11,8 +11,16 @@ function index()
|
|||||||
end
|
end
|
||||||
|
|
||||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||||
|
entry({"admin", "vpn", "n2n_v2", "status"}, call("n2n_status")).leaf = true
|
||||||
|
|
||||||
local page
|
local page
|
||||||
page = entry({"admin", "vpn", "n2n_v2"}, cbi("n2n_v2"), _("N2N v2 VPN"), 45)
|
page = entry({"admin", "vpn", "n2n_v2"}, cbi("n2n_v2"), _("N2N v2 VPN"), 45)
|
||||||
page.dependent = true
|
page.dependent = true
|
||||||
end
|
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
|
||||||
|
@ -8,6 +8,8 @@ local fs = require "nixio.fs"
|
|||||||
m = Map("n2n_v2", translate("N2N v2 VPN"),
|
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."))
|
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 = m:section(TypedSection, "edge", translate("N2N Edge Settings"))
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
s.addremove = true
|
s.addremove = true
|
||||||
|
20
package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm
Normal file
20
package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(5, '<%=url([[admin]], [[vpn]], [[n2n_v2]], [[status]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var status = document.getElementById('n2n_status');
|
||||||
|
if (data && status) {
|
||||||
|
if (data.running) {
|
||||||
|
status.innerHTML = "<em><b style='color:green;'>N2N v2 VPN <%:RUNNING%></b></em>";
|
||||||
|
} else {
|
||||||
|
status.innerHTML = "<em><b style='color:red;'>N2N v2 VPN <%:NOT RUNNING%></b></em>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="n2n_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
@ -52,3 +52,9 @@ msgstr "Supernode节点端口"
|
|||||||
|
|
||||||
msgid "Encryption key"
|
msgid "Encryption key"
|
||||||
msgstr "加密密钥"
|
msgstr "加密密钥"
|
||||||
|
|
||||||
|
msgid "<b style='color:green;'>N2N v2 VPN is running.</b>"
|
||||||
|
msgstr "<b style='color:green;'>N2N v2 VPN 运行中</b>"
|
||||||
|
|
||||||
|
msgid "<b style='color:red;'>N2N v2 VPN is not running.</b>"
|
||||||
|
msgstr "<b style='color:red;'>N2N v2 VPN 未运行</b>"
|
||||||
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=n2n_v2
|
PKG_NAME:=n2n_v2
|
||||||
PKG_VERSION:=2.4
|
PKG_VERSION:=2.4
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
PKG_REV=25563f31d9aba5f61b3e2fb42941b66dad1f531f
|
PKG_REV=25563f31d9aba5f61b3e2fb42941b66dad1f531f
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REV).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REV).tar.bz2
|
||||||
|
@ -60,5 +60,5 @@ start() {
|
|||||||
stop() {
|
stop() {
|
||||||
config_load 'n2n_v2'
|
config_load 'n2n_v2'
|
||||||
killall -9 edge
|
killall -9 edge
|
||||||
killall -9 supernode
|
ps | grep supernode | grep -v grep 2>&1 >/dev/null && killall -9 supernode
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user