🍓 Sync 2025-11-12 00:12:28
This commit is contained in:
@@ -6,17 +6,14 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[status]])%>', nu
|
|||||||
if (data && tb) {
|
if (data && tb) {
|
||||||
if (data.running) {
|
if (data.running) {
|
||||||
tb.innerHTML = '<em><b style=color:green>AdGuardHome <%:RUNNING%></b></em>';
|
tb.innerHTML = '<em><b style=color:green>AdGuardHome <%:RUNNING%></b></em>';
|
||||||
} else {
|
|
||||||
tb.innerHTML = '<em><b style=color:red>AdGuardHome <%:NOT RUNNING%></b></em>';
|
|
||||||
}
|
|
||||||
if (data.redirect)
|
|
||||||
{
|
|
||||||
URL = window.location.protocol.toLowerCase() + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get("AdGuardHome", "AdGuardHome", "httpport") %>";
|
URL = window.location.protocol.toLowerCase() + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get("AdGuardHome", "AdGuardHome", "httpport") %>";
|
||||||
tb.innerHTML+='<em> <b style=color:green><%:Redirected%></b> </em> '
|
tb.innerHTML+='<em> <b style=color:green><%:Redirected%></b> </em> '
|
||||||
tb.innerHTML += "<input class=\"cbi-button cbi-button-reload \" type=\"button\" value=\" <%: Open Web Interface%>\" onclick=\"window.open('"+URL+"')\"/>";
|
tb.innerHTML += "<input class=\"cbi-button cbi-button-reload \" type=\"button\" value=\" <%: Open Web Interface%>\" onclick=\"window.open('"+URL+"')\"/>";
|
||||||
} else {
|
} else {
|
||||||
|
tb.innerHTML = '<em><b style=color:red>AdGuardHome <%:NOT RUNNING%></b></em>';
|
||||||
tb.innerHTML+='<em><b style=color:red><%:Not redirect%></b></em>'
|
tb.innerHTML+='<em><b style=color:red><%:Not redirect%></b></em>'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ USE_PROCD=1
|
|||||||
START=95
|
START=95
|
||||||
STOP=01
|
STOP=01
|
||||||
|
|
||||||
ipt=$(command -v iptables-legacy || command -v iptables)
|
|
||||||
ip6t=$(command -v ip6tables-legacy || command -v ip6tables)
|
|
||||||
bin_nft=$(command -v nft || which nft)
|
|
||||||
CONFIGURATION=AdGuardHome
|
CONFIGURATION=AdGuardHome
|
||||||
CRON_FILE=/etc/crontabs/root
|
CRON_FILE=/etc/crontabs/root
|
||||||
GFWSET="gfwlist"
|
GFWSET="gfwlist"
|
||||||
@@ -20,39 +17,39 @@ EXTRA_HELP=" do_redirect 0 or 1\
|
|||||||
|
|
||||||
set_forward_dnsmasq()
|
set_forward_dnsmasq()
|
||||||
{
|
{
|
||||||
local PORT="$1"
|
addr="127.0.0.1#$AdGuardHome_PORT"
|
||||||
addr="127.0.0.1#$PORT"
|
OLD_SERVER="$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)"
|
||||||
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
|
||||||
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
|
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
|
||||||
uci add_list dhcp.@dnsmasq[0].server=$addr
|
uci add_list dhcp.@dnsmasq[0].server="$addr"
|
||||||
for server in $OLD_SERVER; do
|
for server in $OLD_SERVER; do
|
||||||
if [ "$server" = "$addr" ]; then
|
if [ "$server" = "$addr" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# uci add_list dhcp.@dnsmasq[0].server=$server
|
uci add_list dhcp.@dnsmasq[0].server=$server
|
||||||
done
|
done
|
||||||
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
|
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
|
||||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||||
uci commit dhcp
|
uci commit dhcp
|
||||||
/etc/init.d/dnsmasq restart
|
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_forward_dnsmasq()
|
stop_forward_dnsmasq()
|
||||||
{
|
{
|
||||||
local OLD_PORT="$1"
|
local OLD_PORT="$1"
|
||||||
addr="127.0.0.1#$OLD_PORT"
|
addr="127.0.0.1#$OLD_PORT"
|
||||||
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
OLD_SERVER="$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)"
|
||||||
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
|
uci del_list dhcp.@dnsmasq[0].server="$addr" 2>/dev/null
|
||||||
addrlist="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
|
|
||||||
|
addrlist="$(uci get dhcp.@dnsmasq[0].server 2>/dev/null)"
|
||||||
if [ -z "$addrlist" ]; then
|
if [ -z "$addrlist" ]; then
|
||||||
resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
|
resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
|
||||||
[ ! -f "$resolvfile" ] && resolvfile="/tmp/resolv.conf.auto"
|
[ ! -f "$resolvfile" ] && resolvfile="/tmp/resolv.conf.auto"
|
||||||
@@ -60,7 +57,7 @@ stop_forward_dnsmasq()
|
|||||||
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
|
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
|
||||||
fi
|
fi
|
||||||
uci commit dhcp
|
uci commit dhcp
|
||||||
/etc/init.d/dnsmasq restart
|
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
set_firewall()
|
set_firewall()
|
||||||
@@ -453,7 +450,7 @@ start_service() {
|
|||||||
procd_set_param file "$configpath" "/etc/hosts" "/etc/config/AdGuardHome"
|
procd_set_param file "$configpath" "/etc/hosts" "/etc/config/AdGuardHome"
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
if [ -f "$configpath" ]; then
|
if [ -f "$configpath" ]; then
|
||||||
_do_redirect 1
|
(sleep 5 && _do_redirect 1) &
|
||||||
else
|
else
|
||||||
_do_redirect 0
|
_do_redirect 0
|
||||||
config_get "redirect" $CONFIGURATION "redirect" "none"
|
config_get "redirect" $CONFIGURATION "redirect" "none"
|
||||||
@@ -465,13 +462,7 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "AdGuardHome service enabled"
|
echo "AdGuardHome service enabled"
|
||||||
# echo "luci enable switch=$enabled"
|
|
||||||
(sleep 10 && [ -z "$(pgrep $binpath)" ] && logger "AdGuardHome" "no process in 10s cancel redirect" && _do_redirect 0 )&
|
|
||||||
if [[ "`uci -q get bypass.@global[0].global_server`" && "`uci -q get bypass.@global[0].adguardhome 2>/dev/null`" == 1 && "$(uci -q get dhcp.@dnsmasq[0].port)" == "53" ]]; then
|
|
||||||
uci -q set AdGuardHome.AdGuardHome.redirect='exchange'
|
|
||||||
uci commit AdGuardHome
|
|
||||||
do_redirect 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_service()
|
reload_service()
|
||||||
@@ -574,6 +565,7 @@ do_crontab(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
crontab_editor(){
|
crontab_editor(){
|
||||||
|
[ ! -f "$CRON_FILE" ] && mkdir -p ${CRON_FILE%/*} && touch "$CRON_FILE" && chmod 600 "$CRON_FILE"
|
||||||
#usage input:
|
#usage input:
|
||||||
#findstr=
|
#findstr=
|
||||||
#default=
|
#default=
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ o.description = desc .. "</ul>"
|
|||||||
o:depends({dns_shunt = "dnsmasq", tcp_proxy_mode = "proxy", chn_list = "direct"})
|
o:depends({dns_shunt = "dnsmasq", tcp_proxy_mode = "proxy", chn_list = "direct"})
|
||||||
|
|
||||||
for k, v in pairs(nodes_table) do
|
for k, v in pairs(nodes_table) do
|
||||||
if v.protocol and v.protocol ~= "_shunt" then
|
if v.protocol ~= "_shunt" then
|
||||||
s.fields["dns_mode"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
s.fields["dns_mode"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -778,7 +778,7 @@ for k, v in pairs(nodes_table) do
|
|||||||
s2.fields["node"]:value(v.id, v["remark"])
|
s2.fields["node"]:value(v.id, v["remark"])
|
||||||
end
|
end
|
||||||
|
|
||||||
if v.protocol and v.protocol ~= "_shunt" then
|
if v.protocol ~= "_shunt" then
|
||||||
s.fields["dns_mode"]:depends({ dns_shunt = "chinadns-ng", tcp_node = v.id })
|
s.fields["dns_mode"]:depends({ dns_shunt = "chinadns-ng", tcp_node = v.id })
|
||||||
s.fields["dns_mode"]:depends({ dns_shunt = "dnsmasq", tcp_node = v.id })
|
s.fields["dns_mode"]:depends({ dns_shunt = "dnsmasq", tcp_node = v.id })
|
||||||
if api.is_finded("smartdns") then
|
if api.is_finded("smartdns") then
|
||||||
|
|||||||
@@ -35,6 +35,21 @@ end)
|
|||||||
for k, v in pairs(groups) do
|
for k, v in pairs(groups) do
|
||||||
o:value(k)
|
o:value(k)
|
||||||
end
|
end
|
||||||
|
o.write = function(self, section, value)
|
||||||
|
value = api.trim(value)
|
||||||
|
local lower = value:lower()
|
||||||
|
|
||||||
|
if lower == "" or lower == "default" then
|
||||||
|
return m:del(section, self.option)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, v in ipairs(self.keylist or {}) do
|
||||||
|
if v:lower() == lower then
|
||||||
|
return m:set(section, self.option, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
m:set(section, self.option, value)
|
||||||
|
end
|
||||||
|
|
||||||
o = s:option(ListValue, "type", translate("Type"))
|
o = s:option(ListValue, "type", translate("Type"))
|
||||||
|
|
||||||
|
|||||||
@@ -163,19 +163,33 @@ end
|
|||||||
o = s:option(Value, "remark", translate("Remarks"))
|
o = s:option(Value, "remark", translate("Remarks"))
|
||||||
o.width = "auto"
|
o.width = "auto"
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
o.validate = function(self, value, t)
|
o.validate = function(self, value, section)
|
||||||
if value then
|
value = api.trim(value)
|
||||||
local count = 0
|
if value == "" then
|
||||||
|
return nil, translate("Remark cannot be empty.")
|
||||||
|
end
|
||||||
|
local duplicate = false
|
||||||
m.uci:foreach(appname, "subscribe_list", function(e)
|
m.uci:foreach(appname, "subscribe_list", function(e)
|
||||||
if e[".name"] ~= t and e["remark"] == value then
|
if e[".name"] ~= section and e["remark"] and e["remark"]:lower() == value:lower() then
|
||||||
count = count + 1
|
duplicate = true
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if count > 0 then
|
if duplicate or value:lower() == "default" then
|
||||||
return nil, translate("This remark already exists, please change a new remark.")
|
return nil, translate("This remark already exists, please change a new remark.")
|
||||||
end
|
end
|
||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
|
o.write = function(self, section, value)
|
||||||
|
local old = m:get(section, self.option) or ""
|
||||||
|
if old:lower() ~= value:lower() 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)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return Value.write(self, section, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
o = s:option(DummyValue, "_node_count", translate("Subscribe Info"))
|
o = s:option(DummyValue, "_node_count", translate("Subscribe Info"))
|
||||||
|
|||||||
@@ -79,13 +79,41 @@ end
|
|||||||
|
|
||||||
o = s:option(Value, "remark", translate("Subscribe Remark"))
|
o = s:option(Value, "remark", translate("Subscribe Remark"))
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
o.validate = function(self, value, section)
|
||||||
|
value = api.trim(value)
|
||||||
|
if value == "" then
|
||||||
|
return nil, translate("Remark cannot be empty.")
|
||||||
|
end
|
||||||
|
local duplicate = false
|
||||||
|
m.uci:foreach(appname, "subscribe_list", function(e)
|
||||||
|
if e[".name"] ~= section and e["remark"] and e["remark"]:lower() == value:lower() then
|
||||||
|
duplicate = true
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
if duplicate or value:lower() == "default" then
|
||||||
|
return nil, translate("This remark already exists, please change a new remark.")
|
||||||
|
end
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
o.write = function(self, section, value)
|
||||||
|
local old = m:get(section, self.option) or ""
|
||||||
|
if old:lower() ~= value:lower() 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)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return Value.write(self, section, value)
|
||||||
|
end
|
||||||
|
|
||||||
o = s:option(TextValue, "url", translate("Subscribe URL"))
|
o = s:option(TextValue, "url", translate("Subscribe URL"))
|
||||||
o.rows = 5
|
o.rows = 5
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
o.validate = function(self, value)
|
o.validate = function(self, value)
|
||||||
if not value or value == "" then
|
if not value or value == "" then
|
||||||
return nil, translate("URL cannot be empty")
|
return nil, translate("URL cannot be empty.")
|
||||||
end
|
end
|
||||||
return value:gsub("%s+", ""):gsub("%z", "")
|
return value:gsub("%s+", ""):gsub("%z", "")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ if has_xray or has_singbox then
|
|||||||
function o.write(self, section, value)
|
function o.write(self, section, value)
|
||||||
local old = m:get(section, self.option) or "0"
|
local old = m:get(section, self.option) or "0"
|
||||||
if old ~= value then
|
if old ~= value then
|
||||||
m:set(section, "flush_set", "1")
|
m:set("@global[0]", "flush_set", "1")
|
||||||
end
|
end
|
||||||
return Flag.write(self, section, value)
|
return Flag.write(self, section, value)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1155,7 +1155,7 @@ function to_check_self()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
local local_version = get_version()
|
local local_version = get_version()
|
||||||
local remote_version = sys.exec("echo -n $(grep 'PKG_VERSION' /tmp/passwall_makefile|awk -F '=' '{print $2}')")
|
local remote_version = sys.exec("echo -n $(grep '^PKG_VERSION' /tmp/passwall_makefile | head -n 1 | awk -F '=' '{print $2}')")
|
||||||
exec("/bin/rm", {"-f", tmp_file})
|
exec("/bin/rm", {"-f", tmp_file})
|
||||||
|
|
||||||
local has_update = compare_versions(local_version, "<", remote_version)
|
local has_update = compare_versions(local_version, "<", remote_version)
|
||||||
|
|||||||
@@ -126,8 +126,16 @@ local api = require "luci.passwall.api"
|
|||||||
var val = input.value.trim();
|
var val = input.value.trim();
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
|
|
||||||
|
if (val.toLowerCase() === "default") {
|
||||||
|
var emptyLi = Array.from(list.querySelectorAll(".dropdown-item"))
|
||||||
|
.find(function(el){ return !el.dataset.value; });
|
||||||
|
if (emptyLi) selectItem(emptyLi);
|
||||||
|
input.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var li = Array.from(list.querySelectorAll(".dropdown-item")).find(function(el){
|
var li = Array.from(list.querySelectorAll(".dropdown-item")).find(function(el){
|
||||||
return el.dataset.value === val;
|
return el.dataset.value.toLowerCase() === val.toLowerCase();
|
||||||
});
|
});
|
||||||
if (!li) {
|
if (!li) {
|
||||||
li = document.createElement("li");
|
li = document.createElement("li");
|
||||||
@@ -212,7 +220,7 @@ local api = require "luci.passwall.api"
|
|||||||
<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-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%>" />
|
<input class="btn cbi-button cbi-button-remove" type="button" onclick="clear_all_nodes()" value="<%:Clear all nodes%>" />
|
||||||
<input class="btn cbi-button cbi-button-remove" type="button" onclick="delete_select_nodes()" value="<%:Delete select nodes%>" />
|
<input class="btn cbi-button cbi-button-remove" type="button" onclick="delete_select_nodes()" value="<%:Delete select nodes%>" />
|
||||||
<input class="btn cbi-button" type="button" id="select_all_btn" onclick="checked_all_node(this)" value="<%:Select all%>" />
|
<input class="btn cbi-button cbi-button-edit" type="button" id="select_all_btn" onclick="checked_all_node(this)" value="<%:Select all%>" />
|
||||||
<input class="btn cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:Save & Apply%>" />
|
<input class="btn cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:Save & Apply%>" />
|
||||||
<input class="btn cbi-button cbi-button-save" type="submit" name="cbi.save" value="<%:Save%>" />
|
<input class="btn cbi-button cbi-button-save" type="submit" name="cbi.save" value="<%:Save%>" />
|
||||||
<input class="btn cbi-button cbi-button-reset" type="button" value="<%:Reset%>" onclick="location.href='<%=REQUEST_URI%>'" />
|
<input class="btn cbi-button cbi-button-reset" type="button" value="<%:Reset%>" onclick="location.href='<%=REQUEST_URI%>'" />
|
||||||
|
|||||||
@@ -1114,6 +1114,12 @@ msgstr "手动订阅全部"
|
|||||||
msgid "This remark already exists, please change a new remark."
|
msgid "This remark already exists, please change a new remark."
|
||||||
msgstr "此备注已存在,请改一个新的备注。"
|
msgstr "此备注已存在,请改一个新的备注。"
|
||||||
|
|
||||||
|
msgid "Remark cannot be empty."
|
||||||
|
msgstr "备注不能为空。"
|
||||||
|
|
||||||
|
msgid "URL cannot be empty."
|
||||||
|
msgstr "网址不能为空。"
|
||||||
|
|
||||||
msgid "Filter keyword Mode"
|
msgid "Filter keyword Mode"
|
||||||
msgstr "过滤关键字模式"
|
msgstr "过滤关键字模式"
|
||||||
|
|
||||||
|
|||||||
@@ -1546,7 +1546,7 @@ local function truncate_nodes(group)
|
|||||||
local removeNodesSet = {}
|
local removeNodesSet = {}
|
||||||
for k, v in pairs(config.currentNodes) do
|
for k, v in pairs(config.currentNodes) do
|
||||||
if v.currentNode and v.currentNode.add_mode == "2" then
|
if v.currentNode and v.currentNode.add_mode == "2" then
|
||||||
if (not group) or (group and group == v.currentNode.group) then
|
if (not group) or (group:lower() == (v.currentNode.group or ""):lower()) then
|
||||||
removeNodesSet[v.currentNode[".name"]] = true
|
removeNodesSet[v.currentNode[".name"]] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1561,7 +1561,7 @@ local function truncate_nodes(group)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if config.currentNode and config.currentNode.add_mode == "2" then
|
if config.currentNode and config.currentNode.add_mode == "2" then
|
||||||
if (not group) or (group and group == config.currentNode.group) then
|
if (not group) or (group:lower() == (config.currentNode.group or ""):lower()) then
|
||||||
if config.delete then
|
if config.delete then
|
||||||
config.delete(config)
|
config.delete(config)
|
||||||
elseif config.set then
|
elseif config.set then
|
||||||
@@ -1573,13 +1573,13 @@ local function truncate_nodes(group)
|
|||||||
end
|
end
|
||||||
uci:foreach(appname, "nodes", function(node)
|
uci:foreach(appname, "nodes", function(node)
|
||||||
if node.add_mode == "2" then
|
if node.add_mode == "2" then
|
||||||
if (not group) or (group and group == node.group) then
|
if (not group) or (group:lower() == (node.group or ""):lower()) then
|
||||||
uci:delete(appname, node['.name'])
|
uci:delete(appname, node['.name'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
uci:foreach(appname, "subscribe_list", function(o)
|
uci:foreach(appname, "subscribe_list", function(o)
|
||||||
if (not group) or group == o.remark then
|
if (not group) or (group:lower() == (o.remark or ""):lower()) then
|
||||||
uci:delete(appname, o['.name'], "md5")
|
uci:delete(appname, o['.name'], "md5")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -1714,13 +1714,13 @@ local function update_node(manual)
|
|||||||
|
|
||||||
local group = {}
|
local group = {}
|
||||||
for _, v in ipairs(nodeResult) do
|
for _, v in ipairs(nodeResult) do
|
||||||
group[v["remark"]] = true
|
group[v["remark"]:lower()] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if manual == 0 and next(group) then
|
if manual == 0 and next(group) then
|
||||||
uci:foreach(appname, "nodes", function(node)
|
uci:foreach(appname, "nodes", function(node)
|
||||||
-- 如果未发现新节点或手动导入的节点就不要删除了...
|
-- 如果未发现新节点或手动导入的节点就不要删除了...
|
||||||
if node.add_mode == "2" and (node.group and group[node.group] == true) then
|
if node.add_mode == "2" and (node.group and group[node.group:lower()] == true) then
|
||||||
uci:delete(appname, node['.name'])
|
uci:delete(appname, node['.name'])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ LUCI_DEPENDS:=+curl +opkg +luci-lib-ipkg +tar +libuci-lua +mount-utils +luci-lib
|
|||||||
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.19)
|
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.19)
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
PKG_VERSION:=0.1.29-6
|
PKG_VERSION:=0.1.30-1
|
||||||
# PKG_RELEASE MUST be empty for luci.mk
|
# PKG_RELEASE MUST be empty for luci.mk
|
||||||
PKG_RELEASE:=
|
PKG_RELEASE:=
|
||||||
|
|
||||||
ISTORE_UI_VERSION:=0.1.28
|
ISTORE_UI_VERSION:=0.1.30
|
||||||
ISTORE_UI_RELEASE:=3
|
ISTORE_UI_RELEASE:=1
|
||||||
PKG_HASH:=5097082a9d0821ff23f468f20c7ba9f635a9cb52eeac8b155a55b3441741d260
|
PKG_HASH:=74a9732e78351b0a78596a67410bafd838678e047a11dfdf3d40ab9d7ce65a78
|
||||||
|
|
||||||
PKG_SOURCE_URL_FILE:=v$(ISTORE_UI_VERSION)-$(ISTORE_UI_RELEASE).tar.gz
|
PKG_SOURCE_URL_FILE:=v$(ISTORE_UI_VERSION)-$(ISTORE_UI_RELEASE).tar.gz
|
||||||
PKG_SOURCE:=istore-ui-$(PKG_SOURCE_URL_FILE)
|
PKG_SOURCE:=istore-ui-$(PKG_SOURCE_URL_FILE)
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ function index()
|
|||||||
entry({"admin", "store", "log"}, call("store_log"))
|
entry({"admin", "store", "log"}, call("store_log"))
|
||||||
entry({"admin", "store", "uid"}, call("action_user_id"))
|
entry({"admin", "store", "uid"}, call("action_user_id"))
|
||||||
entry({"admin", "store", "upload"}, post("store_upload"))
|
entry({"admin", "store", "upload"}, post("store_upload"))
|
||||||
|
entry({"admin", "store", "del_record"}, post("store_del_record"))
|
||||||
|
entry({"admin", "store", "unrun"}, post("store_unrun"))
|
||||||
|
entry({"admin", "store", "run_records"}, call("store_run_records"))
|
||||||
|
|
||||||
entry({"admin", "store", "check_self_upgrade"}, call("check_self_upgrade"))
|
entry({"admin", "store", "check_self_upgrade"}, call("check_self_upgrade"))
|
||||||
entry({"admin", "store", "do_self_upgrade"}, post("do_self_upgrade"))
|
entry({"admin", "store", "do_self_upgrade"}, post("do_self_upgrade"))
|
||||||
entry({"admin", "store", "toggle_docker"}, post("toggle_docker"))
|
entry({"admin", "store", "toggle_docker"}, post("toggle_docker"))
|
||||||
@@ -435,11 +439,7 @@ function store_upload()
|
|||||||
local code, out, err
|
local code, out, err
|
||||||
out = ""
|
out = ""
|
||||||
if finished then
|
if finished then
|
||||||
if string.lower(string.sub(path, -4, -1)) == ".run" then
|
code, out, err = _action(myopkg, "dotrun", path)
|
||||||
code, out, err = _action("sh", "-c", "ls -l \"%s\"; md5sum \"%s\" 2>/dev/null; chmod 755 \"%s\" && \"%s\"; RET=$?; rm -f \"%s\"; exit $RET" %{ path, path, path, path, path })
|
|
||||||
else
|
|
||||||
code, out, err = _action("sh", "-c", "opkg install \"%s\"; RET=$?; rm -f \"%s\"; exit $RET" %{ path, path })
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
code = 500
|
code = 500
|
||||||
err = "upload failed!"
|
err = "upload failed!"
|
||||||
@@ -454,6 +454,46 @@ function store_upload()
|
|||||||
luci.http.write_json(ret)
|
luci.http.write_json(ret)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function store_unrun()
|
||||||
|
local record_id = luci.http.formvalue("id")
|
||||||
|
if record_id == nil or record_id == "" then
|
||||||
|
luci.http.status(400, "Bad Request")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local code, out, err = _action(myopkg, "unrun", record_id)
|
||||||
|
local ret = {
|
||||||
|
code = code,
|
||||||
|
stdout = out,
|
||||||
|
stderr = err
|
||||||
|
}
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(ret)
|
||||||
|
end
|
||||||
|
|
||||||
|
function store_run_records()
|
||||||
|
local util = require "luci.util"
|
||||||
|
local run_records = util.exec(myopkg .. " run_records")
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write("{\n\"code\":200,\n\"records\":")
|
||||||
|
luci.http.write(run_records)
|
||||||
|
luci.http.write("\n}\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
function store_del_record()
|
||||||
|
local nixio = require "nixio"
|
||||||
|
local os = require "os"
|
||||||
|
local rshift = nixio.bit.rshift
|
||||||
|
|
||||||
|
local record_id = luci.http.formvalue("id")
|
||||||
|
if record_id == nil or record_id == "" then
|
||||||
|
luci.http.status(400, "Bad Request")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local r = os.execute(myopkg.." del_record "..luci.util.shellquote(record_id).." >/dev/null 2>&1")
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json({code=rshift(r,8)})
|
||||||
|
end
|
||||||
|
|
||||||
function configured()
|
function configured()
|
||||||
local uci = luci.http.formvalue("uci")
|
local uci = luci.http.formvalue("uci")
|
||||||
if not validate_pkgname(uci) then
|
if not validate_pkgname(uci) then
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ ISTORE_PKG=luci-app-store
|
|||||||
ISTORE_DEP_PKGS="luci-lib-taskd luci-lib-xterm taskd"
|
ISTORE_DEP_PKGS="luci-lib-taskd luci-lib-xterm taskd"
|
||||||
ISTORE_INDEX=https://istore.istoreos.com/repo/all/store/Packages.gz
|
ISTORE_INDEX=https://istore.istoreos.com/repo/all/store/Packages.gz
|
||||||
|
|
||||||
|
NEWLINE=$'\n'
|
||||||
|
|
||||||
is_init() {
|
is_init() {
|
||||||
mkdir -p ${DL_DIR} ${LISTS_DIR} ${IS_ROOT}/etc ${IS_ROOT}/var
|
mkdir -p ${DL_DIR} ${LISTS_DIR} ${IS_ROOT}/etc ${IS_ROOT}/var
|
||||||
|
|
||||||
@@ -231,6 +233,87 @@ try_upgrade_depends() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMD_INSTALLED="opkg list-installed | cut -d' ' -f1 | sort -u"
|
||||||
|
dotrun() {
|
||||||
|
local path="$1"
|
||||||
|
[ -f "$path" ] || { echo "file not found: $path" >&2; return 1; }
|
||||||
|
ls -l "$path"
|
||||||
|
local md5=$(md5sum "$path" 2>/dev/null | cut -d' ' -f1)
|
||||||
|
local ts=$(date '+%s')
|
||||||
|
#local date=$(date '+%Y-%m-%d_%H-%M-%S')
|
||||||
|
echo "MD5: $md5"
|
||||||
|
echo "Save installed pkg list before installing"
|
||||||
|
sh -c "$CMD_INSTALLED" > "/tmp/is-root/tmp/pre_$md5.txt"
|
||||||
|
if echo "$path" | grep -q '\.run$'; then
|
||||||
|
echo "Executing .run file"
|
||||||
|
chmod 0755 "$path" && "$path"
|
||||||
|
else
|
||||||
|
echo "Installing .ipk file"
|
||||||
|
opkg install "$path"
|
||||||
|
fi
|
||||||
|
local RET=$?
|
||||||
|
rm -f "$path"
|
||||||
|
if [ -s "/tmp/is-root/tmp/pre_$md5.txt" ]; then
|
||||||
|
echo "Save installed pkg list after installing"
|
||||||
|
sh -c "$CMD_INSTALLED" > "/tmp/is-root/tmp/post_$md5.txt"
|
||||||
|
grep -Fxf "/tmp/is-root/tmp/pre_$md5.txt" -v "/tmp/is-root/tmp/post_$md5.txt" > "/tmp/is-root/tmp/added_$md5.txt"
|
||||||
|
if [ -s "/tmp/is-root/tmp/added_$md5.txt" ]; then
|
||||||
|
echo "The following packages were added:"
|
||||||
|
cat "/tmp/is-root/tmp/added_$md5.txt"
|
||||||
|
mkdir -p /usr/share/istore/run-records
|
||||||
|
path="${path##*/}"
|
||||||
|
path="${path//\\/\\\\}" #\
|
||||||
|
path="${path//\"/\\\"}" #"
|
||||||
|
path="${path//$NEWLINE/\\n}" # \n
|
||||||
|
path="${path//^M/\\r}" # \r
|
||||||
|
echo "{\"id\":\"$ts-$md5\",\"ts\":$ts,\"md5\":\"$md5\",\"file\":\"$path\"}" > /usr/share/istore/run-records/$ts-$md5.txt
|
||||||
|
cat "/tmp/is-root/tmp/added_$md5.txt" >> /usr/share/istore/run-records/$ts-$md5.txt
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f "/tmp/is-root/tmp/pre_$md5.txt" "/tmp/is-root/tmp/post_$md5.txt" "/tmp/is-root/tmp/added_$md5.txt"
|
||||||
|
return $RET
|
||||||
|
}
|
||||||
|
|
||||||
|
run_records() {
|
||||||
|
local record
|
||||||
|
local file
|
||||||
|
echo "["
|
||||||
|
for record in /usr/share/istore/run-records/*.txt; do
|
||||||
|
[ -f "$record" ] || continue
|
||||||
|
echo "`head -1 "$record"`,"
|
||||||
|
done | head -c -2
|
||||||
|
echo ""
|
||||||
|
echo "]"
|
||||||
|
}
|
||||||
|
|
||||||
|
unrun() {
|
||||||
|
local id="$1"
|
||||||
|
[ -s "/usr/share/istore/run-records/$id.txt" ] || { echo "record not found: $id" >&2; return 1; }
|
||||||
|
echo "The following packages will be removed:"
|
||||||
|
tail -n +2 "/usr/share/istore/run-records/$id.txt" > "/tmp/is-root/tmp/to_unrun_$id.txt"
|
||||||
|
cat "/tmp/is-root/tmp/to_unrun_$id.txt"
|
||||||
|
local round max_round=6
|
||||||
|
for round in `seq 1 $max_round`; do
|
||||||
|
if [ $round == $max_round ]; then
|
||||||
|
opkg --autoremove remove `cat "/tmp/is-root/tmp/to_unrun_$id.txt"`
|
||||||
|
else
|
||||||
|
opkg --autoremove remove `cat "/tmp/is-root/tmp/to_unrun_$id.txt"` 2>/dev/null && break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
sh -c "$CMD_INSTALLED" > "/tmp/is-root/tmp/post_unrun_$id.txt"
|
||||||
|
grep -Fxf "/tmp/is-root/tmp/post_unrun_$id.txt" "/tmp/is-root/tmp/to_unrun_$id.txt" > "/tmp/is-root/tmp/remain_unrun_$id.txt"
|
||||||
|
if [ -s "/tmp/is-root/tmp/remain_unrun_$id.txt" ]; then
|
||||||
|
echo "The following packages failed to be removed:"
|
||||||
|
cat "/tmp/is-root/tmp/remain_unrun_$id.txt"
|
||||||
|
else
|
||||||
|
echo "All packages removed successfully."
|
||||||
|
rm -f "/usr/share/istore/run-records/$id.txt"
|
||||||
|
fi
|
||||||
|
rm -f "/tmp/is-root/tmp/to_unrun_$id.txt" "/tmp/is-root/tmp/post_unrun_$id.txt" "/tmp/is-root/tmp/remain_unrun_$id.txt"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: is-opkg sub-command [arguments...]"
|
echo "usage: is-opkg sub-command [arguments...]"
|
||||||
echo "where sub-command is one of:"
|
echo "where sub-command is one of:"
|
||||||
@@ -244,6 +327,11 @@ usage() {
|
|||||||
echo " do_self_upgrade Upgrade iStore"
|
echo " do_self_upgrade Upgrade iStore"
|
||||||
echo " arch Show libc architecture"
|
echo " arch Show libc architecture"
|
||||||
echo " opkg sys opkg wrap"
|
echo " opkg sys opkg wrap"
|
||||||
|
echo " dotrun {path} install .run/.ipk"
|
||||||
|
echo " run_records list .run/.ipk install records"
|
||||||
|
echo " del_record {id} delete .run/.ipk install record"
|
||||||
|
echo " unrun {id} Remove installed packages by .run/.ipk"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
is_init >/dev/null 2>&1
|
is_init >/dev/null 2>&1
|
||||||
@@ -284,7 +372,18 @@ case $action in
|
|||||||
"opkg")
|
"opkg")
|
||||||
opkg_wrap "$@"
|
opkg_wrap "$@"
|
||||||
;;
|
;;
|
||||||
|
"dotrun")
|
||||||
|
dotrun "$@"
|
||||||
|
;;
|
||||||
|
"run_records")
|
||||||
|
run_records
|
||||||
|
;;
|
||||||
|
"del_record")
|
||||||
|
rm -f "/usr/share/istore/run-records/$1.txt"
|
||||||
|
;;
|
||||||
|
"unrun")
|
||||||
|
unrun "$1"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=qbittorrent
|
PKG_NAME:=qbittorrent
|
||||||
PKG_VERSION:=5.1.2
|
PKG_VERSION:=5.1.3
|
||||||
PKG_RELEASE=1
|
PKG_RELEASE=1
|
||||||
|
|
||||||
PKG_SOURCE:=qBittorrent-release-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=qBittorrent-release-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/qbittorrent/qBittorrent/tar.gz/release-$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/qbittorrent/qBittorrent/tar.gz/release-$(PKG_VERSION)?
|
||||||
PKG_HASH:=a35448f3c8cb57d033bd3c4bd66c63417b0ca793ae7e9c5c5053960e2229ad9e
|
PKG_HASH:=9c6c6018239a461ef02b67534db30232027cb8a431827c1f393f59cb8adc01e9
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/qBittorrent-release-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/qBittorrent-release-$(PKG_VERSION)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user