mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 01:13:56 +08:00
💋 Sync 2026-09-20 23:11:08
This commit is contained in:
1 parent
8df28edee1
commit
ab8e741007
59 files changed
+3560
-986
No files matched your search
@@ -19,7 +19,7 @@ OPENWRT_ARCH = nil
|
||||
DISTRIB_ARCH = nil
|
||||
OPENWRT_BOARD = nil
|
||||
|
||||
LOCK_PREFIX = "/tmp/lock/" .. c_config
|
||||
LOCK_PREFIX = "/var/lock/" .. c_config
|
||||
LOG_FILE = "/tmp/log/" .. c_config .. ".log"
|
||||
TMP_PATH = "/tmp/etc/" .. c_config
|
||||
CACHE_PATH = TMP_PATH .. "_tmp"
|
||||
@@ -1542,11 +1542,18 @@ function set_type_cbi(s)
|
||||
obj.option_prefix = s_self.option_prefix
|
||||
obj.option = s_self.option_prefix .. option
|
||||
obj.cfgvalue = function(self, section)
|
||||
local v
|
||||
if self.rewrite_option then
|
||||
return self.map:get(section, self.rewrite_option)
|
||||
v = self.map:get(section, self.rewrite_option)
|
||||
else
|
||||
return self.map:get(section, self.config_option)
|
||||
v = self.map:get(section, self.config_option)
|
||||
end
|
||||
if util.instanceof(self, cbi.MultiValue) then
|
||||
if v and self.cast == "table" then
|
||||
return table.concat(v, " ")
|
||||
end
|
||||
end
|
||||
return v
|
||||
end
|
||||
obj.write = function(self, section, value)
|
||||
if s1.fields["type"]:formvalue(s_self.section) == s_self.type_name then
|
||||
@@ -1564,6 +1571,21 @@ function set_type_cbi(s)
|
||||
new_val = new_t
|
||||
end
|
||||
end
|
||||
if util.instanceof(self, cbi.MultiValue) then
|
||||
local new_t = {}
|
||||
if type(value) == "table" then
|
||||
new_t = table_remove_duplicates(value)
|
||||
else
|
||||
string.gsub(value, '[^' .. " " .. ']+', function(v)
|
||||
new_t[#new_t + 1] = v
|
||||
end)
|
||||
end
|
||||
if self.cast == "string" then
|
||||
new_val = table.concat(new_t, " ")
|
||||
else
|
||||
new_val = new_t
|
||||
end
|
||||
end
|
||||
if self.rewrite_option then
|
||||
self.map:set(section, self.rewrite_option, new_val)
|
||||
else
|
||||
@@ -1619,6 +1641,7 @@ end
|
||||
function type_cbi_section(s, s2)
|
||||
for i, v in ipairs(s2.children) do
|
||||
local o = s2.children[i]
|
||||
o.section = s
|
||||
s:append(o)
|
||||
s.fields[o.option] = o
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user