projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
luci-proto-wireguard: add support for fwmark option
[project/luci.git]
/
modules
/
luci-base
/
luasrc
/
cbi
/
datatypes.lua
diff --git
a/modules/luci-base/luasrc/cbi/datatypes.lua
b/modules/luci-base/luasrc/cbi/datatypes.lua
index
62b0e0f
..
cf56566
100644
(file)
--- a/
modules/luci-base/luasrc/cbi/datatypes.lua
+++ b/
modules/luci-base/luasrc/cbi/datatypes.lua
@@
-283,6
+283,14
@@
function hexstring(val)
return false
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)
function base64(val)
if val then
return (val:match("^[a-zA-Z0-9/+]+=?=?$") ~= nil) and (math.fmod(#val, 4) == 0)