LuCI - OpenWrt Configuration Interface
Revisão | e3b7e8a2ee861d11f0e372c12154bd93cbe11022 (tree) |
---|---|
Hora | 2022-05-18 17:24:33 |
Autor | Beginner-Go <70857188+Beginner-Go@user...> |
Commiter | Tianling Shen |
luci-app-mwol: code alignment
@@ -1,11 +1,13 @@ | ||
1 | 1 | --Copyright (C) 2019 mleaf <mleaf90@gmail.com> |
2 | 2 | --微信公众号【WiFi物联网】 |
3 | -module("luci.controller.mwol",package.seeall) | |
3 | + | |
4 | +module("luci.controller.mwol", package.seeall) | |
4 | 5 | |
5 | 6 | function index() |
6 | 7 | if not nixio.fs.access("/etc/config/mwol") then |
7 | 8 | return |
8 | 9 | end |
10 | + | |
9 | 11 | local page = entry({"admin", "services", "mwol"}, cbi("mwol"), _("Mwol")) |
10 | 12 | page.dependent = true |
11 | 13 | page.acl_depends = { "luci-app-mwol" } |
@@ -1,19 +1,20 @@ | ||
1 | 1 | --Copyright (C) 2019 mleaf <mleaf90@gmail.com> |
2 | 2 | --微信公众号【WiFi物联网】 |
3 | + | |
3 | 4 | local NXFS = require "nixio.fs" |
4 | 5 | local SYS = require "luci.sys" |
5 | 6 | local HTTP = require "luci.http" |
6 | 7 | local DISP = require "luci.dispatcher" |
7 | -local Status,subTopic,pubTopic | |
8 | -local m,s | |
9 | -local e,mwol | |
8 | +local Status, subTopic, pubTopic | |
9 | +local m, s | |
10 | +local e, mwol | |
10 | 11 | local encryption |
11 | 12 | local sys = require "luci.sys" |
12 | 13 | |
13 | -local mac=luci.sys.exec("uci -q get mwol.mwol_conf.id") | |
14 | +local mac = luci.sys.exec("uci -q get mwol.mwol_conf.id") | |
14 | 15 | |
15 | -m=Map("mwol",translate("Mqtt wake on lan"),translate("请关注微信公众号【WiFi物联网】获取更多信息: \ | |
16 | -<a href=\"http://www.mleaf.org/downloads/logo/201911171573997716658567.jpg\" target=\"_blank\">【WiFi物联网】</a>")) | |
16 | +m = Map("mwol", translate("Mqtt wake on lan")) | |
17 | +m.description = translate("请关注微信公众号【WiFi物联网】获取更多信息: \<a href=\"http://www.mleaf.org/downloads/logo/201911171573997716658567.jpg\" target=\"_blank\">【WiFi物联网】</a>") | |
17 | 18 | |
18 | 19 | if SYS.call("pidof mwol >/dev/null") == 0 then |
19 | 20 | Status = translate("<strong><font color=\"green\">Mwol正在运行...</font></strong>") |
@@ -21,20 +22,20 @@ else | ||
21 | 22 | Status = translate("<strong><font color=\"red\">Mwol未运行...</font></strong>") |
22 | 23 | end |
23 | 24 | |
24 | -subTopic=string.format("<strong><font color=\"red\">Mwol订阅消息主题: /mwol/pub/%s</font></strong>", mac) | |
25 | -pubTopic=string.format("<strong><font color=\"red\">Mwol发布消息主题: /mwol/sub/%s</font></strong>", mac) | |
25 | +subTopic = string.format("<strong><font color=\"red\">Mwol订阅消息主题: /mwol/pub/%s</font></strong>", mac) | |
26 | +pubTopic = string.format("<strong><font color=\"red\">Mwol发布消息主题: /mwol/sub/%s</font></strong>", mac) | |
26 | 27 | |
27 | 28 | -- |
28 | 29 | -- LoRa Gateway config for gateway_conf |
29 | 30 | -- |
30 | -mwol=m:section(TypedSection,"mwol","") | |
31 | ---mwol.addremove=false | |
32 | -mwol.anonymous=true | |
31 | +mwol = m:section(TypedSection, "mwol") | |
32 | +--mwol.addremove = false | |
33 | +mwol.anonymous = true | |
33 | 34 | mwol.description = translate(string.format("%s<br /><br />%s<br><br />%s", Status, subTopic, pubTopic)) |
34 | 35 | |
35 | -mwol:tab("general", translate("General Settings")) | |
36 | -mwol:tab("encryptionSettings", translate("Encryption Settings")) | |
37 | -mwol:tab("ssl", translate("SSL Settings")) | |
36 | +mwol:tab("general", translate("General Settings")) | |
37 | +mwol:tab("encryptionSettings", translate("Encryption Settings")) | |
38 | +mwol:tab("ssl", translate("SSL Settings")) | |
38 | 39 | |
39 | 40 | -- |
40 | 41 | -- MQTT general |
@@ -46,11 +47,12 @@ e.rmempty = false | ||
46 | 47 | |
47 | 48 | e = mwol:taboption("general", Value, "hostname") |
48 | 49 | e.title = translate("MQTT Server") |
50 | + | |
49 | 51 | e = mwol:taboption("general", Value, "port") |
50 | 52 | e.title = translate("MQTT Port") |
51 | 53 | |
52 | -host = mwol:taboption("general", Value, "presetmac", translate("Host to wake up"), | |
53 | - translate("Choose the host to wake up or enter a custom MAC address to use")) | |
54 | +host = mwol:taboption("general", Value, "presetmac", translate("Host to wake up")) | |
55 | +host.description = translate("Choose the host to wake up or enter a custom MAC address to use") | |
54 | 56 | host.title = translate("Preset Mac") |
55 | 57 | sys.net.mac_hints(function(mac, name) |
56 | 58 | host:value(mac, "%s (%s)" %{ mac, name }) |
@@ -64,7 +66,7 @@ e.title = translate("MQTT Topic Id") | ||
64 | 66 | -- |
65 | 67 | -- MQTT Using encryption |
66 | 68 | -- |
67 | -encryption_enable = mwol:taboption("encryptionSettings", ListValue,"encryptionenable",translate("Enable")) | |
69 | +encryption_enable = mwol:taboption("encryptionSettings", ListValue, "encryptionenable", translate("Enable")) | |
68 | 70 | encryption_enable.optional = false; |
69 | 71 | encryption_enable.rmempty = false; |
70 | 72 | encryption_enable.default = 0 |
@@ -75,7 +77,7 @@ encryption_enable:value(0, translate("False")) | ||
75 | 77 | -- |
76 | 78 | -- MQTT username |
77 | 79 | -- |
78 | -encryption_username = mwol:taboption("encryptionSettings", Value,"username",translate("MQTT UserName")) | |
80 | +encryption_username = mwol:taboption("encryptionSettings", Value, "username", translate("MQTT UserName")) | |
79 | 81 | encryption_username.optional = true; |
80 | 82 | encryption_username.rmempty = true; |
81 | 83 | encryption_username.default = "mleaf" |
@@ -85,7 +87,7 @@ encryption_username:depends("encryptionenable", "1") | ||
85 | 87 | -- |
86 | 88 | -- MQTT password |
87 | 89 | -- |
88 | -encryption_password = mwol:taboption("encryptionSettings", Value,"password",translate("MQTT Password")) | |
90 | +encryption_password = mwol:taboption("encryptionSettings", Value, "password", translate("MQTT Password")) | |
89 | 91 | encryption_password.optional = true; |
90 | 92 | encryption_password.rmempty = true; |
91 | 93 | encryption_password.default = "www.mleaf.org" |
@@ -95,7 +97,7 @@ encryption_password:depends("encryptionenable", "1") | ||
95 | 97 | -- |
96 | 98 | -- MQTT Using SSL |
97 | 99 | -- |
98 | -ssl_enable = mwol:taboption("ssl", ListValue,"sslenable",translate("Enable")) | |
100 | +ssl_enable = mwol:taboption("ssl", ListValue, "sslenable", translate("Enable")) | |
99 | 101 | ssl_enable.optional = false; |
100 | 102 | ssl_enable.rmempty = false; |
101 | 103 | ssl_enable.default = 0 |
@@ -106,8 +108,8 @@ ssl_enable:value(0, translate("False")) | ||
106 | 108 | -- |
107 | 109 | -- MQTT cafile |
108 | 110 | -- |
109 | -cafile = mwol:taboption("ssl", Value,"cafile",translate("ca"), | |
110 | - translate("Edit the ca file path.")) | |
111 | +cafile = mwol:taboption("ssl", Value, "cafile", translate("ca")) | |
112 | +cafile.description = translate("Edit the ca file path.") | |
111 | 113 | cafile.optional = true; |
112 | 114 | cafile.rmempty = true; |
113 | 115 | cafile.default = false |
@@ -117,8 +119,8 @@ cafile:depends("sslenable", "1") | ||
117 | 119 | -- |
118 | 120 | -- MQTT crtfile |
119 | 121 | -- |
120 | -crtfile = mwol:taboption("ssl", Value,"crtfile",translate("crt"), | |
121 | - translate("Edit the crt file path.")) | |
122 | +crtfile = mwol:taboption("ssl", Value, "crtfile", translate("crt")) | |
123 | +crtfile.description = translate("Edit the crt file path.") | |
122 | 124 | crtfile.optional = true; |
123 | 125 | crtfile.rmempty = true; |
124 | 126 | crtfile.default = false |
@@ -128,8 +130,8 @@ crtfile:depends("sslenable", "1") | ||
128 | 130 | -- |
129 | 131 | -- MQTT keyfile |
130 | 132 | -- |
131 | -keyfile = mwol:taboption("ssl", Value,"keyfile",translate("key"), | |
132 | - translate("Edit the key file path.")) | |
133 | +keyfile = mwol:taboption("ssl", Value, "keyfile", translate("key")) | |
134 | +keyfile.description = translate("Edit the key file path.") | |
133 | 135 | keyfile.optional = true; |
134 | 136 | keyfile.rmempty = true; |
135 | 137 | keyfile.default = false |