Update 'luasrc/model/nodered.lua'

main
ben 1 year ago
parent 25f527e455
commit ffb16003c4

@ -24,11 +24,11 @@ end
nodered.home = function() nodered.home = function()
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
local home_dirs = {} local home_dirs = {}
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root") home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/opt/docker2/compose")
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/Configs") home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/nodered-app/Configs")
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public") home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public")
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"].."/Downloads") home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"].."/Downloads")
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/Caches") home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/nodered-app/Caches")
return home_dirs return home_dirs
end end
@ -36,14 +36,14 @@ nodered.find_paths = function(blocks, home_dirs, path_name)
local default_path = '' local default_path = ''
local configs = {} local configs = {}
default_path = home_dirs[path_name] .. "/nodered" default_path = home_dirs[path_name] .. "/nodered-app"
if #blocks == 0 then if #blocks == 0 then
table.insert(configs, default_path) table.insert(configs, default_path)
else else
for _, val in pairs(blocks) do for _, val in pairs(blocks) do
table.insert(configs, val .. "/" .. path_name .. "/nodered") table.insert(configs, val .. "/" .. path_name .. "/nodered-app")
end end
local without_conf_dir = "/root/" .. path_name .. "/nodered" local without_conf_dir = "/root/" .. path_name .. "/nodered-app"
if default_path == without_conf_dir then if default_path == without_conf_dir then
default_path = configs[1] default_path = configs[1]
end end

Loading…
Cancel
Save