mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 14:55:13 +08:00
🎄 Sync 2026-08-10 20:58:00
This commit is contained in:
1 parent
f93918f4ae
commit
e68eb29c6f
37 files changed
+318
-551
No files matched your search
@@ -1014,7 +1014,6 @@ local default_file_tree = {
|
||||
}
|
||||
|
||||
local function get_api_json(url)
|
||||
local jsonc = require "luci.jsonc"
|
||||
local gh_proxy = uci_get_type("global_app", "github_proxy", "0")
|
||||
local return_code, content
|
||||
if gh_proxy == "1" then
|
||||
@@ -1345,6 +1344,25 @@ function set_default_cbi()
|
||||
self.template = appname .. "/cbi/tvalue"
|
||||
end
|
||||
end
|
||||
if true then
|
||||
--DynamicList
|
||||
local DynamicList = cbi.DynamicList
|
||||
function DynamicList.write(self, section, value)
|
||||
local new_t = {}
|
||||
if type(value) == "table" then
|
||||
new_t = table_remove_duplicates(value)
|
||||
else
|
||||
new_t = { value }
|
||||
end
|
||||
local new_val
|
||||
if self.cast == "string" then
|
||||
new_val = table.concat(new_t, " ")
|
||||
else
|
||||
new_val = new_t
|
||||
end
|
||||
return cbi.AbstractValue.write(self, section, new_val)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function return_map(map)
|
||||
@@ -1369,6 +1387,7 @@ function return_map(map)
|
||||
end
|
||||
|
||||
function luci_types(id, m, s, type_name, option_prefix)
|
||||
local cbi = require "luci.cbi"
|
||||
local fv_type
|
||||
local field_type = s.fields["type"]
|
||||
if field_type then
|
||||
@@ -1406,11 +1425,25 @@ function luci_types(id, m, s, type_name, option_prefix)
|
||||
if self.custom_write then
|
||||
self:custom_write(section, value)
|
||||
else
|
||||
local new_val = value
|
||||
if util.instanceof(self, cbi.DynamicList) then
|
||||
local new_t = {}
|
||||
if type(value) == "table" then
|
||||
new_t = table_remove_duplicates(value)
|
||||
else
|
||||
new_t = { value }
|
||||
end
|
||||
if self.cast == "string" then
|
||||
new_val = table.concat(new_t, " ")
|
||||
else
|
||||
new_val = new_t
|
||||
end
|
||||
end
|
||||
if self.rewrite_option then
|
||||
m:set(section, self.rewrite_option, value)
|
||||
m:set(section, self.rewrite_option, new_val)
|
||||
else
|
||||
if self.option:find(option_prefix) == 1 then
|
||||
m:set(section, self.option:sub(1 + #option_prefix), value)
|
||||
m:set(section, self.option:sub(1 + #option_prefix), new_val)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user