mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-04 17:23:56 +08:00
update 2026-08-27 00:43:46
This commit is contained in:
1 parent
1bfa02b7c5
commit
f5a34d6fcf
1988 files changed
+833
-1523314
No files matched your search
@@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.8.20
|
||||
PKG_VERSION:=26.8.27
|
||||
PKG_RELEASE:=1
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ function index()
|
||||
entry({"admin", "services", appname, "settings"}, cbi(appname .. "/client/global"), _("Basic Settings"), 1).dependent = true
|
||||
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
|
||||
entry({"admin", "services", appname, "other"}, cbi(appname .. "/client/other"), _("Other Settings"), 92).leaf = true
|
||||
if nixio.fs.access("/usr/sbin/haproxy") then
|
||||
entry({"admin", "services", appname, "haproxy"}, cbi(appname .. "/client/haproxy"), _("Load Balancing"), 93).leaf = true
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local api = require "luci.passwall2.api"
|
||||
local fs = api.fs
|
||||
local uci = api.uci
|
||||
|
||||
local geo_dir = (api.uci_get_c("@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/")
|
||||
local geosite_path = geo_dir .. "/geosite.dat"
|
||||
|
||||
@@ -460,6 +460,7 @@ o.default = "0"
|
||||
o:depends({ custom = false })
|
||||
|
||||
o = s:option(Value, "firewall_allow_src", translate("Source zone"))
|
||||
o.rmempty = false
|
||||
o.nocreate = true
|
||||
o.allowany = true
|
||||
o.default = "wan"
|
||||
|
||||
@@ -478,6 +478,7 @@ o.default = "0"
|
||||
o:depends({ custom = false })
|
||||
|
||||
o = s:option(Value, "firewall_allow_src", translate("Source zone"))
|
||||
o.rmempty = false
|
||||
o.nocreate = true
|
||||
o.allowany = true
|
||||
o.default = "wan"
|
||||
|
||||
@@ -77,6 +77,7 @@ o.default = "0"
|
||||
o:depends({ custom = false })
|
||||
|
||||
o = s:option(Value, "firewall_allow_src", translate("Source zone"))
|
||||
o.rmempty = false
|
||||
o.nocreate = true
|
||||
o.allowany = true
|
||||
o.default = "wan"
|
||||
|
||||
@@ -108,6 +108,7 @@ o.default = "0"
|
||||
o:depends({ custom = false })
|
||||
|
||||
o = s:option(Value, "firewall_allow_src", translate("Source zone"))
|
||||
o.rmempty = false
|
||||
o.nocreate = true
|
||||
o.allowany = true
|
||||
o.default = "wan"
|
||||
|
||||
@@ -1449,17 +1449,9 @@ function set_default_cbi()
|
||||
if not config then config = c_config end
|
||||
default_init(self, config, ...)
|
||||
self.api = require "luci.passwall2.api"
|
||||
end
|
||||
if is_js_luci() == true then
|
||||
local default_parse = Map.parse
|
||||
function Map.parse(self, ...)
|
||||
apply_redirect(self)
|
||||
local old = self.on_after_save
|
||||
self.on_after_save = function(self)
|
||||
if old then old(self) end
|
||||
self:set("@global[0]", "timestamp", os.time())
|
||||
end
|
||||
return default_parse(self, ...)
|
||||
if is_js_luci() == true then
|
||||
self.apply_on_parse = false
|
||||
self.is_js_luci = true
|
||||
end
|
||||
end
|
||||
function Map.foreach(self, stype, func)
|
||||
@@ -1702,34 +1694,6 @@ function format_go_time(input, default)
|
||||
return result
|
||||
end
|
||||
|
||||
function apply_redirect(m)
|
||||
local tmp_uci_file = "/etc/config/" .. c_config .. "_redirect"
|
||||
if m.redirect and m.redirect ~= "" then
|
||||
if fs.access(tmp_uci_file) then
|
||||
local redirect
|
||||
for line in io.lines(tmp_uci_file) do
|
||||
redirect = line:match("option%s+url%s+['\"]([^'\"]+)['\"]")
|
||||
if redirect and redirect ~= "" then break end
|
||||
end
|
||||
if redirect and redirect ~= "" then
|
||||
sys.call("/bin/rm -f " .. tmp_uci_file)
|
||||
luci.http.redirect(redirect)
|
||||
end
|
||||
else
|
||||
fs.writefile(tmp_uci_file, "config redirect\n")
|
||||
end
|
||||
m.on_after_save = function(self)
|
||||
local redirect = self.redirect
|
||||
if redirect and redirect ~= "" then
|
||||
uci:set(c_config .. "_redirect", "@redirect[0]", "url", redirect)
|
||||
end
|
||||
end
|
||||
else
|
||||
uci:revert(c_config .. "_redirect")
|
||||
sys.call("/bin/rm -f " .. tmp_uci_file)
|
||||
end
|
||||
end
|
||||
|
||||
function match_node_rule(name, rule)
|
||||
if not name then return false end
|
||||
if not rule or rule == "" then return true end
|
||||
|
||||
@@ -18,4 +18,46 @@ local map = self.map
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<% if luci.http.formvalue("cbi.apply") == "1" and map.is_js_luci then -%>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("luci-loaded", function() {
|
||||
L.env.apply_display = 2; //Write whatever you want, it's all just a fake progress bar anyway.
|
||||
L.env.apply_holdoff = 1;
|
||||
|
||||
let tt;
|
||||
let flag = 2;
|
||||
if (flag == 1) {
|
||||
L.ui.changes.confirm(false, Date.now() + L.env.apply_rollback * 1000);
|
||||
} else {
|
||||
let ts = Date.now();
|
||||
const deadline = Date.now() + L.env.apply_rollback * 1000;
|
||||
const tick = () => {
|
||||
const now = Date.now();
|
||||
|
||||
L.ui.changes.displayStatus('notice spinning',
|
||||
E('p', _('Applying configuration changes… %ds')
|
||||
.format(Math.max(Math.floor((deadline - Date.now()) / 1000), 0))));
|
||||
|
||||
if (now >= deadline)
|
||||
return;
|
||||
|
||||
tt = window.setTimeout(tick, 1000 - (now - ts));
|
||||
ts = now;
|
||||
};
|
||||
tick();
|
||||
}
|
||||
|
||||
window.setTimeout(() => {
|
||||
<% if not map.redirect then -%>
|
||||
window.clearTimeout(tt);
|
||||
L.ui.changes.displayStatus(false);
|
||||
window.location = window.location.href.split('#')[0];
|
||||
<%- else %>
|
||||
window.location.href = "<%=map.redirect%>";
|
||||
<%- end %>
|
||||
}, (L.env.apply_display + L.env.apply_holdoff) * 1000);
|
||||
});
|
||||
</script>
|
||||
<%- end %>
|
||||
@@ -399,7 +399,7 @@ load_acl() {
|
||||
$ipt_tmp -A PSW2 $(comment "$remarks") ${_ipt_source} -p tcp -j RETURN
|
||||
[ "$_ipv4" != "1" ] && $ip6t_m -A PSW2 $(comment "$remarks") ${_ipt_source} -p tcp -j RETURN 2>/dev/null
|
||||
|
||||
[ -z "$no_tcp_proxy" ] && [ -n "$redir_port" ] && {
|
||||
[ -z "$no_udp_proxy" ] && [ -n "$redir_port" ] && {
|
||||
msg2="${msg}$(i18n "Use the %s node [%s]" "UDP" "${node_remarks}")(TPROXY:${redir_port})"
|
||||
|
||||
$ipt_m -A PSW2 $(comment "$remarks") -p udp ${_ipt_source} -d $FAKE_IP -j PSW2_RULE
|
||||
@@ -544,10 +544,10 @@ load_acl() {
|
||||
$ip6t_m -I OUTPUT $(comment "mangle-OUTPUT-PSW2") -o lo -j RETURN
|
||||
insert_rule_before "$ip6t_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW2) -m mark --mark ${FWMARK} -j RETURN"
|
||||
|
||||
$ipt_m -A PSW2 -p tcp --dport 53 -j ACCEPT
|
||||
$ipt_m -A PSW2 -p udp --dport 53 -j ACCEPT
|
||||
$ip6t_m -A PSW2 -p tcp --dport 53 -j ACCEPT
|
||||
$ip6t_m -A PSW2 -p udp --dport 53 -j ACCEPT
|
||||
$ipt_m -I PSW2 -p tcp --dport 53 -j ACCEPT
|
||||
$ipt_m -I PSW2 -p udp --dport 53 -j ACCEPT
|
||||
$ip6t_m -I PSW2 -p tcp --dport 53 -j ACCEPT
|
||||
$ip6t_m -I PSW2 -p udp --dport 53 -j ACCEPT
|
||||
|
||||
unset msg msg2 comment_l
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ load_acl() {
|
||||
nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp ${_ipt_source} counter return comment \"$remarks\""
|
||||
[ "$_ipv4" != "1" ] && nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto tcp ${_ipt_source} counter return comment \"$remarks\"" 2>/dev/null
|
||||
|
||||
[ -z "$no_tcp_proxy" ] && [ -n "$redir_port" ] && {
|
||||
[ -z "$no_udp_proxy" ] && [ -n "$redir_port" ] && {
|
||||
msg2="${msg}$(i18n "Use the %s node [%s]" "UDP" "${node_remarks}")(TPROXY:${redir_port})"
|
||||
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol udp ${_ipt_source} ip daddr $FAKE_IP counter jump PSW2_RULE comment \"$remarks\""
|
||||
@@ -572,10 +572,10 @@ load_acl() {
|
||||
nft "add rule $NFTABLE_NAME mangle_output oif lo counter return comment \"PSW2_OUTPUT_MANGLE\""
|
||||
nft "add rule $NFTABLE_NAME mangle_output meta mark ${FWMARK} counter return comment \"PSW2_OUTPUT_MANGLE\""
|
||||
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol tcp tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE ip protocol udp udp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto tcp tcp dport 53 counter accept"
|
||||
nft "add rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto udp udp dport 53 counter accept"
|
||||
nft "insert rule $NFTABLE_NAME PSW2_MANGLE ip protocol tcp tcp dport 53 counter accept"
|
||||
nft "insert rule $NFTABLE_NAME PSW2_MANGLE ip protocol udp udp dport 53 counter accept"
|
||||
nft "insert rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto tcp tcp dport 53 counter accept"
|
||||
nft "insert rule $NFTABLE_NAME PSW2_MANGLE_V6 meta l4proto udp udp dport 53 counter accept"
|
||||
|
||||
unset msg msg2 comment_l
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user