luci-app-passwall2: sync upstream

* d2d0f8e080b89f4d5651650d681949eb5961b769
This commit is contained in:
sbwml 2023-09-06 23:39:56 +08:00
parent 926b43da02
commit 5547539708
24 changed files with 123 additions and 60 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2 PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.20-4 PKG_VERSION:=1.20-5
PKG_RELEASE:= PKG_RELEASE:=
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \

View File

@ -2,8 +2,8 @@ local api = require "luci.passwall2.api"
local appname = api.appname local appname = api.appname
local uci = api.uci local uci = api.uci
local datatypes = api.datatypes local datatypes = api.datatypes
local has_singbox = api.is_finded("sing-box") local has_singbox = api.finded_com("singbox")
local has_xray = api.is_finded("xray") local has_xray = api.finded_com("xray")
m = Map(appname) m = Map(appname)

View File

@ -2,8 +2,8 @@ local api = require "luci.passwall2.api"
local appname = api.appname local appname = api.appname
local has_ss = api.is_finded("ss-redir") local has_ss = api.is_finded("ss-redir")
local has_ss_rust = api.is_finded("sslocal") local has_ss_rust = api.is_finded("sslocal")
local has_singbox = api.is_finded("sing-box") local has_singbox = api.finded_com("singbox")
local has_xray = api.is_finded("xray") local has_xray = api.finded_com("xray")
local ss_aead_type = {} local ss_aead_type = {}
if has_ss then if has_ss then
ss_aead_type[#ss_aead_type + 1] = "shadowsocks-libev" ss_aead_type[#ss_aead_type + 1] = "shadowsocks-libev"

View File

@ -3,8 +3,8 @@ local appname = api.appname
local sys = api.sys local sys = api.sys
local has_ss = api.is_finded("ss-redir") local has_ss = api.is_finded("ss-redir")
local has_ss_rust = api.is_finded("sslocal") local has_ss_rust = api.is_finded("sslocal")
local has_singbox = api.is_finded("sing-box") local has_singbox = api.finded_com("singbox")
local has_xray = api.is_finded("xray") local has_xray = api.finded_com("xray")
local ss_aead_type = {} local ss_aead_type = {}
if has_ss then if has_ss then
ss_aead_type[#ss_aead_type + 1] = "shadowsocks-libev" ss_aead_type[#ss_aead_type + 1] = "shadowsocks-libev"

View File

@ -2,8 +2,8 @@ local api = require "luci.passwall2.api"
local appname = api.appname local appname = api.appname
local fs = api.fs local fs = api.fs
local uci = api.uci local uci = api.uci
local has_singbox = api.is_finded("sing-box") local has_singbox = api.finded_com("singbox")
local has_xray = api.is_finded("xray") local has_xray = api.finded_com("xray")
local has_fw3 = api.is_finded("fw3") local has_fw3 = api.is_finded("fw3")
local has_fw4 = api.is_finded("fw4") local has_fw4 = api.is_finded("fw4")

View File

@ -1,8 +1,8 @@
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
local appname = api.appname local appname = api.appname
local uci = api.uci local uci = api.uci
local has_singbox = api.is_finded("sing-box") local has_singbox = api.finded_com("singbox")
local has_xray = api.is_finded("xray") local has_xray = api.finded_com("xray")
m = Map(appname) m = Map(appname)

View File

@ -2,7 +2,7 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("brook") then if not api.finded_com("brook") then
return return
end end

View File

@ -2,7 +2,7 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("hysteria") then if not api.finded_com("hysteria") then
return return
end end

View File

@ -2,7 +2,7 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("xray") then if not api.finded_com("xray") then
return return
end end

View File

@ -2,11 +2,13 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("sing-box") then local singbox_bin = api.finded_com("singbox")
if not singbox_bin then
return return
end end
local singbox_tags = luci.sys.exec(api.finded("sing-box") .. " version | grep 'Tags:' | awk '{print $2}'") local singbox_tags = luci.sys.exec(singbox_bin .. " version | grep 'Tags:' | awk '{print $2}'")
local appname = api.appname local appname = api.appname
local uci = api.uci local uci = api.uci

View File

@ -2,7 +2,7 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("brook") then if not api.finded_com("brook") then
return return
end end

View File

@ -2,7 +2,7 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("hysteria") then if not api.finded_com("hysteria") then
return return
end end

View File

@ -2,7 +2,7 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("xray") then if not api.finded_com("xray") then
return return
end end

View File

@ -2,11 +2,13 @@ local m, s = ...
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
if not api.is_finded("sing-box")then local singbox_bin = api.finded_com("singbox")
if not singbox_bin then
return return
end end
local singbox_tags = luci.sys.exec(api.finded("sing-box") .. " version | grep 'Tags:' | awk '{print $2}'") local singbox_tags = luci.sys.exec(singbox_bin .. " version | grep 'Tags:' | awk '{print $2}'")
local type_name = "sing-box" local type_name = "sing-box"

View File

@ -381,8 +381,14 @@ function get_customed_path(e)
return uci_get_type("global_app", e .. "_file") return uci_get_type("global_app", e .. "_file")
end end
function finded_com(e)
local bin = get_app_path(e)
if not bin then return end
return luci.sys.exec('echo -n $(type -t -p "%s" | head -n1)' % { bin })
end
function finded(e) function finded(e)
return luci.sys.exec('echo -n $(type -t -p "/bin/%s" -p "/usr/bin/%s" -p "%s" "%s" | head -n1)' % {e, e, get_customed_path(e), e}) return luci.sys.exec('echo -n $(type -t -p "/bin/%s" -p "/usr/bin/%s" "%s" | head -n1)' % {e, e, e})
end end
function is_finded(e) function is_finded(e)
@ -425,10 +431,12 @@ local function get_bin_version_cache(file, cmd)
end end
function get_app_path(app_name) function get_app_path(app_name)
local def_path = com[app_name].default_path if com[app_name] then
local path = uci_get_type("global_app", app_name:gsub("%-","_") .. "_file") local def_path = com[app_name].default_path
path = path and (#path>0 and path or def_path) or def_path local path = uci_get_type("global_app", app_name:gsub("%-","_") .. "_file")
return path path = path and (#path>0 and path or def_path) or def_path
return path
end
end end
function get_app_version(app_name, file) function get_app_version(app_name, file)
@ -790,12 +798,23 @@ function to_extract(app_name, file, subfix)
return {code = 1, error = i18n.translate("File path required.")} return {code = 1, error = i18n.translate("File path required.")}
end end
if sys.exec("echo -n $(opkg list-installed | grep -c unzip)") ~= "1" then local tools_name
exec("/bin/rm", {"-f", file}) if com[app_name].zipped then
return { if not com[app_name].zipped_suffix or com[app_name].zipped_suffix == "zip" then
code = 1, tools_name = "unzip"
error = i18n.translate("Not installed unzip, Can't unzip!") end
} if com[app_name].zipped_suffix and com[app_name].zipped_suffix == "tar.gz" then
tools_name = "tar"
end
if tools_name then
if sys.exec("echo -n $(command -v %s)" % { tools_name }) == "" then
exec("/bin/rm", {"-f", file})
return {
code = 1,
error = i18n.translate("Not installed %s, Can't unzip!" % { tools_name })
}
end
end
end end
sys.call("/bin/rm -rf /tmp/".. app_name .."_extract.*") sys.call("/bin/rm -rf /tmp/".. app_name .."_extract.*")
@ -809,8 +828,19 @@ function to_extract(app_name, file, subfix)
local tmp_dir = util.trim(util.exec("mktemp -d -t ".. app_name .."_extract.XXXXXX")) local tmp_dir = util.trim(util.exec("mktemp -d -t ".. app_name .."_extract.XXXXXX"))
local output = {} local output = {}
exec("/usr/bin/unzip", {"-o", file, app_name, "-d", tmp_dir},
function(chunk) output[#output + 1] = chunk end) if tools_name then
if tools_name == "unzip" then
local bin = sys.exec("echo -n $(command -v unzip)")
exec(bin, {"-o", file, app_name, "-d", tmp_dir}, function(chunk) output[#output + 1] = chunk end)
elseif tools_name == "tar" then
local bin = sys.exec("echo -n $(command -v tar)")
if com[app_name].zipped_suffix == "tar.gz" then
exec(bin, {"-zxf", file, "-C", tmp_dir}, function(chunk) output[#output + 1] = chunk end)
sys.call("/bin/mv -f " .. tmp_dir .. "/*/" .. com[app_name].name:lower() .. " " .. tmp_dir)
end
end
end
local files = util.split(table.concat(output)) local files = util.split(table.concat(output))
@ -829,7 +859,7 @@ function to_move(app_name,file)
local bin_path = file local bin_path = file
local cmd_rm_tmp = "/bin/rm -rf /tmp/" .. app_name .. "_download.*" local cmd_rm_tmp = "/bin/rm -rf /tmp/" .. app_name .. "_download.*"
if fs.stat(file, "type") == "dir" then if fs.stat(file, "type") == "dir" then
bin_path = file .. "/" .. app_name bin_path = file .. "/" .. com[app_name].name:lower()
cmd_rm_tmp = "/bin/rm -rf /tmp/" .. app_name .. "_extract.*" cmd_rm_tmp = "/bin/rm -rf /tmp/" .. app_name .. "_extract.*"
end end

View File

@ -39,6 +39,7 @@ _M.singbox = {
get_url = gh_pre_release_url, get_url = gh_pre_release_url,
cmd_version = "version | awk '{print $3}' | sed -n 1P", cmd_version = "version | awk '{print $3}' | sed -n 1P",
zipped = true, zipped = true,
zipped_suffix = "tar.gz",
default_path = "/usr/bin/sing-box", default_path = "/usr/bin/sing-box",
match_fmt_str = "linux%%-%s", match_fmt_str = "linux%%-%s",
file_tree = { file_tree = {

View File

@ -662,12 +662,12 @@ function gen_config(var)
local route = { local route = {
rules = {}, rules = {},
geoip = { geoip = {
path = singbox_settings.geoip_path or "/tmp/singbox/geoip.db", path = singbox_settings.geoip_path or "/usr/share/singbox/geoip.db",
download_url = singbox_settings.geoip_url or nil, download_url = singbox_settings.geoip_url or nil,
download_detour = nil, download_detour = nil,
}, },
geosite = { geosite = {
path = singbox_settings.geosite_path or "/tmp/singbox/geosite.db", path = singbox_settings.geosite_path or "/usr/share/singbox/geosite.db",
download_url = singbox_settings.geosite_url or nil, download_url = singbox_settings.geosite_url or nil,
download_detour = nil, download_detour = nil,
}, },
@ -1134,7 +1134,7 @@ function gen_config(var)
end end
experimental.clash_api = { experimental.clash_api = {
store_fakeip = true, store_fakeip = true,
cache_file = "/tmp/singbox/passwall2_" .. flag .. ".db" cache_file = "/tmp/singbox_passwall2_" .. flag .. ".db"
} }
end end
end end

View File

@ -1,7 +1,8 @@
<%+cbi/valueheader%> <%+cbi/valueheader%>
<% <%
local api = require "luci.passwall2.api" local api = require "luci.passwall2.api"
local has_xray = api.is_finded("xray") local has_singbox = api.finded_com("singbox")
local has_xray = api.finded_com("xray")
-%> -%>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
function padright(str, cnt, pad) { function padright(str, cnt, pad) {
@ -142,6 +143,8 @@ local has_xray = api.is_finded("xray")
protocol = "hysteria" protocol = "hysteria"
} else if (v_type === "Xray") { } else if (v_type === "Xray") {
dom_prefix = "xray_" dom_prefix = "xray_"
} else if (v_type === "sing-box") {
dom_prefix = "singbox_"
} }
var _address = "" var _address = ""
if (dom_prefix && dom_prefix != null) { if (dom_prefix && dom_prefix != null) {
@ -229,7 +232,7 @@ local has_xray = api.is_finded("xray")
"&protoparam=" + b64encsafe(v_protocol_param.value) + "&protoparam=" + b64encsafe(v_protocol_param.value) +
"&remarks=" + b64encutf8safe(v_alias.value); "&remarks=" + b64encutf8safe(v_alias.value);
url = b64encsafe(ssr_str); url = b64encsafe(ssr_str);
} else if (v_type === "Xray" && opt.get(dom_prefix + "protocol").value === "vmess") { } else if ((v_type === "sing-box" || v_type === "Xray") && opt.get(dom_prefix + "protocol").value === "vmess") {
protocol = "vmess"; protocol = "vmess";
var info = {}; var info = {};
info.v = "2"; info.v = "2";
@ -274,7 +277,7 @@ local has_xray = api.is_finded("xray")
info.sni = opt.get(dom_prefix + "tls_serverName").value; info.sni = opt.get(dom_prefix + "tls_serverName").value;
} }
url = b64EncodeUnicode(JSON.stringify(info)); url = b64EncodeUnicode(JSON.stringify(info));
} else if (v_type === "Xray" && opt.get(dom_prefix + "protocol").value === "vless") { } else if ((v_type === "sing-box" || v_type === "Xray") && opt.get(dom_prefix + "protocol").value === "vless") {
protocol = "vless"; protocol = "vless";
var v_password = opt.get(dom_prefix + "uuid"); var v_password = opt.get(dom_prefix + "uuid");
var v_port = opt.get(dom_prefix + "port"); var v_port = opt.get(dom_prefix + "port");
@ -340,7 +343,7 @@ local has_xray = api.is_finded("xray")
params = params.substring(1); params = params.substring(1);
} }
url += params; url += params;
} else if ((v_type === "Xray" && opt.get(dom_prefix + "protocol").value === "trojan")) { } else if ((v_type === "sing-box" || v_type === "Xray") && opt.get(dom_prefix + "protocol").value === "trojan") {
protocol = "trojan"; protocol = "trojan";
var v_password = opt.get(dom_prefix + "password"); var v_password = opt.get(dom_prefix + "password");
var v_port = opt.get(dom_prefix + "port"); var v_port = opt.get(dom_prefix + "port");
@ -630,7 +633,6 @@ local has_xray = api.is_finded("xray")
} }
} }
if (ssu[0] === "trojan") { if (ssu[0] === "trojan") {
dom_prefix = "xray_"
var m = parseNodeUrl(ssrurl); var m = parseNodeUrl(ssrurl);
var password = m.passwd; var password = m.passwd;
if (password === "") { if (password === "") {
@ -648,8 +650,12 @@ local has_xray = api.is_finded("xray")
queryParam[decodeURIComponent(params[0]).toLowerCase()] = decodeURIComponent(params[1] || ''); queryParam[decodeURIComponent(params[0]).toLowerCase()] = decodeURIComponent(params[1] || '');
} }
} }
<% if has_xray then %> <% if has_singbox then %>
opt.set('type', "sing-box");
dom_prefix = "singbox_"
<% elseif has_xray then %>
opt.set('type', "Xray"); opt.set('type', "Xray");
dom_prefix = "xray_"
<% end %> <% end %>
opt.set(dom_prefix + 'protocol', "trojan"); opt.set(dom_prefix + 'protocol', "trojan");
opt.set(dom_prefix + 'address', m.hostname); opt.set(dom_prefix + 'address', m.hostname);
@ -664,11 +670,14 @@ local has_xray = api.is_finded("xray")
} }
} }
if (ssu[0] === "vmess") { if (ssu[0] === "vmess") {
dom_prefix = "xray_"
var sstr = b64DecodeUnicode(ssu[1]); var sstr = b64DecodeUnicode(ssu[1]);
var ploc = sstr.indexOf("/?"); var ploc = sstr.indexOf("/?");
<% if has_xray then %> <% if has_singbox then %>
opt.set('type', "sing-box");
dom_prefix = "singbox_"
<% elseif has_xray then %>
opt.set('type', "Xray"); opt.set('type', "Xray");
dom_prefix = "xray_"
<% end %> <% end %>
opt.set(dom_prefix + 'protocol', "vmess"); opt.set(dom_prefix + 'protocol', "vmess");
var url0, param = ""; var url0, param = "";
@ -715,9 +724,12 @@ local has_xray = api.is_finded("xray")
} }
} }
if (ssu[0] === "vless") { if (ssu[0] === "vless") {
dom_prefix = "xray_" <% if has_singbox then %>
<% if has_xray then %> opt.set('type', "sing-box");
dom_prefix = "singbox_"
<% elseif has_xray then %>
opt.set('type', "Xray"); opt.set('type', "Xray");
dom_prefix = "xray_"
<% end %> <% end %>
opt.set(dom_prefix + 'protocol', "vless"); opt.set(dom_prefix + 'protocol', "vless");
var m = parseNodeUrl(ssrurl); var m = parseNodeUrl(ssrurl);

View File

@ -1258,8 +1258,8 @@ msgstr "无"
msgid "You did not fill in the %s path. Please save and apply then update manually." msgid "You did not fill in the %s path. Please save and apply then update manually."
msgstr "您没有填写 %s 路径。请保存应用后再手动更新。" msgstr "您没有填写 %s 路径。请保存应用后再手动更新。"
msgid "Not installed unzip, Can't unzip!" msgid "Not installed %s, Can't unzip!"
msgstr "未安装unzip,无法解压。" msgstr "未安装 %s,无法解压。"
msgid "Can't determine ARCH, or ARCH not supported." msgid "Can't determine ARCH, or ARCH not supported."
msgstr "无法确认ARCH架构或是不支持。" msgstr "无法确认ARCH架构或是不支持。"

View File

@ -62,9 +62,9 @@ config global_subscribe
config global_singbox config global_singbox
option sniff_override_destination '1' option sniff_override_destination '1'
option geoip_path '/tmp/singbox/geoip.db' option geoip_path '/usr/share/singbox/geoip.db'
option geoip_url 'https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db' option geoip_url 'https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db'
option geosite_path '/tmp/singbox/geosite.db' option geosite_path '/usr/share/singbox/geosite.db'
option geosite_url 'https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db' option geosite_url 'https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db'
config nodes 'myshunt' config nodes 'myshunt'

View File

@ -808,8 +808,16 @@ run_global() {
node_http_port=$(config_t_get global node_http_port 0) node_http_port=$(config_t_get global node_http_port 0)
[ "$node_http_port" != "0" ] && V2RAY_ARGS="${V2RAY_ARGS} http_port=${node_http_port}" [ "$node_http_port" != "0" ] && V2RAY_ARGS="${V2RAY_ARGS} http_port=${node_http_port}"
[ "${TYPE}" = "xray" ] && run_xray $V2RAY_ARGS local run_func
[ "${TYPE}" = "sing-box" ] && run_singbox $V2RAY_ARGS [ -n "${XRAY_BIN}" ] && run_func="run_xray"
[ -n "${SINGBOX_BIN}" ] && run_func="run_singbox"
if [ "${TYPE}" = "xray" ] && [ -n "${XRAY_BIN}" ]; then
run_func="run_xray"
elif [ "${TYPE}" = "sing-box" ] && [ -n "${SINGBOX_BIN}" ]; then
run_func="run_singbox"
fi
${run_func} $V2RAY_ARGS
} }
start_socks() { start_socks() {
@ -1061,8 +1069,13 @@ acl_app() {
dns_port=$(get_new_port $(expr $dns_port + 1)) dns_port=$(get_new_port $(expr $dns_port + 1))
local acl_socks_port=$(get_new_port $(expr $redir_port + $index)) local acl_socks_port=$(get_new_port $(expr $redir_port + $index))
local run_func local run_func
[ "${TYPE}" = "xray" ] && run_func="run_xray" [ -n "${XRAY_BIN}" ] && run_func="run_xray"
[ "${TYPE}" = "sing-box" ] && run_func="run_singbox" [ -n "${SINGBOX_BIN}" ] && run_func="run_singbox"
if [ "${type}" = "xray" ] && [ -n "${XRAY_BIN}" ]; then
run_func="run_xray"
elif [ "${type}" = "sing-box" ] && [ -n "${SINGBOX_BIN}" ]; then
run_func="run_singbox"
fi
${run_func} flag=acl_$sid node=$node redir_port=$redir_port socks_address=127.0.0.1 socks_port=$acl_socks_port dns_listen_port=${dns_port} direct_dns_protocol=${direct_dns_protocol} direct_dns_udp_server=${direct_dns} direct_dns_tcp_server=${direct_dns} direct_dns_doh="${direct_dns}" direct_dns_client_ip=${direct_dns_client_ip} direct_dns_query_strategy=${direct_dns_query_strategy} remote_dns_protocol=${remote_dns_protocol} remote_dns_tcp_server=${remote_dns} remote_dns_udp_server=${remote_dns} remote_dns_doh="${remote_dns}" remote_dns_client_ip=${remote_dns_client_ip} remote_fakedns=${remote_fakedns} remote_dns_query_strategy=${remote_dns_query_strategy} config_file=${config_file} ${run_func} flag=acl_$sid node=$node redir_port=$redir_port socks_address=127.0.0.1 socks_port=$acl_socks_port dns_listen_port=${dns_port} direct_dns_protocol=${direct_dns_protocol} direct_dns_udp_server=${direct_dns} direct_dns_tcp_server=${direct_dns} direct_dns_doh="${direct_dns}" direct_dns_client_ip=${direct_dns_client_ip} direct_dns_query_strategy=${direct_dns_query_strategy} remote_dns_protocol=${remote_dns_protocol} remote_dns_tcp_server=${remote_dns} remote_dns_udp_server=${remote_dns} remote_dns_doh="${remote_dns}" remote_dns_client_ip=${remote_dns_client_ip} remote_fakedns=${remote_fakedns} remote_dns_query_strategy=${remote_dns_query_strategy} config_file=${config_file}
fi fi
dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1)) dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1))
@ -1218,6 +1231,9 @@ AUTO_DNS=${DEFAULT_DNS:-119.29.29.29}
PROXY_IPV6=$(config_t_get global_forwarding ipv6_tproxy 0) PROXY_IPV6=$(config_t_get global_forwarding ipv6_tproxy 0)
XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray)
SINGBOX_BIN=$(first_type $(config_t_get global_app singbox_file) sing-box)
export V2RAY_LOCATION_ASSET=$(config_t_get global_rules v2ray_location_asset "/usr/share/v2ray/") export V2RAY_LOCATION_ASSET=$(config_t_get global_rules v2ray_location_asset "/usr/share/v2ray/")
export XRAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET export XRAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET
mkdir -p /tmp/etc $TMP_PATH $TMP_BIN_PATH $TMP_SCRIPT_FUNC_PATH $TMP_ID_PATH $TMP_PORT_PATH $TMP_ROUTE_PATH $TMP_ACL_PATH $TMP_IFACE_PATH $TMP_PATH2 mkdir -p /tmp/etc $TMP_PATH $TMP_BIN_PATH $TMP_SCRIPT_FUNC_PATH $TMP_ID_PATH $TMP_PORT_PATH $TMP_ROUTE_PATH $TMP_ACL_PATH $TMP_IFACE_PATH $TMP_PATH2

View File

@ -859,6 +859,7 @@ flush_ipset() {
for _name in $(ipset list | grep "Name: " | grep "passwall2_" | awk '{print $2}'); do for _name in $(ipset list | grep "Name: " | grep "passwall2_" | awk '{print $2}'); do
destroy_ipset ${_name} destroy_ipset ${_name}
done done
rm -rf /tmp/singbox_passwall2_*
/etc/init.d/passwall2 reload /etc/init.d/passwall2 reload
} }

View File

@ -876,11 +876,10 @@ del_firewall_rule() {
flush_nftset() { flush_nftset() {
del_firewall_rule del_firewall_rule
destroy_nftset $NFTSET_VPSLIST $NFTSET_LANLIST
destroy_nftset $NFTSET_VPSLIST6 $NFTSET_LANLIST6
for _name in $(nft -a list sets | grep -E "passwall2" | awk -F 'set ' '{print $2}' | awk '{print $1}'); do for _name in $(nft -a list sets | grep -E "passwall2" | awk -F 'set ' '{print $2}' | awk '{print $1}'); do
destroy_nftset ${_name} destroy_nftset ${_name}
done done
rm -rf /tmp/singbox_passwall2_*
/etc/init.d/passwall2 reload /etc/init.d/passwall2 reload
} }

View File

@ -23,8 +23,8 @@ uci:revert(appname)
local has_ss = api.is_finded("ss-redir") local has_ss = api.is_finded("ss-redir")
local has_ss_rust = api.is_finded("sslocal") local has_ss_rust = api.is_finded("sslocal")
local has_singbox = api.is_finded("sing-box") local has_singbox = api.finded_com("singbox")
local has_xray = api.is_finded("xray") local has_xray = api.finded_com("xray")
local allowInsecure_default = true local allowInsecure_default = true
local ss_aead_type_default = uci:get(appname, "@global_subscribe[0]", "ss_aead_type") or "shadowsocks-libev" local ss_aead_type_default = uci:get(appname, "@global_subscribe[0]", "ss_aead_type") or "shadowsocks-libev"
-- 判断是否过滤节点关键字 -- 判断是否过滤节点关键字