OSDN Git Service

luci-app-ipsec-vpnd: tidy up code
authorBeginner-Go <70857188+Beginner-Go@users.noreply.github.com>
Thu, 5 May 2022 17:02:46 +0000 (17:02 +0000)
committerTianling Shen <cnsztl@gmail.com>
Sun, 15 May 2022 07:04:00 +0000 (15:04 +0800)
applications/luci-app-ipsec-vpnd/Makefile
applications/luci-app-ipsec-vpnd/luasrc/controller/ipsec-server.lua
applications/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server.lua [new file with mode: 0644]
applications/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/ipsec-server.lua [deleted file]
applications/luci-app-ipsec-vpnd/luasrc/view/ipsec/ipsec_status.htm
applications/luci-app-ipsec-vpnd/po/zh_Hans/ipsec.po
applications/luci-app-ipsec-vpnd/po/zh_Hans/luci-app-ipsec-vpnd.po [deleted file]
applications/luci-app-ipsec-vpnd/root/etc/uci-defaults/luci-ipsec [changed mode: 0644->0755]

index a36d3ad..8a109e9 100644 (file)
@@ -14,5 +14,3 @@ PKG_RELEASE:=11
 include ../../luci.mk
 
 # call BuildPackage - OpenWrt buildroot signature
-
-
index 3f343d8..c9df55c 100644 (file)
@@ -9,13 +9,13 @@ function index()
        page.dependent = false
        page.acl_depends = { "luci-app-ipsec-vpnd" }
 
-       entry({"admin", "vpn", "ipsec-server"}, cbi("ipsec-server/ipsec-server"), _("IPSec VPN Server"), 80)
-       entry({"admin", "vpn", "ipsec-server","status"},call("act_status")).leaf=true
+       entry({"admin", "vpn", "ipsec-server"}, cbi("ipsec-server"), _("IPSec VPN Server"), 80)
+       entry({"admin", "vpn", "ipsec-server", "status"}, call("act_status")).leaf = true
 end
 
 function act_status()
-  local e={}
-  e.running=luci.sys.call("pgrep ipsec >/dev/null")==0
-  luci.http.prepare_content("application/json")
-  luci.http.write_json(e)
+       local e = {}
+       e.running = luci.sys.call("pgrep ipsec >/dev/null") == 0
+       luci.http.prepare_content("application/json")
+       luci.http.write_json(e)
 end
diff --git a/applications/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server.lua b/applications/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server.lua
new file mode 100644 (file)
index 0000000..60217f8
--- /dev/null
@@ -0,0 +1,34 @@
+m = Map("ipsec", translate("IPSec VPN Server"))
+m.description = translate("IPSec VPN connectivity using the native built-in VPN Client on iOS or Andriod (IKEv1 with PSK and Xauth)")
+
+m:section(SimpleSection).template  = "ipsec/ipsec_status"
+
+s = m:section(NamedSection, "ipsec", "service")
+s.anonymouse = true
+
+o = s:option(Flag, "enabled", translate("Enable"))
+o.default = 0
+o.rmempty = false
+
+o = s:option(Value, "clientip", translate("VPN Client IP"))
+o.description = translate("LAN DHCP reserved started IP addresses with the same subnet mask")
+o.datatype = "ip4addr"
+o.optional = false
+o.rmempty = false
+
+o = s:option(Value, "clientdns", translate("VPN Client DNS"))
+o.description = translate("DNS using in VPN tunnel.Set to the router's LAN IP is recommended")
+o.datatype = "ip4addr"
+o.optional = false
+o.rmempty = false
+
+o = s:option(Value, "account", translate("Account"))
+o.datatype = "string"
+
+o = s:option(Value, "password", translate("Password"))
+o.password = true
+
+o = s:option(Value, "secret", translate("Secret Pre-Shared Key"))
+o.password = true
+
+return m
diff --git a/applications/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/ipsec-server.lua b/applications/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/ipsec-server.lua
deleted file mode 100644 (file)
index 79a47b8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-mp = Map("ipsec", translate("IPSec VPN Server"))
-mp.description = translate("IPSec VPN connectivity using the native built-in VPN Client on iOS or Andriod (IKEv1 with PSK and Xauth)")
-
-mp:section(SimpleSection).template  = "ipsec/ipsec_status"
-
-s = mp:section(NamedSection, "ipsec", "service")
-s.anonymouse = true
-
-enabled = s:option(Flag, "enabled", translate("Enable"))
-enabled.default = 0
-enabled.rmempty = false
-
-clientip = s:option(Value, "clientip", translate("VPN Client IP"))
-clientip.datatype = "ip4addr"
-clientip.description = translate("LAN DHCP reserved started IP addresses with the same subnet mask")
-clientip.optional = false
-clientip.rmempty = false
-
-clientdns = s:option(Value, "clientdns", translate("VPN Client DNS"))
-clientdns.datatype = "ip4addr"
-clientdns.description = translate("DNS using in VPN tunnel.Set to the router's LAN IP is recommended")
-clientdns.optional = false
-clientdns.rmempty = false
-
-account = s:option(Value, "account", translate("Account"))
-account.datatype = "string"
-
-password = s:option(Value, "password", translate("Password"))
-password.password = true
-
-secret = s:option(Value, "secret", translate("Secret Pre-Shared Key"))
-secret.password = true
-
-return mp
index 60225b4..1e256c7 100644 (file)
@@ -19,4 +19,4 @@ XHR.poll(3, '<%=url([[admin]], [[vpn]], [[ipsec-server]], [[status]])%>', null,
        <p id="ipsec_status">
                <em><%:Collecting data...%></em>
        </p>
-</fieldset>
\ No newline at end of file
+</fieldset>
index 0bf6b62..e37dd94 100644 (file)
@@ -1,3 +1,83 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Project-Id-Version: PACKAGE VERSION\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: zh-Hans\n"
+"MIME-Version: 1.0\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:26
+msgid "Account"
+msgstr "账户"
+
+#: luasrc/view/ipsec/ipsec_status.htm:20
+msgid "Collecting data..."
+msgstr ""
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:22
+msgid "DNS using in VPN tunnel.Set to the router's LAN IP is recommended"
+msgstr "指定VPN客户端的DNS地址。推荐设置为路由器的LAN IP,例如 192.168.0.1"
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:10
+msgid "Enable"
+msgstr ""
+
+#: luasrc/controller/ipsec-server.lua:10
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:2
+msgid "IPSec VPN Server"
+msgstr "IPSec VPN 服务器"
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:3
+msgid ""
+"IPSec VPN connectivity using the native built-in VPN Client on iOS or "
+"Andriod (IKEv1 with PSK and Xauth)"
+msgstr ""
+"使用iOS 或者 Andriod (IKEv1 with PSK and Xauth) 原生内置 IPSec VPN 客户端进行"
+"连接"
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:16
+msgid "LAN DHCP reserved started IP addresses with the same subnet mask"
+msgstr ""
+"VPN客户端使用DHCP保留空余IP的起始地址,必须和路由器LAN同一个子网掩码,例如 "
+"192.168.0.10/24"
+
+#: luasrc/view/ipsec/ipsec_status.htm:10
+msgid "NOT RUNNING"
+msgstr ""
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:29
+msgid "Password"
+msgstr ""
+
+#: luasrc/view/ipsec/ipsec_status.htm:7
+msgid "RUNNING"
+msgstr ""
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:32
+msgid "Secret Pre-Shared Key"
+msgstr "PSK密钥"
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:20
+msgid "VPN Client DNS"
+msgstr "VPN客户端DNS服务器"
+
+#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:14
+msgid "VPN Client IP"
+msgstr "VPN客户端地址段"
+
+#~ msgid "IPSec VPN Server status"
+#~ msgstr "IPSec VPN 服务器运行状态"
+
+#~ msgid "Disable from startup"
+#~ msgstr "禁止开机启动"
+
+#~ msgid "Enable on startup"
+#~ msgstr "允许开机启动"
+
+
+
 msgid "IPSec VPN Server"
 msgstr "IPSec VPN 服务器"
 
@@ -30,5 +110,3 @@ msgstr "禁止开机启动"
 
 msgid "Enable on startup"
 msgstr "允许开机启动"
-
-
diff --git a/applications/luci-app-ipsec-vpnd/po/zh_Hans/luci-app-ipsec-vpnd.po b/applications/luci-app-ipsec-vpnd/po/zh_Hans/luci-app-ipsec-vpnd.po
deleted file mode 100644 (file)
index 35e3ec2..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-msgid ""
-msgstr ""
-"Content-Type: text/plain; charset=UTF-8\n"
-"Project-Id-Version: PACKAGE VERSION\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
-"Language: zh-Hans\n"
-"MIME-Version: 1.0\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:26
-msgid "Account"
-msgstr "账户"
-
-#: luasrc/view/ipsec/ipsec_status.htm:20
-msgid "Collecting data..."
-msgstr ""
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:22
-msgid "DNS using in VPN tunnel.Set to the router's LAN IP is recommended"
-msgstr "指定VPN客户端的DNS地址。推荐设置为路由器的LAN IP,例如 192.168.0.1"
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:10
-msgid "Enable"
-msgstr ""
-
-#: luasrc/controller/ipsec-server.lua:10
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:2
-msgid "IPSec VPN Server"
-msgstr "IPSec VPN 服务器"
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:3
-msgid ""
-"IPSec VPN connectivity using the native built-in VPN Client on iOS or "
-"Andriod (IKEv1 with PSK and Xauth)"
-msgstr ""
-"使用iOS 或者 Andriod (IKEv1 with PSK and Xauth) 原生内置 IPSec VPN 客户端进行"
-"连接"
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:16
-msgid "LAN DHCP reserved started IP addresses with the same subnet mask"
-msgstr ""
-"VPN客户端使用DHCP保留空余IP的起始地址,必须和路由器LAN同一个子网掩码,例如 "
-"192.168.0.10/24"
-
-#: luasrc/view/ipsec/ipsec_status.htm:10
-msgid "NOT RUNNING"
-msgstr ""
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:29
-msgid "Password"
-msgstr ""
-
-#: luasrc/view/ipsec/ipsec_status.htm:7
-msgid "RUNNING"
-msgstr ""
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:32
-msgid "Secret Pre-Shared Key"
-msgstr "PSK密钥"
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:20
-msgid "VPN Client DNS"
-msgstr "VPN客户端DNS服务器"
-
-#: luasrc/model/cbi/ipsec-server/ipsec-server.lua:14
-msgid "VPN Client IP"
-msgstr "VPN客户端地址段"
-
-#~ msgid "IPSec VPN Server status"
-#~ msgstr "IPSec VPN 服务器运行状态"
-
-#~ msgid "Disable from startup"
-#~ msgstr "禁止开机启动"
-
-#~ msgid "Enable on startup"
-#~ msgstr "允许开机启动"