mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Sun Nov 16 19:35:42 CET 2025
This commit is contained in:
@@ -85,6 +85,7 @@ function index()
|
||||
entry({"admin", "services", appname, "subscribe_del_all"}, call("subscribe_del_all")).leaf = true
|
||||
entry({"admin", "services", appname, "subscribe_manual"}, call("subscribe_manual")).leaf = true
|
||||
entry({"admin", "services", appname, "subscribe_manual_all"}, call("subscribe_manual_all")).leaf = true
|
||||
entry({"admin", "services", appname, "flush_set"}, call("flush_set")).leaf = true
|
||||
|
||||
--[[Components update]]
|
||||
entry({"admin", "services", appname, "check_passwall2"}, call("app_check")).leaf = true
|
||||
@@ -256,7 +257,8 @@ function index_status()
|
||||
end
|
||||
|
||||
function haproxy_status()
|
||||
local e = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0
|
||||
local e = {}
|
||||
e["status"] = luci.sys.call(string.format("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
@@ -335,6 +337,11 @@ function add_node()
|
||||
local uuid = api.gen_short_uuid()
|
||||
uci:section(appname, "nodes", uuid)
|
||||
|
||||
local group = http.formvalue("group")
|
||||
if group then
|
||||
uci:set(appname, uuid, "group", group)
|
||||
end
|
||||
|
||||
if redirect == "1" then
|
||||
api.uci_save(uci, appname)
|
||||
http.redirect(api.url("node_config", uuid))
|
||||
@@ -765,3 +772,17 @@ function subscribe_manual_all()
|
||||
luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start all manual >/dev/null 2>&1 &")
|
||||
http_write_json({ success = true, msg = "Subscribe triggered." })
|
||||
end
|
||||
|
||||
function flush_set()
|
||||
local redirect = http.formvalue("redirect") or "0"
|
||||
local reload = http.formvalue("reload") or "0"
|
||||
if reload == "1" then
|
||||
uci:set(appname, '@global[0]', "flush_set", "1")
|
||||
api.uci_save(uci, appname, true, true)
|
||||
else
|
||||
api.sh_uci_set(appname, "@global[0]", "flush_set", "1", true)
|
||||
end
|
||||
if redirect == "1" then
|
||||
http.redirect(api.url("log"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -350,16 +350,14 @@ o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translat
|
||||
o.default = "1"
|
||||
o.rmempty = false
|
||||
|
||||
if (m:get("@global_forwarding[0]", "use_nft") or "0") == "1" then
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear NFTSet"), translate("Try this feature if the rule modification does not take effect."))
|
||||
else
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSet"), translate("Try this feature if the rule modification does not take effect."))
|
||||
end
|
||||
o.inputstyle = "remove"
|
||||
function o.write(e, e)
|
||||
m:set("@global[0]", "flush_set", "1")
|
||||
api.uci_save(m.uci, appname, true, true)
|
||||
luci.http.redirect(api.url("log"))
|
||||
local use_nft = m:get("@global_forwarding[0]", "use_nft") == "1"
|
||||
local set_title = api.i18n.translate(use_nft and "Clear NFTSET" or "Clear IPSET")
|
||||
o = s:taboption("DNS", DummyValue, "clear_ipset", set_title, translate("Try this feature if the rule modification does not take effect."))
|
||||
o.rawhtml = true
|
||||
function o.cfgvalue(self, section)
|
||||
return string.format(
|
||||
[[<button type="button" class="cbi-button cbi-button-remove" onclick="location.href='%s'">%s</button>]],
|
||||
api.url("flush_set") .. "?redirect=1&reload=1", set_title)
|
||||
end
|
||||
|
||||
o = s:taboption("DNS", DummyValue, "_xray_node", "")
|
||||
|
||||
@@ -187,7 +187,7 @@ o.validate = function(self, value, section)
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
local old = m:get(section, self.option) or ""
|
||||
if old:lower() ~= value:lower() then
|
||||
if old ~= value then
|
||||
m.uci:foreach(appname, "nodes", function(e)
|
||||
if e["group"] and e["group"]:lower() == old:lower() then
|
||||
m.uci:set(appname, e[".name"], "group", value)
|
||||
|
||||
@@ -93,7 +93,7 @@ o.validate = function(self, value, section)
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
local old = m:get(section, self.option) or ""
|
||||
if old:lower() ~= value:lower() then
|
||||
if old ~= value then
|
||||
m.uci:foreach(appname, "nodes", function(e)
|
||||
if e["group"] and e["group"]:lower() == old:lower() then
|
||||
m.uci:set(appname, e[".name"], "group", value)
|
||||
|
||||
@@ -31,6 +31,13 @@ if api.is_finded("geoview") then
|
||||
.. "<li>" .. translate("Analyzes and preloads GeoIP/Geosite data to enhance the shunt performance of Sing-box/Xray.") .. "</li>"
|
||||
.. "<li>" .. translate("Note: Increases resource usage.") .. "</li>"
|
||||
.. "</ul>"
|
||||
function o.write(self, section, value)
|
||||
local old = m:get(section, self.option) or "0"
|
||||
if old ~= value then
|
||||
m:set(section, "flush_set", "1")
|
||||
end
|
||||
return Flag.write(self, section, value)
|
||||
end
|
||||
end
|
||||
|
||||
s:append(Template(appname .. "/rule/rule_version"))
|
||||
|
||||
@@ -10,6 +10,10 @@ if not arg[1] or not m:get(arg[1]) then
|
||||
luci.http.redirect(m.redirect)
|
||||
end
|
||||
|
||||
function m.on_before_save(self)
|
||||
m:set("@global[0]", "flush_set", "1")
|
||||
end
|
||||
|
||||
-- Add inline CSS to map description
|
||||
m.description = (m.description or "") .. [[
|
||||
<style>
|
||||
@@ -139,7 +143,7 @@ source.write = dynamicList_write
|
||||
|
||||
sourcePort = s:option(Value, "sourcePort", translate("Source port"))
|
||||
|
||||
port = s:option(Value, "port", translate("port"))
|
||||
port = s:option(Value, "port", translate("Port"))
|
||||
|
||||
domain_list = s:option(TextValue, "domain_list", translate("Domain"))
|
||||
domain_list.rows = 10
|
||||
@@ -231,4 +235,6 @@ ip_list.description = "<br /><ul>"
|
||||
.. "<li>" .. translate("Annotation: Begining with #") .. "</li>"
|
||||
.. "</ul>"
|
||||
|
||||
o = s:option(Flag, "invert", "invert", translate("Invert match result.") .. " " .. translate("Only support Sing-Box."))
|
||||
|
||||
return m
|
||||
|
||||
@@ -1143,7 +1143,7 @@ function get_version()
|
||||
if not version or #version == 0 then
|
||||
version = sys.exec("apk list luci-app-passwall2 2>/dev/null | awk '/installed/ {print $1}' | cut -d'-' -f4-")
|
||||
end
|
||||
return version or ""
|
||||
return (version or ""):gsub("\n", "")
|
||||
end
|
||||
|
||||
function to_check_self()
|
||||
|
||||
@@ -1371,6 +1371,7 @@ function gen_config(var)
|
||||
domain_regex = {},
|
||||
geosite = {},
|
||||
rule_set = {},
|
||||
invert = e.invert == "1" and true or nil
|
||||
}
|
||||
string.gsub(e.domain_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
if w:find("#") == 1 then return end
|
||||
@@ -1427,6 +1428,7 @@ function gen_config(var)
|
||||
rule.geoip = #geoip > 0 and geoip or nil
|
||||
end
|
||||
rule.rule_set = #rule_set > 0 and rule_set or nil
|
||||
rule.invert = e.invert == "1" and true or nil
|
||||
|
||||
table.insert(rules, rule)
|
||||
end
|
||||
@@ -1602,6 +1604,7 @@ function gen_config(var)
|
||||
geosite = (value.geosite and #value.geosite > 0) and value.geosite or nil,
|
||||
rule_set = (value.rule_set and #value.rule_set > 0) and value.rule_set or nil,
|
||||
disable_cache = false,
|
||||
invert = value.invert,
|
||||
}
|
||||
if value.outboundTag ~= "block" and value.outboundTag ~= "direct" then
|
||||
dns_rule.server = "remote"
|
||||
|
||||
@@ -111,7 +111,10 @@ local version = {}
|
||||
} else {
|
||||
btn.disabled = true;
|
||||
btn.value = noUpdateText;
|
||||
window['_' + app + '-force_btn'].style.display = "inline";
|
||||
var forceBtn = document.getElementById('_' + app + '-force_btn');
|
||||
if (forceBtn) {
|
||||
forceBtn.style.display = "inline";
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 300);
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
<%
|
||||
local api = require "luci.passwall2.api"
|
||||
local haproxy_enable = api.uci_get_type("global_haproxy", "balancing_enable", "0")
|
||||
local console_port = api.uci_get_type("global_haproxy", "console_port", "")
|
||||
-%>
|
||||
<p id="_status"></p>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=api.url("haproxy_status")%>', null,
|
||||
function(x, result) {
|
||||
if (x && x.status == 200) {
|
||||
var _status = document.getElementById('_status');
|
||||
if (_status) {
|
||||
if (result) {
|
||||
_status.innerHTML = '<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Enter interface%>" onclick="openwebui()" />';
|
||||
} else {
|
||||
_status.innerHTML = '';
|
||||
const haproxy_enable = "<%=haproxy_enable%>";
|
||||
if (haproxy_enable == "1") {
|
||||
function openwebui(){
|
||||
var url = window.location.hostname + ":<%=console_port%>";
|
||||
window.open('http://' + url, 'target', '');
|
||||
}
|
||||
XHR.poll(5, '<%=api.url("haproxy_status")%>', null,
|
||||
function(x, result) {
|
||||
if (x && x.status == 200) {
|
||||
var _status = document.getElementById('_status');
|
||||
if (_status) {
|
||||
if (result.status) {
|
||||
_status.innerHTML = '<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Enter interface%>" onclick="openwebui()" />';
|
||||
} else {
|
||||
_status.innerHTML = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function openwebui(){
|
||||
var url = window.location.hostname + ":<%=console_port%>";
|
||||
window.open('http://' + url, 'target', '');
|
||||
);
|
||||
}
|
||||
//]]></script>
|
||||
|
||||
@@ -191,7 +191,7 @@ local api = require "luci.passwall2.api"
|
||||
</div>
|
||||
<div class="value-custom">
|
||||
<div class="value-field-custom">
|
||||
<label class="value-title-custom"><%:Group Name%></label>
|
||||
<label class="value-title-custom" for="addlink_group_custom"><%:Group Name%></label>
|
||||
<div id="addlink_group_custom" class="custom-dropdown">
|
||||
<div class="selected-display">
|
||||
<span class="text"><%:default%></span>
|
||||
@@ -214,9 +214,8 @@ local api = require "luci.passwall2.api"
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"></label>
|
||||
<div class="cbi-value-field">
|
||||
<div class="pw-toolbar">
|
||||
<div class="pw-toolbar-field">
|
||||
<input class="btn cbi-button cbi-button-add" type="button" onclick="add_new_node()" value="<%:Add%>" />
|
||||
<input class="btn cbi-button cbi-button-add" type="button" onclick="open_add_link_div()" value="<%:Add the node via the link%>" />
|
||||
<input class="btn cbi-button cbi-button-remove" type="button" onclick="clear_all_nodes()" value="<%:Clear all nodes%>" />
|
||||
@@ -229,6 +228,18 @@ local api = require "luci.passwall2.api"
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.pw-toolbar {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pw-toolbar-field {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
padding: 5px 0 5px;
|
||||
}
|
||||
|
||||
#add_link_div {
|
||||
display: none;
|
||||
position: fixed;
|
||||
|
||||
@@ -59,6 +59,31 @@ table td, .table .td {
|
||||
background: #4a90e2 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.td.cbi-section-actions {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.node-wrapper {
|
||||
align-items: center;
|
||||
display: inline-flex !important;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.node-wrapper .cbi-input-checkbox {
|
||||
flex-grow: 0 !important;
|
||||
flex-basis: auto;
|
||||
}
|
||||
|
||||
.cbi-tabmenu > li {
|
||||
margin-right: 2px !important;
|
||||
}
|
||||
|
||||
.cbi-tabmenu > li:last-child {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<% if api.is_js_luci() then -%>
|
||||
@@ -100,6 +125,21 @@ table td, .table .td {
|
||||
return false
|
||||
}
|
||||
</script>
|
||||
<%- else %>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
if (typeof(cbi_t_switch) === "function") {
|
||||
var old_switch = cbi_t_switch;
|
||||
cbi_t_switch = function(section, tab) {
|
||||
var btn = document.getElementById("select_all_btn");
|
||||
if (btn) {
|
||||
dechecked_all_node(btn);
|
||||
}
|
||||
return old_switch(section, tab);
|
||||
};
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<%- end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -159,6 +199,12 @@ table td, .table .td {
|
||||
}
|
||||
}
|
||||
|
||||
function to_add_node() {
|
||||
const dom = document.getElementsByClassName("cbi-tab")[0];
|
||||
const current_group = dom.getAttribute("group_name")
|
||||
window.location.href='<%=api.url("add_node")%>?redirect=1&group=' + current_group;
|
||||
}
|
||||
|
||||
function copy_node(cbi_id) {
|
||||
window.location.href = '<%=api.url("copy_node")%>' + "?section=" + cbi_id;
|
||||
}
|
||||
@@ -475,7 +521,7 @@ table td, .table .td {
|
||||
{{node-tr}}
|
||||
</table>
|
||||
<div class="cbi-section-create cbi-tblsection-create">
|
||||
<input class="cbi-button cbi-button-add" type="button" value="<%:Add%>" onclick="location.href='<%=api.url("add_node")%>?redirect=1'">
|
||||
<input class="cbi-button cbi-button-add" type="button" value="<%:Add%>" onclick="to_add_node()">
|
||||
</div>
|
||||
</fieldset>
|
||||
</script>
|
||||
@@ -490,7 +536,7 @@ table td, .table .td {
|
||||
<td class="td cbi-value-field">{{tcping}}</td>
|
||||
<td class="td cbi-value-field">{{url_test}}</td>
|
||||
<td class="td cbi-section-table-cell nowrap cbi-section-actions">
|
||||
<div>
|
||||
<div class="node-wrapper">
|
||||
<!--It has been damaged and awaits repair or other solutions.-->
|
||||
<!--<input class="btn cbi-button" type="button" value="<%:To Top%>" onclick="_cbi_row_top('{{id}}')"/>-->
|
||||
<input class="cbi-input-checkbox nodes_select" type="checkbox" cbid="{{id}}" />
|
||||
@@ -636,7 +682,7 @@ table td, .table .td {
|
||||
}
|
||||
|
||||
tab_ul_li_html +=
|
||||
'<li id="tab.passwall2.nodes.' + group + '" class="cbi-tab">' +
|
||||
'<li group_name="' + group + '" id="tab.passwall2.nodes.' + group + '" class="cbi-tab">' +
|
||||
'<a onclick="this.blur(); return cbi_t_switch(\'passwall2.nodes\', \'' + group + '\')" href="<%=REQUEST_URI%>?tab.passwall2.nodes=' + group + '">' + group_name + " | " + "<font style='color: red'>" + group_nodes[group].length + '</font></a>' +
|
||||
'</li>'
|
||||
tab_content_html +=
|
||||
|
||||
@@ -178,11 +178,11 @@ msgstr "DNS 重定向"
|
||||
msgid "Force special DNS server to need proxy devices."
|
||||
msgstr "强制需要代理的设备使用专用 DNS 服务器。"
|
||||
|
||||
msgid "Clear IPSet"
|
||||
msgstr "清空 IPSet"
|
||||
msgid "Clear IPSET"
|
||||
msgstr "清空 IPSET"
|
||||
|
||||
msgid "Clear NFTSet"
|
||||
msgstr "清空 NFTSet"
|
||||
msgid "Clear NFTSET"
|
||||
msgstr "清空 NFTSET"
|
||||
|
||||
msgid "Try this feature if the rule modification does not take effect."
|
||||
msgstr "如果修改规则后没有生效,请尝试此功能。"
|
||||
@@ -1114,6 +1114,12 @@ msgstr "预定义域名列表:由'geosite:'开头,余下部分是一个名
|
||||
msgid "Annotation: Begining with #"
|
||||
msgstr "注释: 由 # 开头"
|
||||
|
||||
msgid "Invert match result."
|
||||
msgstr "反选匹配结果。"
|
||||
|
||||
msgid "Only support Sing-Box."
|
||||
msgstr "只支持 Sing-Box。"
|
||||
|
||||
msgid "IP: such as '127.0.0.1'."
|
||||
msgstr "IP: 形如'127.0.0.1'。"
|
||||
|
||||
|
||||
@@ -178,11 +178,11 @@ msgstr "DNS 重定向"
|
||||
msgid "Force special DNS server to need proxy devices."
|
||||
msgstr "强制需要代理的設備使用专用 DNS 服務器。"
|
||||
|
||||
msgid "Clear IPSet"
|
||||
msgstr "清空 IPSet"
|
||||
msgid "Clear IPSET"
|
||||
msgstr "清空 IPSET"
|
||||
|
||||
msgid "Clear NFTSet"
|
||||
msgstr "清空 NFTSet"
|
||||
msgid "Clear NFTSET"
|
||||
msgstr "清空 NFTSET"
|
||||
|
||||
msgid "Try this feature if the rule modification does not take effect."
|
||||
msgstr "如果修改規則後没有生效,请尝試此功能。"
|
||||
@@ -1114,6 +1114,12 @@ msgstr "预定义域名列表:由'geosite:'開头,余下部分是一个名
|
||||
msgid "Annotation: Begining with #"
|
||||
msgstr "注释: 由 # 開头"
|
||||
|
||||
msgid "Invert match result."
|
||||
msgstr "反選匹配結果。"
|
||||
|
||||
msgid "Only support Sing-Box."
|
||||
msgstr "只支持 Sing-Box。"
|
||||
|
||||
msgid "IP: such as '127.0.0.1'."
|
||||
msgstr "IP: 形如'127.0.0.1'。"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user