luci-app-softethervpn: tidy up luci (#8214)

This commit is contained in:
Beginner 2021-11-16 16:18:33 +08:00 committed by GitHub
parent 156a636522
commit f31188e2f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 51 deletions

View File

@ -9,10 +9,8 @@ LUCI_TITLE:=LuCI support for SoftEtherVPN
LUCI_DEPENDS:=+zlib +libpthread +librt +libreadline +libncurses +libiconv-full +kmod-tun +libopenssl +softethervpn5-bridge +softethervpn5-client +softethervpn5-server LUCI_DEPENDS:=+zlib +libpthread +librt +libreadline +libncurses +libiconv-full +kmod-tun +libopenssl +softethervpn5-bridge +softethervpn5-client +softethervpn5-server
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=1.0 PKG_VERSION:=1.0
PKG_RELEASE:=3 PKG_RELEASE:=4
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature # call BuildPackage - OpenWrt buildroot signature

View File

@ -6,13 +6,13 @@ function index()
end end
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin", "vpn", "softethervpn"}, cbi("softethervpn"), _("SoftEther VPN"), 50).dependent = true entry({"admin", "vpn", "softethervpn"}, cbi("softethervpn"), _("SoftEther VPN Service"), 50).dependent = true
entry({"admin", "vpn", "softethervpn", "status"}, call("status")).leaf = true entry({"admin", "vpn", "softethervpn", "status"}, call("act_status")).leaf = true
end end
function status() function act_status()
local e={} local e = {}
e.status=luci.sys.call("pidof %s >/dev/null"%"vpnserver")==0 e.running = luci.sys.call("pidof vpnserver >/dev/null") == 0
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
luci.http.write_json(e) luci.http.write_json(e)
end end

View File

@ -1,14 +1,18 @@
local s=require"luci.sys" local s = require"luci.sys"
local m,s,o local m,s,o
m=Map("softethervpn",translate("SoftEther VPN"))
m = Map("softethervpn")
m.title = translate("SoftEther VPN Service")
m.description = translate("SoftEther VPN is an open source, cross-platform, multi-protocol virtual private network solution developed by university of tsukuba graduate student Daiyuu Nobori for master's thesis. <br>can easily set up OpenVPN, IPsec, L2TP, ms-sstp, L2TPv3 and EtherIP servers on the router using the console.") m.description = translate("SoftEther VPN is an open source, cross-platform, multi-protocol virtual private network solution developed by university of tsukuba graduate student Daiyuu Nobori for master's thesis. <br>can easily set up OpenVPN, IPsec, L2TP, ms-sstp, L2TPv3 and EtherIP servers on the router using the console.")
m.template="softethervpn/index"
s=m:section(TypedSection,"softether") m:section(SimpleSection).template = "softethervpn/softethervpn_status"
s.anonymous=true
o=s:option(DummyValue,"softethervpn_status",translate("Current Condition")) s = m:section(TypedSection, "softether")
o.template="softethervpn/status" s.anonymous = true
o.value=translate("Collecting data...")
o=s:option(Flag,"enable",translate("Enabled")) o = s:option(Flag, "enable", translate("Enabled"))
o.rmempty=false o.rmempty = false
o=s:option(DummyValue,"moreinfo",translate("<strong>控制台下载:<a onclick=\"window.open('https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.30-9696-beta/softether-vpnserver_vpnbridge-v4.30-9696-beta-2019.07.08-windows-x86_x64-intel.exe')\"><br/>Windows-x86_x64-intel.exe</a><a onclick=\"window.open('https://www.softether-download.com/files/softether/v4.21-9613-beta-2016.04.24-tree/Mac_OS_X/Admin_Tools/VPN_Server_Manager_Package/softether-vpnserver_manager-v4.21-9613-beta-2016.04.24-macos-x86-32bit.pkg')\"><br/>macos-x86-32bit.pkg</a></strong>"))
o = s:option(DummyValue, "moreinfo", translate("<strong>控制台下载:<a onclick=\"window.open('https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.30-9696-beta/softether-vpnserver_vpnbridge-v4.30-9696-beta-2019.07.08-windows-x86_x64-intel.exe')\"><br/>Windows-x86_x64-intel.exe</a><a onclick=\"window.open('https://www.softether-download.com/files/softether/v4.21-9613-beta-2016.04.24-tree/Mac_OS_X/Admin_Tools/VPN_Server_Manager_Package/softether-vpnserver_manager-v4.21-9613-beta-2016.04.24-macos-x86-32bit.pkg')\"><br/>macos-x86-32bit.pkg</a></strong>"))
return m return m

View File

@ -1,18 +0,0 @@
<%#
Copyright (C) 2018-2019 Lienol
Licensed to the public under the Apache License 2.0.
-%>
<% include("cbi/map") %>
<script type="text/javascript">//<![CDATA[
XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "vpn", "softethervpn", "status")%>', null,
function(x, result)
{
var status = document.getElementsByClassName('softethervpn_status')[0];
status.setAttribute("style","font-weight:bold;");
status.setAttribute("color",result.status ? "green":"red");
status.innerHTML = result.status?'<%=translate("RUNNING")%>':'<%=translate("NOT RUNNING")%>';
}
)
//]]>
</script>

View File

@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[softethervpn]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('softethervpn_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>softethervpn <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>softethervpn <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="softethervpn_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -1,3 +0,0 @@
<%+cbi/valueheader%>
<font class="softethervpn_status"><%=pcdata(self:cfgvalue(section) or self.default or "")%></font>
<%+cbi/valuefooter%>

View File

@ -1,23 +1,20 @@
msgid "SoftEther VPN" msgid "SoftEther VPN Service"
msgstr "SoftEther VPN 服务器" msgstr "SoftEther VPN 服务器"
msgid "SoftEther VPN is an open source, cross-platform, multi-protocol virtual private network solution developed by university of tsukuba graduate student Daiyuu Nobori for master's thesis. <br>can easily set up OpenVPN, IPsec, L2TP, ms-sstp, L2TPv3 and EtherIP servers on the router using the console." msgid "SoftEther VPN is an open source, cross-platform, multi-protocol virtual private network solution developed by university of tsukuba graduate student Daiyuu Nobori for master's thesis. <br>can easily set up OpenVPN, IPsec, L2TP, ms-sstp, L2TPv3 and EtherIP servers on the router using the console."
msgstr "SoftEther VPN是由筑波大学研究生Daiyuu Nobori因硕士论文开发的开源跨平台多重协定的虚拟私人网路方案。<br/>使用控制台可以轻松在路由器上搭建OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 和 EtherIP服务器。" msgstr "SoftEther VPN是由筑波大学研究生Daiyuu Nobori因硕士论文开发的开源跨平台多重协定的虚拟私人网路方案。<br/>使用控制台可以轻松在路由器上搭建OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 和 EtherIP服务器。"
msgid "PPTP VPN Server status"
msgstr "PPTP VPN 服务器运行状态"
msgid "Current Condition"
msgstr "当前状态"
msgid "Enabled" msgid "Enabled"
msgstr "启用" msgstr "启用"
msgid "PPTP VPN Server status"
msgstr "PPTP VPN 服务器运行状态"
msgid "Open L2TP/IPSec firewall" msgid "Open L2TP/IPSec firewall"
msgstr "开启L2TP/IPSec防火墙" msgstr "开启 L2TP/IPSec 防火墙"
msgid "Open the MS-SSTP firewall" msgid "Open the MS-SSTP firewall"
msgstr "开启MS-SSTP防火墙" msgstr "开启 MS-SSTP 防火墙"
msgid "Open the OpenVPN firewall" msgid "Open the OpenVPN firewall"
msgstr "开启OpenVPN防火墙" msgstr "开启 OpenVPN 防火墙"

View File

@ -1,4 +1,3 @@
config softether config softether
option enable '0' option enable '0'