diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index e876f47..a73b113 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -595,7 +595,7 @@ end function get_node() local id = http.formvalue("id") local result = {} - local show_node_info = api.uci_get_type("@global_other[0]", "show_node_info", "0") + local show_node_info = api.uci_get_type("global_other", "show_node_info", "0") function add_is_ipv6_key(o) if o and o.address and show_node_info == "1" then diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 823650c..18b3b8c 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -438,7 +438,7 @@ function get_domain_from_url(url) end function get_valid_nodes() - local show_node_info = uci_get_type("@global_other[0]", "show_node_info", "0") + local show_node_info = uci_get_type("global_other", "show_node_info", "0") local nodes = {} uci:foreach(appname, "nodes", function(e) e.id = e[".name"] @@ -562,7 +562,15 @@ function gen_short_uuid() end function uci_get_type(type, config, default) - local value = uci:get(appname, type, config) or default + local value = uci:get_first(appname, type, config, default) or sys.exec("echo -n $(uci -q get " .. appname .. ".@" .. type .."[0]." .. config .. ")") + if (value == nil or value == "") and (default and default ~= "") then + value = default + end + return value +end + +function uci_get_type_id(id, config, default) + local value = uci:get(appname, id, config, default) or sys.exec("echo -n $(uci -q get " .. appname .. "." .. id .. "." .. config .. ")") if (value == nil or value == "") and (default and default ~= "") then value = default end @@ -578,7 +586,7 @@ local function chmod_755(file) end function get_customed_path(e) - return uci_get_type("@global_app[0]", e .. "_file") + return uci_get_type("global_app", e .. "_file") end function finded_com(e) @@ -637,7 +645,7 @@ end function get_app_path(app_name) if com[app_name] then local def_path = com[app_name].default_path - local path = uci_get_type("@global_app[0]", app_name:gsub("%-","_") .. "_file") + local path = uci_get_type("global_app", app_name:gsub("%-","_") .. "_file") path = path and (#path>0 and path or def_path) or def_path return path end diff --git a/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm b/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm index af65f8b..7d5e090 100644 --- a/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm +++ b/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm @@ -1,7 +1,7 @@ <% local api = require "luci.passwall.api" -local haproxy_enable = api.uci_get_type("@global_haproxy[0]", "balancing_enable", "0") -local console_port = api.uci_get_type("@global_haproxy[0]", "console_port", "") +local haproxy_enable = api.uci_get_type("global_haproxy", "balancing_enable", "0") +local console_port = api.uci_get_type("global_haproxy", "console_port", "") -%>

diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm index 9b95390..79b5c51 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm @@ -127,8 +127,8 @@ table td, .table .td {