diff --git a/applications/luci-app-passwall/Makefile b/applications/luci-app-passwall/Makefile
index e2deb992619..f3b73000af1 100644
--- a/applications/luci-app-passwall/Makefile
+++ b/applications/luci-app-passwall/Makefile
@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
-PKG_VERSION:=24.12.25
+PKG_VERSION:=24.12.26
PKG_RELEASE:=1
PKG_CONFIG_DEPENDS:= \
@@ -28,7 +28,7 @@ PKG_CONFIG_DEPENDS:= \
LUCI_TITLE:=LuCI support for PassWall
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+coreutils +coreutils-base64 +coreutils-nohup +curl \
- +chinadns-ng +dns2socks +dns2tcp +ip-full +libuci-lua +lua +luci-compat +luci-lib-jsonc \
+ +chinadns-ng +dns2socks +ip-full +libuci-lua +lua +luci-compat +luci-lib-jsonc \
+microsocks +resolveip +tcping +unzip +ipt2socks \
+kmod-nft-socket +kmod-nft-tproxy +kmod-nft-nat \
+PACKAGE_$(PKG_NAME)_INCLUDE_Brook:brook \
diff --git a/applications/luci-app-passwall/luasrc/controller/passwall.lua b/applications/luci-app-passwall/luasrc/controller/passwall.lua
index abf743881e1..99c620fa890 100644
--- a/applications/luci-app-passwall/luasrc/controller/passwall.lua
+++ b/applications/luci-app-passwall/luasrc/controller/passwall.lua
@@ -4,11 +4,11 @@
module("luci.controller.passwall", package.seeall)
local api = require "luci.passwall.api"
local appname = "passwall" -- not available
-local uci = luci.model.uci.cursor() -- in funtion index()
+local uci = api.libuci -- in funtion index()
+local fs = api.fs
local http = require "luci.http"
local util = require "luci.util"
local i18n = require "luci.i18n"
-local fs = require "nixio.fs"
function index()
if not nixio.fs.access("/etc/config/passwall") then
@@ -16,8 +16,10 @@ function index()
luci.sys.call('cp -f /usr/share/passwall/0_default_config /etc/config/passwall')
else return end
end
+ local api = require "luci.passwall.api"
local appname = "passwall" -- global definitions not available
- local uci = luci.model.uci.cursor() -- in function index()
+ local uci = api.libuci -- in function index()
+ local fs = api.fs
entry({"admin", "services", appname}).dependent = true
entry({"admin", "services", appname, "reset_config"}, call("reset_config")).leaf = true
entry({"admin", "services", appname, "show"}, call("show_menu")).leaf = true
@@ -35,7 +37,7 @@ function index()
entry({"admin", "services", appname, "node_list"}, cbi(appname .. "/client/node_list"), _("Node List"), 2).dependent = true
entry({"admin", "services", appname, "node_subscribe"}, cbi(appname .. "/client/node_subscribe"), _("Node Subscribe"), 3).dependent = true
entry({"admin", "services", appname, "other"}, cbi(appname .. "/client/other", {autoapply = true}), _("Other Settings"), 92).leaf = true
- if nixio.fs.access("/usr/sbin/haproxy") then
+ if fs.access("/usr/sbin/haproxy") then
entry({"admin", "services", appname, "haproxy"}, cbi(appname .. "/client/haproxy"), _("Load Balancing"), 93).leaf = true
end
entry({"admin", "services", appname, "app_update"}, cbi(appname .. "/client/app_update"), _("App Update"), 95).leaf = true
@@ -143,7 +145,7 @@ function socks_autoswitch_add_node()
table.insert(new_list, e.id)
end
end
- uci:set_list(appname, id, "autoswitch_backup_node", new_list)
+ api.uci_set_list(uci, appname, id, "autoswitch_backup_node", new_list)
uci:commit(appname)
end
luci.http.redirect(api.url("socks_config", id))
@@ -159,7 +161,7 @@ function socks_autoswitch_remove_node()
table.remove(new_list, i)
end
end
- uci:set_list(appname, id, "autoswitch_backup_node", new_list)
+ api.uci_set_list(uci, appname, id, "autoswitch_backup_node", new_list)
uci:commit(appname)
end
luci.http.redirect(api.url("socks_config", id))
@@ -185,10 +187,10 @@ function get_redir_log()
local proto = luci.http.formvalue("proto")
local path = "/tmp/etc/passwall/acl/" .. name
proto = proto:upper()
- if proto == "UDP" and (uci:get(appname, "@global[0]", "udp_node") or "nil") == "tcp" and not nixio.fs.access(path .. "/" .. proto .. ".log") then
+ if proto == "UDP" and (uci:get(appname, "@global[0]", "udp_node") or "nil") == "tcp" and not fs.access(path .. "/" .. proto .. ".log") then
proto = "TCP"
end
- if nixio.fs.access(path .. "/" .. proto .. ".log") then
+ if fs.access(path .. "/" .. proto .. ".log") then
local content = luci.sys.exec("cat ".. path .. "/" .. proto .. ".log")
content = content:gsub("\n", "
")
luci.http.write(content)
@@ -200,7 +202,7 @@ end
function get_socks_log()
local name = luci.http.formvalue("name")
local path = "/tmp/etc/passwall/SOCKS_" .. name .. ".log"
- if nixio.fs.access(path) then
+ if fs.access(path) then
local content = luci.sys.exec("cat ".. path)
content = content:gsub("\n", "
")
luci.http.write(content)
@@ -346,7 +348,7 @@ end
function copy_node()
local section = luci.http.formvalue("section")
local uuid = api.gen_short_uuid()
- uci:section(appname, "nodes", uuid)
+ api.uci_section(uci, appname, "nodes", uuid)
for k, v in pairs(uci:get_all(appname, section)) do
local filter = k:find("%.")
if filter and filter == 1 then
@@ -370,7 +372,7 @@ function clear_all_nodes()
uci:delete(appname, '@global[0]', "udp_node")
uci:foreach(appname, "socks", function(t)
uci:delete(appname, t[".name"])
- uci:set_list(appname, t[".name"], "autoswitch_backup_node", {})
+ api.uci_set_list(uci, appname, t[".name"], "autoswitch_backup_node", {})
end)
uci:foreach(appname, "haproxy_config", function(t)
uci:delete(appname, t[".name"])
@@ -406,7 +408,7 @@ function delete_select_nodes()
table.remove(auto_switch_node_list, i)
end
end
- uci:set_list(appname, t[".name"], "autoswitch_backup_node", auto_switch_node_list)
+ api.uci_set_list(uci, appname, t[".name"], "autoswitch_backup_node", auto_switch_node_list)
end)
uci:foreach(appname, "haproxy_config", function(t)
if t["lbss"] == w then
@@ -452,7 +454,7 @@ end
function server_user_log()
local id = luci.http.formvalue("id")
- if nixio.fs.access("/tmp/etc/passwall_server/" .. id .. ".log") then
+ if fs.access("/tmp/etc/passwall_server/" .. id .. ".log") then
local content = luci.sys.exec("cat /tmp/etc/passwall_server/" .. id .. ".log")
content = content:gsub("\n", "
")
luci.http.write(content)
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua
index 7ce1b7db594..3248b18d9fd 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/acl_config.lua
@@ -1,6 +1,6 @@
local api = require "luci.passwall.api"
local appname = "passwall"
-local uci = api.uci
+local uci = api.libuci
local sys = api.sys
local has_singbox = api.finded_com("singbox")
local has_xray = api.finded_com("xray")
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
index 8ce58cfe1e5..411b04aa7e6 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
@@ -1,6 +1,6 @@
local api = require "luci.passwall.api"
local appname = "passwall"
-local uci = api.uci
+local uci = api.libuci
local datatypes = api.datatypes
local has_singbox = api.finded_com("singbox")
local has_xray = api.finded_com("xray")
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua
index e85276a2ed7..b69cbefed94 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua
@@ -1,7 +1,7 @@
local api = require "luci.passwall.api"
local appname = "passwall"
-local uci = api.uci
-local fs = require "nixio.fs"
+local uci = api.libuci
+local fs = api.fs
local types_dir = "/usr/lib/lua/luci/model/cbi/passwall/client/type/"
if not arg[1] or not uci:get(appname, arg[1]) then
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua
index 1152bf67e50..359ce024e06 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/socks_config.lua
@@ -1,6 +1,6 @@
local api = require "luci.passwall.api"
local appname = "passwall"
-local uci = api.uci
+local uci = api.libuci
local has_singbox = api.finded_com("singbox")
local has_xray = api.finded_com("xray")
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua
index 1c5b0e17482..f6b223f5234 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua
@@ -8,7 +8,7 @@ end
local appname = "passwall"
local jsonc = api.jsonc
-local uci = api.uci
+local uci = api.libuci
local type_name = "Xray"
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua
index 8075c8fc297..1c30236838d 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua
@@ -11,7 +11,7 @@ end
local singbox_tags = luci.sys.exec(singbox_bin .. " version | grep 'Tags:' | awk '{print $2}'")
local appname = "passwall"
-local uci = api.uci
+local uci = api.libuci
local type_name = "sing-box"
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua
index 5fbd276489a..dc6e0475622 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua
@@ -6,6 +6,8 @@ if not api.finded_com("hysteria") then
return
end
+local fs = api.fs
+
local type_name = "Hysteria2"
local option_prefix = "hysteria2_"
@@ -46,7 +48,7 @@ o = s:option(FileUpload, _n("tls_certificateFile"), translate("Public key absolu
o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem"
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
@@ -59,7 +61,7 @@ o = s:option(FileUpload, _n("tls_keyFile"), translate("Private key absolute path
o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key"
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua
index 49baf962b54..293cbf20b27 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua
@@ -6,6 +6,8 @@ if not api.finded_com("xray") then
return
end
+local fs = api.fs
+
local type_name = "Xray"
local option_prefix = "xray_"
@@ -174,7 +176,7 @@ o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg
o:depends({ [_n("tls")] = true, [_n("reality")] = false })
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
@@ -188,7 +190,7 @@ o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. "
o:depends({ [_n("tls")] = true, [_n("reality")] = false })
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua
index 6bcbe55de95..884282313a7 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua
@@ -8,6 +8,8 @@ if not singbox_bin then
return
end
+local fs = api.fs
+
local singbox_tags = luci.sys.exec(singbox_bin .. " version | grep 'Tags:' | awk '{print $2}'")
local type_name = "sing-box"
@@ -255,7 +257,7 @@ o:depends({ [_n("protocol")] = "tuic" })
o:depends({ [_n("protocol")] = "hysteria2" })
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
@@ -273,7 +275,7 @@ o:depends({ [_n("protocol")] = "tuic" })
o:depends({ [_n("protocol")] = "hysteria2" })
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua
index ab1ada379af..7df87fe0f0d 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/type/trojan-plus.lua
@@ -6,6 +6,8 @@ if not api.is_finded("trojan-plus") then
return
end
+local fs = api.fs
+
local type_name = "Trojan-Plus"
local option_prefix = "trojan_plus_"
@@ -50,7 +52,7 @@ o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg
o:depends({ [_n("tls")] = true })
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
@@ -64,7 +66,7 @@ o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. "
o:depends({ [_n("tls")] = true })
o.validate = function(self, value, t)
if value and value ~= "" then
- if not nixio.fs.access(value) then
+ if not fs.access(value) then
return nil, translate("Can't find this file!")
else
return value
diff --git a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua
index b4371db3367..6affd2c7d2b 100644
--- a/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua
+++ b/applications/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua
@@ -1,5 +1,5 @@
local api = require "luci.passwall.api"
-local fs = require "nixio.fs"
+local fs = api.fs
local types_dir = "/usr/lib/lua/luci/model/cbi/passwall/server/type/"
m = Map("passwall_server", translate("Server Config"))
diff --git a/applications/luci-app-passwall/luasrc/passwall/api.lua b/applications/luci-app-passwall/luasrc/passwall/api.lua
index d48cb0fb7dc..c866607ce01 100644
--- a/applications/luci-app-passwall/luasrc/passwall/api.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/api.lua
@@ -3,7 +3,7 @@ local com = require "luci.passwall.com"
bin = require "nixio".bin
fs = require "nixio.fs"
sys = require "luci.sys"
-uci = require"luci.model.uci".cursor()
+libuci = require "uci".cursor()
util = require "luci.util"
datatypes = require "luci.cbi.datatypes"
jsonc = require "luci.jsonc"
@@ -30,6 +30,52 @@ function log(...)
end
end
+function uci_set_list(cursor, config, section, option, value)
+ if config and section and option then
+ if not value or #value == 0 then
+ return cursor:delete(config, section, option)
+ end
+ return cursor:set(
+ config, section, option,
+ ( type(value) == "table" and value or { value } )
+ )
+ end
+ return false
+end
+
+function uci_section(cursor, config, type, name, values)
+ local stat = true
+ if name then
+ stat = cursor:set(config, name, type)
+ else
+ name = cursor:add(config, type)
+ stat = name and true
+ end
+
+ return stat and name
+end
+
+function sh_uci_get(config, section, option)
+ exec_call(string.format("uci -q get %s.%s.%s", config, section, option))
+ exec_call(string.format("uci -q commit %s", config))
+end
+
+function sh_uci_set(config, section, option, val)
+ exec_call(string.format("uci -q set %s.%s.%s=\"%s\"", config, section, option, val))
+ exec_call(string.format("uci -q commit %s", config))
+end
+
+function sh_uci_del(config, section, option)
+ exec_call(string.format("uci -q delete %s.%s.%s", config, section, option))
+ exec_call(string.format("uci -q commit %s", config))
+end
+
+function sh_uci_add_list(config, section, option, val)
+ exec_call(string.format("uci -q del_list %s.%s.%s=\"%s\"", config, section, option, val))
+ exec_call(string.format("uci -q add_list %s.%s.%s=\"%s\"", config, section, option, val))
+ exec_call(string.format("uci -q commit %s", config))
+end
+
function set_cache_var(key, val)
sys.call(string.format('/usr/share/passwall/app.sh set_cache_var %s "%s"', key, val))
end
@@ -129,11 +175,13 @@ end
function curl_direct(url, file, args)
--直连访问
+ local chn_list = libuci:get(appname, "@global[0]", "chn_list") or "direct"
+ local Dns = (chn_list == "proxy") and "1.1.1.1" or "223.5.5.5"
if not args then args = {} end
local tmp_args = clone(args)
local domain, port = get_domain_port_from_url(url)
if domain then
- local ip = domainToIPv4(domain)
+ local ip = domainToIPv4(domain, Dns)
if ip then
tmp_args[#tmp_args + 1] = "--resolve " .. domain .. ":" .. port .. ":" .. ip
end
@@ -376,7 +424,7 @@ function get_node_name(node_id)
if type(node_id) == "table" then
e = node_id
else
- e = uci:get_all(appname, node_id)
+ e = libuci:get_all(appname, node_id)
end
if e then
if e.type and e.remarks then
@@ -392,9 +440,9 @@ function get_node_name(node_id)
end
function get_valid_nodes()
- local show_node_info = uci_get_type("global_other", "show_node_info") or "0"
+ local show_node_info = uci_get_type("@global_other[0]", "show_node_info", "0")
local nodes = {}
- uci:foreach(appname, "nodes", function(e)
+ libuci:foreach(appname, "nodes", function(e)
e.id = e[".name"]
if e.type and e.remarks then
if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt" or e.protocol == "_iface") then
@@ -491,15 +539,7 @@ function gen_short_uuid()
end
function uci_get_type(type, config, 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 .. ")")
+ local value = libuci:get(appname, type, config) or default
if (value == nil or value == "") and (default and default ~= "") then
value = default
end
@@ -515,7 +555,7 @@ local function chmod_755(file)
end
function get_customed_path(e)
- return uci_get_type("global_app", e .. "_file")
+ return uci_get_type("@global_app[0]", e .. "_file")
end
function finded_com(e)
@@ -574,7 +614,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", app_name:gsub("%-","_") .. "_file")
+ local path = uci_get_type("@global_app[0]", app_name:gsub("%-","_") .. "_file")
path = path and (#path>0 and path or def_path) or def_path
return path
end
@@ -813,7 +853,7 @@ local default_file_tree = {
local function get_api_json(url)
local jsonc = require "luci.jsonc"
- local return_code, content = curl_logic(url, nil, curl_args)
+ local return_code, content = curl_auto(url, nil, curl_args)
if return_code ~= 0 or content == "" then return {} end
return jsonc.parse(content) or {}
end
@@ -930,7 +970,7 @@ function to_download(app_name, url, size)
local _curl_args = clone(curl_args)
table.insert(_curl_args, "-m 60")
- local return_code, result = curl_logic(url, tmp_file, _curl_args)
+ local return_code, result = curl_auto(url, tmp_file, _curl_args)
result = return_code == 0
if not result then
@@ -1081,7 +1121,7 @@ end
function to_check_self()
local url = "https://raw.githubusercontent.com/xiaorouji/openwrt-passwall/main/luci-app-passwall/Makefile"
local tmp_file = "/tmp/passwall_makefile"
- local return_code, result = curl_logic(url, tmp_file, curl_args)
+ local return_code, result = curl_auto(url, tmp_file, curl_args)
result = return_code == 0
if not result then
exec("/bin/rm", {"-f", tmp_file})
diff --git a/applications/luci-app-passwall/luasrc/passwall/server_app.lua b/applications/luci-app-passwall/luasrc/passwall/server_app.lua
index 50357056b6f..ef267c649aa 100755
--- a/applications/luci-app-passwall/luasrc/passwall/server_app.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/server_app.lua
@@ -3,7 +3,7 @@
local action = arg[1]
local api = require "luci.passwall.api"
local sys = api.sys
-local uci = api.uci
+local uci = api.libuci
local jsonc = api.jsonc
local CONFIG = "passwall_server"
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_hysteria2.lua b/applications/luci-app-passwall/luasrc/passwall/util_hysteria2.lua
index b818aadbfb0..12afe6874b6 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_hysteria2.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_hysteria2.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_hysteria2", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local jsonc = api.jsonc
function gen_config_server(node)
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_naiveproxy.lua b/applications/luci-app-passwall/luasrc/passwall/util_naiveproxy.lua
index ee095c1e6c1..b6ef39b3bfe 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_naiveproxy.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_naiveproxy.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_naiveproxy", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local jsonc = api.jsonc
function gen_config(var)
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_shadowsocks.lua b/applications/luci-app-passwall/luasrc/passwall/util_shadowsocks.lua
index e6080001b85..5e724e77ba5 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_shadowsocks.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_shadowsocks.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_shadowsocks", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local jsonc = api.jsonc
function gen_config_server(node)
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/applications/luci-app-passwall/luasrc/passwall/util_sing-box.lua
index af640e77f31..7db399325ab 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_sing-box.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_sing-box.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_sing-box", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local sys = api.sys
local jsonc = api.jsonc
local appname = "passwall"
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_trojan.lua b/applications/luci-app-passwall/luasrc/passwall/util_trojan.lua
index 848b689a560..31bd67a4a35 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_trojan.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_trojan.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_trojan", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local json = api.jsonc
function gen_config_server(node)
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_tuic.lua b/applications/luci-app-passwall/luasrc/passwall/util_tuic.lua
index e138b6da56b..be00dcb8cf3 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_tuic.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_tuic.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_tuic", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local json = api.jsonc
function gen_config(var)
diff --git a/applications/luci-app-passwall/luasrc/passwall/util_xray.lua b/applications/luci-app-passwall/luasrc/passwall/util_xray.lua
index 5c7ec1fca1d..d26ac1b1231 100644
--- a/applications/luci-app-passwall/luasrc/passwall/util_xray.lua
+++ b/applications/luci-app-passwall/luasrc/passwall/util_xray.lua
@@ -1,6 +1,6 @@
module("luci.passwall.util_xray", package.seeall)
local api = require "luci.passwall.api"
-local uci = api.uci
+local uci = api.libuci
local sys = api.sys
local jsonc = api.jsonc
local appname = "passwall"
diff --git a/applications/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm b/applications/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm
index 6d584583f18..8a6362d3fdf 100644
--- a/applications/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm
+++ b/applications/luci-app-passwall/luasrc/view/passwall/haproxy/status.htm
@@ -1,6 +1,6 @@
<%
local api = require "luci.passwall.api"
-local console_port = api.uci_get_type("global_haproxy", "console_port", "")
+local console_port = api.uci_get_type("@global_haproxy[0]", "console_port", "")
-%>