mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 16:44:45 +08:00
update 2026-08-15 00:44:02
This commit is contained in:
1 parent
58e04d6ceb
commit
a59171002f
84 files changed
+919
-835
No files matched your search
@@ -3,7 +3,7 @@ local api = require "luci.passwall.api"
|
||||
local uci = api.uci
|
||||
local sys = api.sys
|
||||
local jsonc = api.jsonc
|
||||
local appname = "passwall"
|
||||
local appname = api.appname
|
||||
local fs = api.fs
|
||||
|
||||
local GLOBAL = {
|
||||
@@ -493,7 +493,7 @@ function gen_config_server(node)
|
||||
if node.users and #node.users > 0 then
|
||||
users = {}
|
||||
for i, v in ipairs(node.users) do
|
||||
local user = uci:get_all("passwall_server", v) or {}
|
||||
local user = uci:get_all(api.s_config, v) or {}
|
||||
if user[".type"] == "user" then
|
||||
local u = {}
|
||||
if node.protocol == "socks" or node.protocol == "http" then
|
||||
@@ -625,7 +625,7 @@ function gen_config_server(node)
|
||||
}
|
||||
sys.call(string.format("mkdir -p %s && touch %s/%s", api.TMP_IFACE_PATH, api.TMP_IFACE_PATH, node.outbound_node_iface))
|
||||
else
|
||||
local outbound_node_t = uci:get_all("passwall", node.outbound_node)
|
||||
local outbound_node_t = uci:get_all(api.c_config, node.outbound_node)
|
||||
if node.outbound_node == "_socks" or node.outbound_node == "_http" then
|
||||
outbound_node_t = {
|
||||
type = node.type,
|
||||
@@ -901,7 +901,7 @@ function gen_config(var)
|
||||
local outbounds = {}
|
||||
local COMMON = {}
|
||||
|
||||
local xray_settings = uci:get_all(appname, "@global_xray[0]") or {}
|
||||
local xray_settings = uci:get_all(api.c_config, "@global_xray[0]") or {}
|
||||
|
||||
if xray_settings.fragment == "1" then
|
||||
local lengths, delays = {}, {}
|
||||
@@ -926,7 +926,7 @@ function gen_config(var)
|
||||
|
||||
if xray_settings.noise == "1" then
|
||||
local noises = {}
|
||||
uci:foreach(appname, "xray_noise_packets", function(n)
|
||||
uci:foreach(api.c_config, "xray_noise_packets", function(n)
|
||||
if n.enabled == "1" then
|
||||
local noise = {
|
||||
rand = (n.type == "rand" and n.packet) and (n.packet:find("-", 1, true) and n.packet or tonumber(n.packet)) or nil,
|
||||
@@ -944,7 +944,7 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
if node_id then
|
||||
local node = uci:get_all(appname, node_id)
|
||||
local node = uci:get_all(api.c_config, node_id)
|
||||
local balancers = {}
|
||||
local rules = {}
|
||||
if node then
|
||||
@@ -1001,7 +1001,7 @@ function gen_config(var)
|
||||
|
||||
function get_node_by_id(node_id)
|
||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
||||
local section = uci:get_all(appname, node_id) or {}
|
||||
local section = uci:get_all(api.c_config, node_id) or {}
|
||||
if section[".type"] == "socks" then
|
||||
local result = {
|
||||
[".name"] = node_id,
|
||||
@@ -1374,7 +1374,7 @@ function gen_config(var)
|
||||
|
||||
--shunt rule
|
||||
local function foreach_shunt_rule(callback)
|
||||
uci:foreach(appname, "shunt_rules", callback)
|
||||
uci:foreach(api.c_config, "shunt_rules", callback)
|
||||
|
||||
if use_gfw_list ~= "1" or chn_list ~= "0" then return end
|
||||
|
||||
@@ -1400,7 +1400,7 @@ function gen_config(var)
|
||||
|
||||
local bin = api.finded_com("geoview")
|
||||
if bin then
|
||||
local geo_file = (uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") .. "/geosite.dat"
|
||||
local geo_file = (uci:get(api.c_config, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") .. "/geosite.dat"
|
||||
if luci.sys.call('"' .. bin .. '" -type geosite -input "' .. geo_file .. '" | grep -q "^GFW$"') == 0 then
|
||||
domain_list = (domain_list == "") and "geosite:gfw" or domain_list .. "\ngeosite:gfw"
|
||||
end
|
||||
@@ -1788,7 +1788,7 @@ function gen_config(var)
|
||||
})
|
||||
|
||||
-- remote dns outbound
|
||||
local chn_list = uci:get(appname, "@global[0]", "chn_list") or "direct"
|
||||
local chn_list = uci:get(api.c_config, "@global[0]", "chn_list") or "direct"
|
||||
remote_dns_outbound = {
|
||||
tag = "dns-out",
|
||||
protocol = "dns",
|
||||
@@ -1979,7 +1979,7 @@ function gen_config(var)
|
||||
if inbounds or outbounds then
|
||||
local config = {
|
||||
env = (function()
|
||||
local asset_location = uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"
|
||||
local asset_location = uci:get(api.c_config, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"
|
||||
return { XRAY_LOCATION_ASSET = asset_location }
|
||||
end)(),
|
||||
log = {
|
||||
|
||||
Reference in new issue
Block a user