diff options
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r-- | modules/luci-base/luasrc/cbi/datatypes.lua | 118 | ||||
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 6 | ||||
-rw-r--r-- | modules/luci-base/luasrc/model/network.lua | 9 | ||||
-rw-r--r-- | modules/luci-base/luasrc/sys/iptparser.lua | 36 | ||||
-rw-r--r-- | modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua | 236 | ||||
-rw-r--r-- | modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua | 93 | ||||
-rw-r--r-- | modules/luci-base/luasrc/tools/status.lua | 15 | ||||
-rw-r--r-- | modules/luci-base/luasrc/tools/webadmin.lua | 2 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm | 4 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/fvalue.htm | 1 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/lvalue.htm | 3 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/mvalue.htm | 5 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/network_ifacelist.htm | 12 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/cbi/network_netlist.htm | 3 |
14 files changed, 281 insertions, 262 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua index 626ad91c75..cf56566287 100644 --- a/modules/luci-base/luasrc/cbi/datatypes.lua +++ b/modules/luci-base/luasrc/cbi/datatypes.lua @@ -1,4 +1,5 @@ -- Copyright 2010 Jo-Philipp Wich <jow@openwrt.org> +-- Copyright 2017 Dan Luedtke <mail@danrl.com> -- Licensed to the public under the Apache License 2.0. local fs = require "nixio.fs" @@ -131,6 +132,48 @@ function ip6prefix(val) return ( val and val >= 0 and val <= 128 ) end +function ipmask(val) + return ipmask4(val) or ipmask6(val) +end + +function ipmask4(val) + local ip, mask = val:match("^([^/]+)/([^/]+)$") + local bits = tonumber(mask) + + if bits and (bits < 0 or bits > 32) then + return false + end + + if not bits and mask and not ip4addr(mask) then + return false + end + + return ip4addr(ip or val) +end + +function ipmask6(val) + local ip, mask = val:match("^([^/]+)/([^/]+)$") + local bits = tonumber(mask) + + if bits and (bits < 0 or bits > 128) then + return false + end + + if not bits and mask and not ip6addr(mask) then + return false + end + + return ip6addr(ip or val) +end + +function ip6hostid(val) + if val and val:match("^[a-fA-F0-9:]+$") and (#val > 2) then + return (ip6addr("2001:db8:0:0" .. val) or ip6addr("2001:db8:0:0:" .. val)) + end + + return false +end + function port(val) val = tonumber(val) return ( val and val >= 0 and val <= 65535 ) @@ -233,11 +276,33 @@ function wepkey(val) end end +function hexstring(val) + if val then + return (val:match("^[a-fA-F0-9]+$") ~= nil) + end + return false +end + +function hex(val, maxbytes) + maxbytes = tonumber(maxbytes) + if val and maxbytes ~= nil then + return ((val:match("^0x[a-fA-F0-9]+$") ~= nil) and (#val <= 2 + maxbytes * 2)) + end + return false +end + +function base64(val) + if val then + return (val:match("^[a-zA-Z0-9/+]+=?=?$") ~= nil) and (math.fmod(#val, 4) == 0) + end + return false +end + function string(val) return true -- Everything qualifies as valid string end -function directory( val, seen ) +function directory(val, seen) local s = fs.stat(val) seen = seen or { } @@ -253,7 +318,7 @@ function directory( val, seen ) return false end -function file( val, seen ) +function file(val, seen) local s = fs.stat(val) seen = seen or { } @@ -269,7 +334,7 @@ function file( val, seen ) return false end -function device( val, seen ) +function device(val, seen) local s = fs.stat(val) seen = seen or { } @@ -378,30 +443,29 @@ function dateyyyymmdd(val) return false; end - local days_in_month = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } - - local function is_leap_year(year) - return (year % 4 == 0) and ((year % 100 ~= 0) or (year % 400 == 0)) - end - - function get_days_in_month(month, year) - if (month == 2) and is_leap_year(year) then - return 29 - else - return days_in_month[month] - end - end - if (year < 2015) then - return false - end - if ((month == 0) or (month > 12)) then - return false - end - if ((day == 0) or (day > get_days_in_month(month, year))) then - return false - end - return true + local days_in_month = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } + + local function is_leap_year(year) + return (year % 4 == 0) and ((year % 100 ~= 0) or (year % 400 == 0)) + end + + function get_days_in_month(month, year) + if (month == 2) and is_leap_year(year) then + return 29 + else + return days_in_month[month] + end + end + if (year < 2015) then + return false + end + if ((month == 0) or (month > 12)) then + return false + end + if ((day == 0) or (day > get_days_in_month(month, year))) then + return false + end + return true end return false end - diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index 0876ce6585..0bd19456f2 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -101,7 +101,7 @@ function error500(message) return false end -function authenticator.htmlauth(validator, accs, default) +function authenticator.htmlauth(validator, accs, default, template) local user = http.formvalue("luci_username") local pass = http.formvalue("luci_password") @@ -113,7 +113,7 @@ function authenticator.htmlauth(validator, accs, default) require("luci.template") context.path = {} http.status(403, "Forbidden") - luci.template.render("sysauth", {duser=default, fuser=user}) + luci.template.render(template or "sysauth", {duser=default, fuser=user}) return false @@ -360,7 +360,7 @@ function dispatch(request) if not util.contains(accs, user) then if authen then - local user, sess = authen(sys.user.checkpasswd, accs, def) + local user, sess = authen(sys.user.checkpasswd, accs, def, track.sysauth_template) local token if not user or not util.contains(accs, user) then return diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 2d8336bf33..d9ef4089c8 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -950,6 +950,13 @@ function protocol.dns6addrs(self) return dns end +function protocol.ip6prefix(self) + local prefix = self:_ubus("ipv6-prefix") + if prefix and #prefix > 0 then + return "%s/%d" %{ prefix[1].address, prefix[1].mask } + end +end + function protocol.is_bridge(self) return (not self:is_virtual() and self:type() == "bridge") end @@ -1355,8 +1362,6 @@ function wifidev.get_i18n(self) local t = "Generic" if self.iwinfo.type == "wl" then t = "Broadcom" - elseif self.iwinfo.type == "madwifi" then - t = "Atheros" end local m = "" diff --git a/modules/luci-base/luasrc/sys/iptparser.lua b/modules/luci-base/luasrc/sys/iptparser.lua index a9dbc30826..7ff665e7af 100644 --- a/modules/luci-base/luasrc/sys/iptparser.lua +++ b/modules/luci-base/luasrc/sys/iptparser.lua @@ -31,29 +31,43 @@ function IptParser.__init__( self, family ) self._family = (tonumber(family) == 6) and 6 or 4 self._rules = { } self._chains = { } + self._tables = { } + + local t = self._tables + local s = self:_supported_tables(self._family) + + if s.filter then t[#t+1] = "filter" end + if s.nat then t[#t+1] = "nat" end + if s.mangle then t[#t+1] = "mangle" end + if s.raw then t[#t+1] = "raw" end if self._family == 4 then self._nulladdr = "0.0.0.0/0" - self._tables = { "filter", "nat", "mangle", "raw" } self._command = "iptables -t %s --line-numbers -nxvL" else self._nulladdr = "::/0" - self._tables = { "filter", "mangle", "raw" } - local ok, lines = pcall(io.lines, "/proc/net/ip6_tables_names") - if ok and lines then - local line - for line in lines do - if line == "nat" then - self._tables = { "filter", "nat", "mangle", "raw" } - end - end - end self._command = "ip6tables -t %s --line-numbers -nxvL" end self:_parse_rules() end +function IptParser._supported_tables( self, family ) + local tables = { } + local ok, lines = pcall(io.lines, + (family == 6) and "/proc/net/ip6_tables_names" + or "/proc/net/ip_tables_names") + + if ok and lines then + local line + for line in lines do + tables[line] = true + end + end + + return tables +end + -- search criteria as only argument. If args is nil or an empty table then all -- rules will be returned. -- diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua index 465d7df3d3..2d32b39b15 100644 --- a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua +++ b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua @@ -59,42 +59,42 @@ TZ = { { 'America/Anchorage', 'AKST9AKDT,M3.2.0,M11.1.0' }, { 'America/Anguilla', 'AST4' }, { 'America/Antigua', 'AST4' }, - { 'America/Araguaina', 'BRT3' }, - { 'America/Argentina/Buenos Aires', 'ART3' }, - { 'America/Argentina/Catamarca', 'ART3' }, - { 'America/Argentina/Cordoba', 'ART3' }, - { 'America/Argentina/Jujuy', 'ART3' }, - { 'America/Argentina/La Rioja', 'ART3' }, - { 'America/Argentina/Mendoza', 'ART3' }, - { 'America/Argentina/Rio Gallegos', 'ART3' }, - { 'America/Argentina/Salta', 'ART3' }, - { 'America/Argentina/San Juan', 'ART3' }, - { 'America/Argentina/San Luis', 'ART3' }, - { 'America/Argentina/Tucuman', 'ART3' }, - { 'America/Argentina/Ushuaia', 'ART3' }, + { 'America/Araguaina', '<-03>3' }, + { 'America/Argentina/Buenos Aires', '<-03>3' }, + { 'America/Argentina/Catamarca', '<-03>3' }, + { 'America/Argentina/Cordoba', '<-03>3' }, + { 'America/Argentina/Jujuy', '<-03>3' }, + { 'America/Argentina/La Rioja', '<-03>3' }, + { 'America/Argentina/Mendoza', '<-03>3' }, + { 'America/Argentina/Rio Gallegos', '<-03>3' }, + { 'America/Argentina/Salta', '<-03>3' }, + { 'America/Argentina/San Juan', '<-03>3' }, + { 'America/Argentina/San Luis', '<-03>3' }, + { 'America/Argentina/Tucuman', '<-03>3' }, + { 'America/Argentina/Ushuaia', '<-03>3' }, { 'America/Aruba', 'AST4' }, - { 'America/Asuncion', 'PYT4PYST,M10.1.0/0,M3.4.0/0' }, + { 'America/Asuncion', '<-04>4<-03>,M10.1.0/0,M3.4.0/0' }, { 'America/Atikokan', 'EST5' }, - { 'America/Bahia', 'BRT3' }, + { 'America/Bahia', '<-03>3' }, { 'America/Bahia Banderas', 'CST6CDT,M4.1.0,M10.5.0' }, { 'America/Barbados', 'AST4' }, - { 'America/Belem', 'BRT3' }, + { 'America/Belem', '<-03>3' }, { 'America/Belize', 'CST6' }, { 'America/Blanc-Sablon', 'AST4' }, - { 'America/Boa Vista', 'AMT4' }, - { 'America/Bogota', 'COT5' }, + { 'America/Boa Vista', '<-04>4' }, + { 'America/Bogota', '<-05>5' }, { 'America/Boise', 'MST7MDT,M3.2.0,M11.1.0' }, { 'America/Cambridge Bay', 'MST7MDT,M3.2.0,M11.1.0' }, - { 'America/Campo Grande', 'AMT4AMST,M10.3.0/0,M2.3.0/0' }, + { 'America/Campo Grande', '<-04>4<-03>,M10.3.0/0,M2.3.0/0' }, { 'America/Cancun', 'EST5' }, - { 'America/Caracas', 'VET4' }, - { 'America/Cayenne', 'GFT3' }, + { 'America/Caracas', '<-04>4' }, + { 'America/Cayenne', '<-03>3' }, { 'America/Cayman', 'EST5' }, { 'America/Chicago', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/Chihuahua', 'MST7MDT,M4.1.0,M10.5.0' }, { 'America/Costa Rica', 'CST6' }, { 'America/Creston', 'MST7' }, - { 'America/Cuiaba', 'AMT4AMST,M10.3.0/0,M2.3.0/0' }, + { 'America/Cuiaba', '<-04>4<-03>,M10.3.0/0,M2.3.0/0' }, { 'America/Curacao', 'AST4' }, { 'America/Danmarkshavn', 'GMT0' }, { 'America/Dawson', 'PST8PDT,M3.2.0,M11.1.0' }, @@ -103,19 +103,19 @@ TZ = { { 'America/Detroit', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/Dominica', 'AST4' }, { 'America/Edmonton', 'MST7MDT,M3.2.0,M11.1.0' }, - { 'America/Eirunepe', 'ACT5' }, + { 'America/Eirunepe', '<-05>5' }, { 'America/El Salvador', 'CST6' }, { 'America/Fort Nelson', 'MST7' }, - { 'America/Fortaleza', 'BRT3' }, + { 'America/Fortaleza', '<-03>3' }, { 'America/Glace Bay', 'AST4ADT,M3.2.0,M11.1.0' }, - { 'America/Godthab', 'WGT3WGST,M3.5.0/-2,M10.5.0/-1' }, + { 'America/Godthab', '<-03>3<-02>,M3.5.0/-2,M10.5.0/-1' }, { 'America/Goose Bay', 'AST4ADT,M3.2.0,M11.1.0' }, { 'America/Grand Turk', 'AST4' }, { 'America/Grenada', 'AST4' }, { 'America/Guadeloupe', 'AST4' }, { 'America/Guatemala', 'CST6' }, - { 'America/Guayaquil', 'ECT5' }, - { 'America/Guyana', 'GYT4' }, + { 'America/Guayaquil', '<-05>5' }, + { 'America/Guyana', '<-04>4' }, { 'America/Halifax', 'AST4ADT,M3.2.0,M11.1.0' }, { 'America/Havana', 'CST5CDT,M3.2.0/0,M11.1.0/1' }, { 'America/Hermosillo', 'MST7' }, @@ -134,13 +134,13 @@ TZ = { { 'America/Kentucky/Louisville', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/Kentucky/Monticello', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/Kralendijk', 'AST4' }, - { 'America/La Paz', 'BOT4' }, - { 'America/Lima', 'PET5' }, + { 'America/La Paz', '<-04>4' }, + { 'America/Lima', '<-05>5' }, { 'America/Los Angeles', 'PST8PDT,M3.2.0,M11.1.0' }, { 'America/Lower Princes', 'AST4' }, - { 'America/Maceio', 'BRT3' }, + { 'America/Maceio', '<-03>3' }, { 'America/Managua', 'CST6' }, - { 'America/Manaus', 'AMT4' }, + { 'America/Manaus', '<-04>4' }, { 'America/Marigot', 'AST4' }, { 'America/Martinique', 'AST4' }, { 'America/Matamoros', 'CST6CDT,M3.2.0,M11.1.0' }, @@ -149,39 +149,40 @@ TZ = { { 'America/Merida', 'CST6CDT,M4.1.0,M10.5.0' }, { 'America/Metlakatla', 'AKST9AKDT,M3.2.0,M11.1.0' }, { 'America/Mexico City', 'CST6CDT,M4.1.0,M10.5.0' }, - { 'America/Miquelon', 'PMST3PMDT,M3.2.0,M11.1.0' }, + { 'America/Miquelon', '<-03>3<-02>,M3.2.0,M11.1.0' }, { 'America/Moncton', 'AST4ADT,M3.2.0,M11.1.0' }, { 'America/Monterrey', 'CST6CDT,M4.1.0,M10.5.0' }, - { 'America/Montevideo', 'UYT3' }, + { 'America/Montevideo', '<-03>3' }, { 'America/Montserrat', 'AST4' }, { 'America/Nassau', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/New York', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/Nipigon', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/Nome', 'AKST9AKDT,M3.2.0,M11.1.0' }, - { 'America/Noronha', 'FNT2' }, + { 'America/Noronha', '<-02>2' }, { 'America/North Dakota/Beulah', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/North Dakota/Center', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/North Dakota/New Salem', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/Ojinaga', 'MST7MDT,M3.2.0,M11.1.0' }, { 'America/Panama', 'EST5' }, { 'America/Pangnirtung', 'EST5EDT,M3.2.0,M11.1.0' }, - { 'America/Paramaribo', 'SRT3' }, + { 'America/Paramaribo', '<-03>3' }, { 'America/Phoenix', 'MST7' }, { 'America/Port of Spain', 'AST4' }, - { 'America/Port-au-Prince', 'EST5' }, - { 'America/Porto Velho', 'AMT4' }, + { 'America/Port-au-Prince', 'EST5EDT,M3.2.0,M11.1.0' }, + { 'America/Porto Velho', '<-04>4' }, { 'America/Puerto Rico', 'AST4' }, + { 'America/Punta Arenas', '<-03>3' }, { 'America/Rainy River', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/Rankin Inlet', 'CST6CDT,M3.2.0,M11.1.0' }, - { 'America/Recife', 'BRT3' }, + { 'America/Recife', '<-03>3' }, { 'America/Regina', 'CST6' }, { 'America/Resolute', 'CST6CDT,M3.2.0,M11.1.0' }, - { 'America/Rio Branco', 'ACT5' }, - { 'America/Santarem', 'BRT3' }, - { 'America/Santiago', 'CLT4CLST,M8.2.6/24,M5.2.6/24' }, + { 'America/Rio Branco', '<-05>5' }, + { 'America/Santarem', '<-03>3' }, + { 'America/Santiago', '<-04>4<-03>,M8.2.6/24,M5.2.6/24' }, { 'America/Santo Domingo', 'AST4' }, - { 'America/Sao Paulo', 'BRT3BRST,M10.3.0/0,M2.3.0/0' }, - { 'America/Scoresbysund', 'EGT1EGST,M3.5.0/0,M10.5.0/1' }, + { 'America/Sao Paulo', '<-03>3<-02>,M10.3.0/0,M2.3.0/0' }, + { 'America/Scoresbysund', '<-01>1<+00>,M3.5.0/0,M10.5.0/1' }, { 'America/Sitka', 'AKST9AKDT,M3.2.0,M11.1.0' }, { 'America/St Barthelemy', 'AST4' }, { 'America/St Johns', 'NST3:30NDT,M3.2.0,M11.1.0' }, @@ -204,16 +205,16 @@ TZ = { { 'Antarctica/Casey', '<+11>-11' }, { 'Antarctica/Davis', '<+07>-7' }, { 'Antarctica/DumontDUrville', '<+10>-10' }, - { 'Antarctica/Macquarie', 'MIST-11' }, + { 'Antarctica/Macquarie', '<+11>-11' }, { 'Antarctica/Mawson', '<+05>-5' }, { 'Antarctica/McMurdo', 'NZST-12NZDT,M9.5.0,M4.1.0/3' }, - { 'Antarctica/Palmer', 'CLT4CLST,M8.2.6/24,M5.2.6/24' }, + { 'Antarctica/Palmer', '<-03>3' }, { 'Antarctica/Rothera', '<-03>3' }, { 'Antarctica/Syowa', '<+03>-3' }, { 'Antarctica/Troll', '<+00>0<+02>-2,M3.5.0/1,M10.5.0/3' }, { 'Antarctica/Vostok', '<+06>-6' }, { 'Arctic/Longyearbyen', 'CET-1CEST,M3.5.0,M10.5.0/3' }, - { 'Asia/Aden', 'AST-3' }, + { 'Asia/Aden', '<+03>-3' }, { 'Asia/Almaty', '<+06>-6' }, { 'Asia/Amman', 'EET-2EEST,M3.5.4/24,M10.5.5/1' }, { 'Asia/Anadyr', '<+12>-12' }, @@ -221,99 +222,99 @@ TZ = { { 'Asia/Aqtobe', '<+05>-5' }, { 'Asia/Ashgabat', '<+05>-5' }, { 'Asia/Atyrau', '<+05>-5' }, - { 'Asia/Baghdad', 'AST-3' }, - { 'Asia/Bahrain', 'AST-3' }, + { 'Asia/Baghdad', '<+03>-3' }, + { 'Asia/Bahrain', '<+03>-3' }, { 'Asia/Baku', '<+04>-4' }, - { 'Asia/Bangkok', 'ICT-7' }, + { 'Asia/Bangkok', '<+07>-7' }, { 'Asia/Barnaul', '<+07>-7' }, { 'Asia/Beirut', 'EET-2EEST,M3.5.0/0,M10.5.0/0' }, { 'Asia/Bishkek', '<+06>-6' }, - { 'Asia/Brunei', 'BNT-8' }, + { 'Asia/Brunei', '<+08>-8' }, { 'Asia/Chita', '<+09>-9' }, - { 'Asia/Choibalsan', 'CHOT-8CHOST,M3.5.6,M9.5.6/0' }, + { 'Asia/Choibalsan', '<+08>-8' }, { 'Asia/Colombo', '<+0530>-5:30' }, { 'Asia/Damascus', 'EET-2EEST,M3.5.5/0,M10.5.5/0' }, - { 'Asia/Dhaka', 'BDT-6' }, - { 'Asia/Dili', 'TLT-9' }, - { 'Asia/Dubai', 'GST-4' }, + { 'Asia/Dhaka', '<+06>-6' }, + { 'Asia/Dili', '<+09>-9' }, + { 'Asia/Dubai', '<+04>-4' }, { 'Asia/Dushanbe', '<+05>-5' }, { 'Asia/Famagusta', '<+03>-3' }, { 'Asia/Gaza', 'EET-2EEST,M3.5.6/1,M10.5.6/1' }, { 'Asia/Hebron', 'EET-2EEST,M3.5.6/1,M10.5.6/1' }, - { 'Asia/Ho Chi Minh', 'ICT-7' }, + { 'Asia/Ho Chi Minh', '<+07>-7' }, { 'Asia/Hong Kong', 'HKT-8' }, - { 'Asia/Hovd', 'HOVT-7HOVST,M3.5.6,M9.5.6/0' }, + { 'Asia/Hovd', '<+07>-7' }, { 'Asia/Irkutsk', '<+08>-8' }, { 'Asia/Jakarta', 'WIB-7' }, { 'Asia/Jayapura', 'WIT-9' }, { 'Asia/Jerusalem', 'IST-2IDT,M3.4.4/26,M10.5.0' }, - { 'Asia/Kabul', 'AFT-4:30' }, + { 'Asia/Kabul', '<+0430>-4:30' }, { 'Asia/Kamchatka', '<+12>-12' }, { 'Asia/Karachi', 'PKT-5' }, - { 'Asia/Kathmandu', 'NPT-5:45' }, + { 'Asia/Kathmandu', '<+0545>-5:45' }, { 'Asia/Khandyga', '<+09>-9' }, { 'Asia/Kolkata', 'IST-5:30' }, { 'Asia/Krasnoyarsk', '<+07>-7' }, - { 'Asia/Kuala Lumpur', 'MYT-8' }, - { 'Asia/Kuching', 'MYT-8' }, - { 'Asia/Kuwait', 'AST-3' }, + { 'Asia/Kuala Lumpur', '<+08>-8' }, + { 'Asia/Kuching', '<+08>-8' }, + { 'Asia/Kuwait', '<+03>-3' }, { 'Asia/Macau', 'CST-8' }, { 'Asia/Magadan', '<+11>-11' }, { 'Asia/Makassar', 'WITA-8' }, - { 'Asia/Manila', 'PHT-8' }, - { 'Asia/Muscat', 'GST-4' }, + { 'Asia/Manila', '<+08>-8' }, + { 'Asia/Muscat', '<+04>-4' }, { 'Asia/Nicosia', 'EET-2EEST,M3.5.0/3,M10.5.0/4' }, { 'Asia/Novokuznetsk', '<+07>-7' }, { 'Asia/Novosibirsk', '<+07>-7' }, { 'Asia/Omsk', '<+06>-6' }, { 'Asia/Oral', '<+05>-5' }, - { 'Asia/Phnom Penh', 'ICT-7' }, + { 'Asia/Phnom Penh', '<+07>-7' }, { 'Asia/Pontianak', 'WIB-7' }, { 'Asia/Pyongyang', 'KST-8:30' }, - { 'Asia/Qatar', 'AST-3' }, + { 'Asia/Qatar', '<+03>-3' }, { 'Asia/Qyzylorda', '<+06>-6' }, - { 'Asia/Riyadh', 'AST-3' }, + { 'Asia/Riyadh', '<+03>-3' }, { 'Asia/Sakhalin', '<+11>-11' }, { 'Asia/Samarkand', '<+05>-5' }, { 'Asia/Seoul', 'KST-9' }, { 'Asia/Shanghai', 'CST-8' }, - { 'Asia/Singapore', 'SGT-8' }, + { 'Asia/Singapore', '<+08>-8' }, { 'Asia/Srednekolymsk', '<+11>-11' }, { 'Asia/Taipei', 'CST-8' }, { 'Asia/Tashkent', '<+05>-5' }, { 'Asia/Tbilisi', '<+04>-4' }, - { 'Asia/Tehran', 'IRST-3:30IRDT,J80/0,J264/0' }, - { 'Asia/Thimphu', 'BTT-6' }, + { 'Asia/Tehran', '<+0330>-3:30<+0430>,J80/0,J264/0' }, + { 'Asia/Thimphu', '<+06>-6' }, { 'Asia/Tokyo', 'JST-9' }, { 'Asia/Tomsk', '<+07>-7' }, - { 'Asia/Ulaanbaatar', 'ULAT-8ULAST,M3.5.6,M9.5.6/0' }, - { 'Asia/Urumqi', 'XJT-6' }, + { 'Asia/Ulaanbaatar', '<+08>-8' }, + { 'Asia/Urumqi', '<+06>-6' }, { 'Asia/Ust-Nera', '<+10>-10' }, - { 'Asia/Vientiane', 'ICT-7' }, + { 'Asia/Vientiane', '<+07>-7' }, { 'Asia/Vladivostok', '<+10>-10' }, { 'Asia/Yakutsk', '<+09>-9' }, - { 'Asia/Yangon', 'MMT-6:30' }, + { 'Asia/Yangon', '<+0630>-6:30' }, { 'Asia/Yekaterinburg', '<+05>-5' }, { 'Asia/Yerevan', '<+04>-4' }, - { 'Atlantic/Azores', 'AZOT1AZOST,M3.5.0/0,M10.5.0/1' }, + { 'Atlantic/Azores', '<-01>1<+00>,M3.5.0/0,M10.5.0/1' }, { 'Atlantic/Bermuda', 'AST4ADT,M3.2.0,M11.1.0' }, { 'Atlantic/Canary', 'WET0WEST,M3.5.0/1,M10.5.0' }, - { 'Atlantic/Cape Verde', 'CVT1' }, + { 'Atlantic/Cape Verde', '<-01>1' }, { 'Atlantic/Faroe', 'WET0WEST,M3.5.0/1,M10.5.0' }, { 'Atlantic/Madeira', 'WET0WEST,M3.5.0/1,M10.5.0' }, { 'Atlantic/Reykjavik', 'GMT0' }, - { 'Atlantic/South Georgia', 'GST2' }, + { 'Atlantic/South Georgia', '<-02>2' }, { 'Atlantic/St Helena', 'GMT0' }, - { 'Atlantic/Stanley', 'FKST3' }, + { 'Atlantic/Stanley', '<-03>3' }, { 'Australia/Adelaide', 'ACST-9:30ACDT,M10.1.0,M4.1.0/3' }, { 'Australia/Brisbane', 'AEST-10' }, { 'Australia/Broken Hill', 'ACST-9:30ACDT,M10.1.0,M4.1.0/3' }, { 'Australia/Currie', 'AEST-10AEDT,M10.1.0,M4.1.0/3' }, { 'Australia/Darwin', 'ACST-9:30' }, - { 'Australia/Eucla', 'ACWST-8:45' }, + { 'Australia/Eucla', '<+0845>-8:45' }, { 'Australia/Hobart', 'AEST-10AEDT,M10.1.0,M4.1.0/3' }, { 'Australia/Lindeman', 'AEST-10' }, - { 'Australia/Lord Howe', 'LHST-10:30LHDT-11,M10.1.0,M4.1.0' }, + { 'Australia/Lord Howe', '<+1030>-10:30<+11>-11,M10.1.0,M4.1.0' }, { 'Australia/Melbourne', 'AEST-10AEDT,M10.1.0,M4.1.0/3' }, { 'Australia/Perth', 'AWST-8' }, { 'Australia/Sydney', 'AEST-10AEDT,M10.1.0,M4.1.0/3' }, @@ -378,53 +379,52 @@ TZ = { { 'Europe/Zaporozhye', 'EET-2EEST,M3.5.0/3,M10.5.0/4' }, { 'Europe/Zurich', 'CET-1CEST,M3.5.0,M10.5.0/3' }, { 'Indian/Antananarivo', 'EAT-3' }, - { 'Indian/Chagos', 'IOT-6' }, - { 'Indian/Christmas', 'CXT-7' }, - { 'Indian/Cocos', 'CCT-6:30' }, + { 'Indian/Chagos', '<+06>-6' }, + { 'Indian/Christmas', '<+07>-7' }, + { 'Indian/Cocos', '<+0630>-6:30' }, { 'Indian/Comoro', 'EAT-3' }, { 'Indian/Kerguelen', '<+05>-5' }, - { 'Indian/Mahe', 'SCT-4' }, - { 'Indian/Maldives', 'MVT-5' }, - { 'Indian/Mauritius', 'MUT-4' }, + { 'Indian/Mahe', '<+04>-4' }, + { 'Indian/Maldives', '<+05>-5' }, + { 'Indian/Mauritius', '<+04>-4' }, { 'Indian/Mayotte', 'EAT-3' }, - { 'Indian/Reunion', 'RET-4' }, - { 'Pacific/Apia', 'WSST-13WSDT,M9.5.0/3,M4.1.0/4' }, + { 'Indian/Reunion', '<+04>-4' }, + { 'Pacific/Apia', '<+13>-13<+14>,M9.5.0/3,M4.1.0/4' }, { 'Pacific/Auckland', 'NZST-12NZDT,M9.5.0,M4.1.0/3' }, - { 'Pacific/Bougainville', 'BST-11' }, - { 'Pacific/Chatham', 'CHAST-12:45CHADT,M9.5.0/2:45,M4.1.0/3:45' }, - { 'Pacific/Chuuk', 'CHUT-10' }, - { 'Pacific/Easter', 'EAST6EASST,M8.2.6/22,M5.2.6/22' }, - { 'Pacific/Efate', 'VUT-11' }, - { 'Pacific/Enderbury', 'PHOT-13' }, - { 'Pacific/Fakaofo', 'TKT-13' }, - { 'Pacific/Fiji', 'FJT-12FJST,M11.1.0,M1.3.0/3' }, - { 'Pacific/Funafuti', 'TVT-12' }, - { 'Pacific/Galapagos', 'GALT6' }, - { 'Pacific/Gambier', 'GAMT9' }, - { 'Pacific/Guadalcanal', 'SBT-11' }, + { 'Pacific/Bougainville', '<+11>-11' }, + { 'Pacific/Chatham', '<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45' }, + { 'Pacific/Chuuk', '<+10>-10' }, + { 'Pacific/Easter', '<-06>6<-05>,M8.2.6/22,M5.2.6/22' }, + { 'Pacific/Efate', '<+11>-11' }, + { 'Pacific/Enderbury', '<+13>-13' }, + { 'Pacific/Fakaofo', '<+13>-13' }, + { 'Pacific/Fiji', '<+12>-12<+13>,M11.1.0,M1.3.0/3' }, + { 'Pacific/Funafuti', '<+12>-12' }, + { 'Pacific/Galapagos', '<-06>6' }, + { 'Pacific/Gambier', '<-09>9' }, + { 'Pacific/Guadalcanal', '<+11>-11' }, { 'Pacific/Guam', 'ChST-10' }, { 'Pacific/Honolulu', 'HST10' }, - { 'Pacific/Johnston', 'HST10' }, - { 'Pacific/Kiritimati', 'LINT-14' }, - { 'Pacific/Kosrae', 'KOST-11' }, - { 'Pacific/Kwajalein', 'MHT-12' }, - { 'Pacific/Majuro', 'MHT-12' }, - { 'Pacific/Marquesas', 'MART9:30' }, + { 'Pacific/Kiritimati', '<+14>-14' }, + { 'Pacific/Kosrae', '<+11>-11' }, + { 'Pacific/Kwajalein', '<+12>-12' }, + { 'Pacific/Majuro', '<+12>-12' }, + { 'Pacific/Marquesas', '<-0930>9:30' }, { 'Pacific/Midway', 'SST11' }, - { 'Pacific/Nauru', 'NRT-12' }, - { 'Pacific/Niue', 'NUT11' }, - { 'Pacific/Norfolk', 'NFT-11' }, - { 'Pacific/Noumea', 'NCT-11' }, + { 'Pacific/Nauru', '<+12>-12' }, + { 'Pacific/Niue', '<-11>11' }, + { 'Pacific/Norfolk', '<+11>-11' }, + { 'Pacific/Noumea', '<+11>-11' }, { 'Pacific/Pago Pago', 'SST11' }, - { 'Pacific/Palau', 'PWT-9' }, - { 'Pacific/Pitcairn', 'PST8' }, - { 'Pacific/Pohnpei', 'PONT-11' }, - { 'Pacific/Port Moresby', 'PGT-10' }, - { 'Pacific/Rarotonga', 'CKT10' }, + { 'Pacific/Palau', '<+09>-9' }, + { 'Pacific/Pitcairn', '<-08>8' }, + { 'Pacific/Pohnpei', '<+11>-11' }, + { 'Pacific/Port Moresby', '<+10>-10' }, + { 'Pacific/Rarotonga', '<-10>10' }, { 'Pacific/Saipan', 'ChST-10' }, - { 'Pacific/Tahiti', 'TAHT10' }, - { 'Pacific/Tarawa', 'GILT-12' }, + { 'Pacific/Tahiti', '<-10>10' }, + { 'Pacific/Tarawa', '<+12>-12' }, { 'Pacific/Tongatapu', '<+13>-13<+14>,M11.1.0,M1.3.0/3' }, - { 'Pacific/Wake', 'WAKT-12' }, - { 'Pacific/Wallis', 'WFT-12' }, + { 'Pacific/Wake', '<+12>-12' }, + { 'Pacific/Wallis', '<+12>-12' }, } diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua index e5da7c6442..cf5afeb9d8 100644 --- a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua +++ b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua @@ -16,123 +16,30 @@ OFFSET = { akst = -32400, -- AKST akdt = -28800, -- AKDT ast = -14400, -- AST - brt = -10800, -- BRT - art = -10800, -- ART - pyt = -14400, -- PYT - pyst = -10800, -- PYST est = -18000, -- EST cst = -21600, -- CST cdt = -18000, -- CDT - amt = -14400, -- AMT - cot = -18000, -- COT mst = -25200, -- MST mdt = -21600, -- MDT - vet = -14400, -- VET - gft = -10800, -- GFT pst = -28800, -- PST pdt = -25200, -- PDT - act = -18000, -- ACT - wgt = -10800, -- WGT - wgst = -7200, -- WGST - ect = -18000, -- ECT - gyt = -14400, -- GYT - bot = -14400, -- BOT - pet = -18000, -- PET - pmst = -10800, -- PMST - pmdt = -7200, -- PMDT - uyt = -10800, -- UYT - fnt = -7200, -- FNT - srt = -10800, -- SRT - clt = -14400, -- CLT - clst = -10800, -- CLST - egt = -3600, -- EGT - egst = 0, -- EGST nst = -12600, -- NST ndt = -9000, -- NDT - mist = 39600, -- MIST nzst = 43200, -- NZST nzdt = 46800, -- NZDT - ict = 25200, -- ICT - bnt = 28800, -- BNT - chot = 28800, -- CHOT - chost = 32400, -- CHOST - bdt = 21600, -- BDT - tlt = 32400, -- TLT - gst = 14400, -- GST hkt = 28800, -- HKT - hovt = 25200, -- HOVT - hovst = 28800, -- HOVST wib = 25200, -- WIB wit = 32400, -- WIT ist = 7200, -- IST idt = 10800, -- IDT - aft = 16200, -- AFT pkt = 18000, -- PKT - npt = 20700, -- NPT - myt = 28800, -- MYT wita = 28800, -- WITA - pht = 28800, -- PHT kst = 30600, -- KST - sgt = 28800, -- SGT - irst = 12600, -- IRST - irdt = 16200, -- IRDT - btt = 21600, -- BTT jst = 32400, -- JST - ulat = 28800, -- ULAT - ulast = 32400, -- ULAST - xjt = 21600, -- XJT - mmt = 23400, -- MMT - azot = -3600, -- AZOT - azost = 0, -- AZOST - cvt = -3600, -- CVT - fkst = -10800, -- FKST acst = 34200, -- ACST acdt = 37800, -- ACDT aest = 36000, -- AEST - acwst = 31500, -- ACWST - lhst = 37800, -- LHST - lhdt = 39600, -- LHDT awst = 28800, -- AWST msk = 10800, -- MSK - iot = 21600, -- IOT - cxt = 25200, -- CXT - cct = 23400, -- CCT - sct = 14400, -- SCT - mvt = 18000, -- MVT - mut = 14400, -- MUT - ret = 14400, -- RET - wsst = 46800, -- WSST - wsdt = 50400, -- WSDT - bst = 39600, -- BST - chast = 45900, -- CHAST - chadt = 49500, -- CHADT - chut = 36000, -- CHUT - east = -21600, -- EAST - easst = -18000, -- EASST - vut = 39600, -- VUT - phot = 46800, -- PHOT - tkt = 46800, -- TKT - fjt = 43200, -- FJT - fjst = 46800, -- FJST - tvt = 43200, -- TVT - galt = -21600, -- GALT - gamt = -32400, -- GAMT - sbt = 39600, -- SBT - lint = 50400, -- LINT - kost = 39600, -- KOST - mht = 43200, -- MHT - mart = -34200, -- MART sst = -39600, -- SST - nrt = 43200, -- NRT - nut = -39600, -- NUT - nft = 39600, -- NFT - nct = 39600, -- NCT - pwt = 32400, -- PWT - pont = 39600, -- PONT - pgt = 36000, -- PGT - ckt = -36000, -- CKT - taht = -36000, -- TAHT - gilt = 43200, -- GILT - wakt = 43200, -- WAKT - wft = 43200, -- WFT } diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua index 4da0cf984b..95ff46df15 100644 --- a/modules/luci-base/luasrc/tools/status.lua +++ b/modules/luci-base/luasrc/tools/status.lua @@ -26,17 +26,18 @@ local function dhcp_leases_common(family) break else local ts, mac, ip, name, duid = ln:match("^(%d+) (%S+) (%S+) (%S+) (%S+)") + local expire = tonumber(ts) or 0 if ts and mac and ip and name and duid then if family == 4 and not ip:match(":") then rv[#rv+1] = { - expires = os.difftime(tonumber(ts) or 0, os.time()), + expires = (expire ~= 0) and os.difftime(expire, os.time()), macaddr = mac, ipaddr = ip, hostname = (name ~= "*") and name } elseif family == 6 and ip:match(":") then rv[#rv+1] = { - expires = os.difftime(tonumber(ts) or 0, os.time()), + expires = (expire ~= 0) and os.difftime(expire, os.time()), ip6addr = ip, duid = (duid ~= "*") and duid, hostname = (name ~= "*") and name @@ -73,9 +74,19 @@ local function dhcp_leases_common(family) hostname = (name ~= "-") and name } elseif ip and iaid == "ipv4" and family == 4 then + local mac, mac1, mac2, mac3, mac4, mac5, mac6 + if duid and type(duid) == "string" then + mac1, mac2, mac3, mac4, mac5, mac6 = duid:match("^(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)(%x%x)$") + end + if not (mac1 and mac2 and mac3 and mac4 and mac5 and mac6) then + mac = "FF:FF:FF:FF:FF:FF" + else + mac = mac1..":"..mac2..":"..mac3..":"..mac4..":"..mac5..":"..mac6 + end rv[#rv+1] = { expires = (expire >= 0) and os.difftime(expire, os.time()), macaddr = duid, + macaddr = mac:lower(), ipaddr = ip, hostname = (name ~= "-") and name } diff --git a/modules/luci-base/luasrc/tools/webadmin.lua b/modules/luci-base/luasrc/tools/webadmin.lua index 8273175de7..106810aa03 100644 --- a/modules/luci-base/luasrc/tools/webadmin.lua +++ b/modules/luci-base/luasrc/tools/webadmin.lua @@ -96,7 +96,7 @@ function iface_get_network(iface) if net.l3_device == iface or net.device == iface then -- cross check with uci to filter out @name style aliases local uciname = cur:get("network", net.interface, "ifname") - if not uciname or uciname:sub(1, 1) ~= "@" then + if type(uciname) == "string" and uciname:sub(1,1) ~= "@" or uciname then return net.interface end end diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm index b3b454008f..5cb31511f6 100644 --- a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm +++ b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm @@ -28,6 +28,7 @@ <% if self.allowlocal then %> <li style="padding:0.5em"> <input class="cbi-input-radio" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_empty") .. attr("name", cbid) .. attr("value", "") .. ifattr(checked[""], "checked", "checked")%> />   + <label<%=attr("for", cbid .. "_empty")%>></label> <label<%=attr("for", cbid .. "_empty")%> style="background-color:<%=fwm.zone.get_color()%>" class="zonebadge"> <strong><%:Device%></strong> <% if self.allowany and self.allowlocal then %>(<%:input%>)<% end %> @@ -37,6 +38,7 @@ <% if self.allowany then %> <li style="padding:0.5em"> <input class="cbi-input-radio" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_any") .. attr("name", cbid) .. attr("value", "*") .. ifattr(checked["*"], "checked", "checked")%> />   + <label<%=attr("for", cbid .. "_any")%>></label> <label<%=attr("for", cbid .. "_any")%> style="background-color:<%=fwm.zone.get_color()%>" class="zonebadge"> <strong><%:Any zone%></strong> <% if self.allowany and self.allowlocal then %>(<%:forward%>)<% end %> @@ -50,6 +52,7 @@ %> <li style="padding:0.5em"> <input class="cbi-input-radio" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "." .. zone:name()) .. attr("name", cbid) .. attr("value", zone:name()) .. ifattr(checked[zone:name()], "checked", "checked")%> />   + <label<%=attr("for", cbid .. "." .. zone:name())%>></label> <label<%=attr("for", cbid .. "." .. zone:name())%> style="background-color:<%=zone:get_color()%>" class="zonebadge"> <strong><%=zone:name()%>:</strong> <% @@ -78,6 +81,7 @@ <% if self.widget ~= "checkbox" and not self.nocreate then %> <li style="padding:0.5em"> <input class="cbi-input-radio" data-update="click change" type="radio"<%=attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not selected, "checked", "checked")%> />   + <label<%=attr("for", cbid .. "_new")%>></label> <div onclick="document.getElementById('<%=cbid%>_new').checked=true" class="zonebadge" style="background-color:<%=fwm.zone.get_color()%>"> <em><%:unspecified -or- create:%> </em> <input type="text"<%=attr("name", cbid .. ".newzone") .. ifattr(not selected, "value", luci.http.formvalue(cbid .. ".newzone") or self.default)%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" /> diff --git a/modules/luci-base/luasrc/view/cbi/fvalue.htm b/modules/luci-base/luasrc/view/cbi/fvalue.htm index 5eddcf22a1..197d03cf31 100644 --- a/modules/luci-base/luasrc/view/cbi/fvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/fvalue.htm @@ -6,4 +6,5 @@ attr("id", cbid) .. attr("name", cbid) .. attr("value", self.enabled or 1) .. ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked") %> /> + <label<%= attr("for", cbid)%>></label> <%+cbi/valuefooter%> diff --git a/modules/luci-base/luasrc/view/cbi/lvalue.htm b/modules/luci-base/luasrc/view/cbi/lvalue.htm index 99f456dc54..34d02eeca0 100644 --- a/modules/luci-base/luasrc/view/cbi/lvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/lvalue.htm @@ -24,15 +24,16 @@ <div> <% for i, key in pairs(self.keylist) do %> <label<%= - attr("id", cbid.."-"..key) .. attr("data-index", i) .. attr("data-depends", self:deplist2json(section, self.deplist[i])) %>> <input class="cbi-input-radio" data-update="click change" type="radio"<%= + attr("id", cbid.."-"..key) .. attr("name", cbid) .. attr("value", key) .. ifattr((self:cfgvalue(section) or self.default) == key, "checked", "checked") %> /> + <label<%= attr("for", cbid.."-"..key)%>></label> <%=pcdata(self.vallist[i])%> </label> <% if i == self.size then write(br) end %> diff --git a/modules/luci-base/luasrc/view/cbi/mvalue.htm b/modules/luci-base/luasrc/view/cbi/mvalue.htm index ca7b94c15e..db17450d27 100644 --- a/modules/luci-base/luasrc/view/cbi/mvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/mvalue.htm @@ -24,18 +24,19 @@ <div> <% for i, key in pairs(self.keylist) do %> <label<%= - attr("id", cbid.."-"..key) .. attr("data-index", i) .. attr("data-depends", self:deplist2json(section, self.deplist[i])) %>> <input class="cbi-input-checkbox" type="checkbox" data-update="click change"<%= + attr("id", cbid.."-"..key) .. attr("name", cbid) .. attr("value", key) .. ifattr(luci.util.contains(v, key), "checked", "checked") %> /> + <label<%= attr("for", cbid.."-"..key)%>></label> <%=pcdata(self.vallist[i])%> </label> - <% if i == self.size then write('<br />') end %> + <% if self.size and (i % self.size) == 0 then write('<br />') end %> <% end %> </div> <% end %> diff --git a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm b/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm index db6112992a..62dbde7dd4 100644 --- a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm +++ b/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm @@ -46,7 +46,11 @@ attr("id", cbid .. "." .. iface:name()) .. attr("name", cbid) .. attr("value", iface:name()) .. ifattr(checked[iface:name()], "checked", "checked") - %> />   + %> /> + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + <label<%=attr("for", cbid .. "." .. iface:name())%>></label> + <%- end -%> +   <label<%=attr("for", cbid .. "." .. iface:name())%>> <% if link then -%><a href="<%=link%>"><% end -%> <img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> @@ -68,7 +72,11 @@ attr("id", cbid .. "_custom") .. attr("name", cbid) .. attr("value", " ") - %> />   + %> /> + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + <label<%=attr("for", cbid .. "_custom")%>></label> + <%- end -%> +   <label<%=attr("for", cbid .. "_custom")%>> <img title="<%:Custom Interface%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/ethernet_disabled.png" /> <%:Custom Interface%>: diff --git a/modules/luci-base/luasrc/view/cbi/network_netlist.htm b/modules/luci-base/luasrc/view/cbi/network_netlist.htm index f8a2b72f3c..8bf1a70a20 100644 --- a/modules/luci-base/luasrc/view/cbi/network_netlist.htm +++ b/modules/luci-base/luasrc/view/cbi/network_netlist.htm @@ -52,6 +52,9 @@ <% if not self.nocreate then %> <li style="padding:0.25em 0"> <input class="cbi-input-<%=self.widget or "radio"%>" data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value and self.widget ~= "checkbox", "checked", "checked")%> />   + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + <label<%=attr("for", cbid .. "_new")%>></label> + <%- end -%> <div style="padding:0.5em; display:inline"> <label<%=attr("for", cbid .. "_new")%>><em> <%- if self.widget == "checkbox" then -%> |