• R/O
  • HTTP
  • SSH
  • HTTPS

luci: Commit

LuCI - OpenWrt Configuration Interface


Commit MetaInfo

Revisãoe3b7e8a2ee861d11f0e372c12154bd93cbe11022 (tree)
Hora2022-05-18 17:24:33
AutorBeginner-Go <70857188+Beginner-Go@user...>
CommiterTianling Shen

Mensagem de Log

luci-app-mwol: code alignment

Mudança Sumário

Diff

--- a/applications/luci-app-mwol/luasrc/controller/mwol.lua
+++ b/applications/luci-app-mwol/luasrc/controller/mwol.lua
@@ -1,11 +1,13 @@
11 --Copyright (C) 2019 mleaf <mleaf90@gmail.com>
22 --微信公众号【WiFi物联网】
3-module("luci.controller.mwol",package.seeall)
3+
4+module("luci.controller.mwol", package.seeall)
45
56 function index()
67 if not nixio.fs.access("/etc/config/mwol") then
78 return
89 end
10+
911 local page = entry({"admin", "services", "mwol"}, cbi("mwol"), _("Mwol"))
1012 page.dependent = true
1113 page.acl_depends = { "luci-app-mwol" }
--- a/applications/luci-app-mwol/luasrc/model/cbi/mwol.lua
+++ b/applications/luci-app-mwol/luasrc/model/cbi/mwol.lua
@@ -1,19 +1,20 @@
11 --Copyright (C) 2019 mleaf <mleaf90@gmail.com>
22 --微信公众号【WiFi物联网】
3+
34 local NXFS = require "nixio.fs"
45 local SYS = require "luci.sys"
56 local HTTP = require "luci.http"
67 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
1011 local encryption
1112 local sys = require "luci.sys"
1213
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")
1415
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>")
1718
1819 if SYS.call("pidof mwol >/dev/null") == 0 then
1920 Status = translate("<strong><font color=\"green\">Mwol正在运行...</font></strong>")
@@ -21,20 +22,20 @@ else
2122 Status = translate("<strong><font color=\"red\">Mwol未运行...</font></strong>")
2223 end
2324
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)
2627
2728 --
2829 -- LoRa Gateway config for gateway_conf
2930 --
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
3334 mwol.description = translate(string.format("%s<br /><br />%s<br><br />%s", Status, subTopic, pubTopic))
3435
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"))
3839
3940 --
4041 -- MQTT general
@@ -46,11 +47,12 @@ e.rmempty = false
4647
4748 e = mwol:taboption("general", Value, "hostname")
4849 e.title = translate("MQTT Server")
50+
4951 e = mwol:taboption("general", Value, "port")
5052 e.title = translate("MQTT Port")
5153
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")
5456 host.title = translate("Preset Mac")
5557 sys.net.mac_hints(function(mac, name)
5658 host:value(mac, "%s (%s)" %{ mac, name })
@@ -64,7 +66,7 @@ e.title = translate("MQTT Topic Id")
6466 --
6567 -- MQTT Using encryption
6668 --
67-encryption_enable = mwol:taboption("encryptionSettings", ListValue,"encryptionenable",translate("Enable"))
69+encryption_enable = mwol:taboption("encryptionSettings", ListValue, "encryptionenable", translate("Enable"))
6870 encryption_enable.optional = false;
6971 encryption_enable.rmempty = false;
7072 encryption_enable.default = 0
@@ -75,7 +77,7 @@ encryption_enable:value(0, translate("False"))
7577 --
7678 -- MQTT username
7779 --
78-encryption_username = mwol:taboption("encryptionSettings", Value,"username",translate("MQTT UserName"))
80+encryption_username = mwol:taboption("encryptionSettings", Value, "username", translate("MQTT UserName"))
7981 encryption_username.optional = true;
8082 encryption_username.rmempty = true;
8183 encryption_username.default = "mleaf"
@@ -85,7 +87,7 @@ encryption_username:depends("encryptionenable", "1")
8587 --
8688 -- MQTT password
8789 --
88-encryption_password = mwol:taboption("encryptionSettings", Value,"password",translate("MQTT Password"))
90+encryption_password = mwol:taboption("encryptionSettings", Value, "password", translate("MQTT Password"))
8991 encryption_password.optional = true;
9092 encryption_password.rmempty = true;
9193 encryption_password.default = "www.mleaf.org"
@@ -95,7 +97,7 @@ encryption_password:depends("encryptionenable", "1")
9597 --
9698 -- MQTT Using SSL
9799 --
98-ssl_enable = mwol:taboption("ssl", ListValue,"sslenable",translate("Enable"))
100+ssl_enable = mwol:taboption("ssl", ListValue, "sslenable", translate("Enable"))
99101 ssl_enable.optional = false;
100102 ssl_enable.rmempty = false;
101103 ssl_enable.default = 0
@@ -106,8 +108,8 @@ ssl_enable:value(0, translate("False"))
106108 --
107109 -- MQTT cafile
108110 --
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.")
111113 cafile.optional = true;
112114 cafile.rmempty = true;
113115 cafile.default = false
@@ -117,8 +119,8 @@ cafile:depends("sslenable", "1")
117119 --
118120 -- MQTT crtfile
119121 --
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.")
122124 crtfile.optional = true;
123125 crtfile.rmempty = true;
124126 crtfile.default = false
@@ -128,8 +130,8 @@ crtfile:depends("sslenable", "1")
128130 --
129131 -- MQTT keyfile
130132 --
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.")
133135 keyfile.optional = true;
134136 keyfile.rmempty = true;
135137 keyfile.default = false
Show on old repository browser