Compare commits

...
4 Commits
Author SHA1 Message Date
github-actions[bot] cb845a1f2d 🌴 Sync 2026-09-06 14:11:16
Merge-upstream / merge (push) Canceled after 0s
2026-09-06 14:11:16 +08:00
github-actions[bot] 3f15c041aa 🍉 Sync 2026-09-06 13:36:06 2026-09-06 13:36:06 +08:00
kiddin9 b2ff7cbe2f Delete .github/diy/patches/mosdns.patch 2026-09-06 13:33:57 +08:00
github-actions[bot] c27f496810 🏅 Sync 2026-09-06 10:36:07 2026-09-06 10:36:07 +08:00
29 changed files with 2871 additions and 108 deletions
-6
View File
@@ -1,6 +0,0 @@
--- a/luci-app-mosdns/root/etc/hotplug.d/iface/99-mosdns
+++ b/luci-app-mosdns/root/etc/hotplug.d/iface/99-mosdns
@@ -1,2 +1,2 @@
#!/bin/sh
-[ "$ACTION" = ifup ] && /etc/init.d/mosdns restart
+[[ "$ACTION" = ifup && "$(uci -q get mosdns.mosdns.enabled)" == 1 ]] && /etc/init.d/mosdns restart
+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=filebrowser-q PKG_NAME:=filebrowser-q
PKG_VERSION:=1.5.6-stable PKG_VERSION:=1.5.6-stable
PKG_RELEASE:=5 PKG_RELEASE:=6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/gtsteffaniak/filebrowser/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/gtsteffaniak/filebrowser/tar.gz/v$(PKG_VERSION)?
+18 -11
View File
@@ -1,14 +1,14 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
USE_PROCD=1
START=99 START=99
STOP=10
CONF="filebrowser-q" CONF="filebrowser-q"
PROG="/usr/bin/filebrowser-q" PROG="/usr/bin/filebrowser-q"
CONF_PATH="/etc/filebrowser-q/config.yaml" CONF_PATH="/etc/filebrowser-q/config.yaml"
PID_FILE="/var/run/filebrowser-q.pid" DB_PATH="/etc/filebrowser-q/database.db"
start() { start_service() {
config_load "$CONF" config_load "$CONF"
local enabled local enabled
@@ -19,7 +19,6 @@ start() {
config_get listen_port "config" "listen_port" "8787" config_get listen_port "config" "listen_port" "8787"
config_get root_path "config" "root_path" "/" config_get root_path "config" "root_path" "/"
# 路径为 / 时 name 设为 root,否则留空
root_name="" root_name=""
[ "$root_path" = "/" ] && root_name="root" [ "$root_path" = "/" ] && root_name="root"
@@ -28,7 +27,7 @@ start() {
cat <<EOF > "$CONF_PATH" cat <<EOF > "$CONF_PATH"
server: server:
port: $listen_port port: $listen_port
database: "/etc/filebrowser-q/database.db" database: "$DB_PATH"
sources: sources:
- path: "$root_path" - path: "$root_path"
name: "$root_name" name: "$root_name"
@@ -49,12 +48,20 @@ EOF
-i "$CONF_PATH" -i "$CONF_PATH"
fi fi
echo "Starting filebrowser..." procd_open_instance
start-stop-daemon -S -q -b -m -p "$PID_FILE" -x "$PROG" -- -c "$CONF_PATH" procd_set_param command "$PROG"
procd_append_param command -c "$CONF_PATH"
procd_set_param limits core="unlimited"
procd_set_param limits nofile="1000000 1000000"
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
} }
stop() { service_triggers() {
kill -9 `pidof filebrowser-q | sed "s/$$//g"` 2>/dev/null procd_add_reload_trigger "$CONF"
rm -f "$PID_FILE"
echo "filebrowser stopped"
} }
@@ -6,9 +6,21 @@
'require view'; 'require view';
'require fs'; 'require fs';
const callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
expect: { '': {} }
});
function getServiceStatus() { function getServiceStatus() {
return L.resolveDefault(callServiceList('filebrowser-q'), {}).then(function(res) {
let isRunning = false; let isRunning = false;
try {
isRunning = res['filebrowser-q']['instances']['instance1']['running'];
} catch (e) { }
return isRunning; return isRunning;
});
} }
function renderStatus(isRunning, port) { function renderStatus(isRunning, port) {
@@ -26,16 +38,8 @@ function renderStatus(isRunning, port) {
} }
return view.extend({ return view.extend({
load: async function () { load() {
const promises = await Promise.all([ return uci.load('filebrowser-q');
L.resolveDefault(fs.stat('/var/run/filebrowser-q.pid'), null),
uci.load('filebrowser-q')
]);
const data = {
isRunning: promises[0],
conf: promises[1]
};
return data;
}, },
render(data) { render(data) {
@@ -50,23 +54,16 @@ return view.extend({
s.anonymous = true; s.anonymous = true;
s.render = function() { s.render = function() {
poll.add(function() { poll.add(function() {
return fs.stat('/var/run/filebrowser-q.pid').then(function(stat) { return L.resolveDefault(getServiceStatus()).then(function(res) {
let view = document.getElementById('service_status'); let view = document.getElementById('service_status');
if (view) { view.innerHTML = renderStatus(res, webport);
view.innerHTML = renderStatus(stat, webport);
}
}).catch(function() {
let view = document.getElementById('service_status');
if (view) {
view.innerHTML = renderStatus(null, webport);
}
}); });
}); });
return E('div', { class: 'cbi-section', id: 'status_bar' }, [ return E('div', { class: 'cbi-section', id: 'status_bar' }, [
E('p', { id: 'service_status' }, _('Collecting data...')) E('p', { id: 'service_status' }, _('Collecting data...'))
]); ]);
}; }
s = m.section(form.NamedSection, 'config', 'filebrowser'); s = m.section(form.NamedSection, 'config', 'filebrowser');
+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-mosdns PKG_NAME:=luci-app-mosdns
PKG_VERSION:=1.7.13 PKG_VERSION:=1.7.13
PKG_RELEASE:=21 PKG_RELEASE:=22
LUCI_TITLE:=LuCI Support for mosdns LUCI_TITLE:=LuCI Support for mosdns
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
@@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
[[ "$ACTION" = ifup && "$(uci -q get mosdns.mosdns.enabled)" == 1 ]] && /etc/init.d/mosdns restart [ "$ACTION" = "ifup" ] || exit 0
[ "$INTERFACE" = "wan" ] && /etc/init.d/mosdns reload
+1 -1
View File
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall PKG_NAME:=luci-app-passwall
PKG_VERSION:=26.9.1 PKG_VERSION:=26.9.1
PKG_RELEASE:=257 PKG_RELEASE:=258
PKG_PO_VERSION:=$(PKG_VERSION) PKG_PO_VERSION:=$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \
@@ -47,6 +47,11 @@ function waitForElement(selector, callback) {
observer.observe(document.body, { childList: true, subtree: true }); observer.observe(document.body, { childList: true, subtree: true });
} }
function waitForElementId(id, callback) {
waitForElement("#" + CSS.escape(id), callback);
//waitForElement('[id="' + id + '"]', callback);
}
function get_current_url() { function get_current_url() {
return window.location.origin + window.location.pathname; return window.location.origin + window.location.pathname;
} }
@@ -192,10 +192,15 @@ o.rmempty = false
o:depends({ _hide_node_option = "1", ['!reverse'] = true }) o:depends({ _hide_node_option = "1", ['!reverse'] = true })
o = s:option(ListValue, "node", "<a style='color: red'>" .. translate("Proxy Node") .. "</a>") o = s:option(ListValue, "node", "<a style='color: red'>" .. translate("Proxy Node") .. "</a>")
o.default = "" o.group = {}
o:depends({ _hide_node_option = false, use_global_config = false }) o:depends({ _hide_node_option = false, use_global_config = false })
o.template = m:template_path("/cbi/nodes_listvalue") o.template = m:template_path("/cbi/nodes_listvalue")
o.group = {}
current_node_id = o:formvalue(arg[1])
if not current_node_id then
current_node_id = m:get(arg[1], "node")
end
current_node = current_node_id and m:get(current_node_id) or {}
o = s:option(DummyValue, "_acl_node_bool", "") o = s:option(DummyValue, "_acl_node_bool", "")
o.template = m:template_path("/cbi/hidevalue") o.template = m:template_path("/cbi/hidevalue")
@@ -519,6 +524,8 @@ 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"})
local o_node = s.fields["node"] local o_node = s.fields["node"]
local shunt_list = {}
for k, v in pairs(socks_list) do for k, v in pairs(socks_list) do
o_node:value(v.id, v["remark"]) o_node:value(v.id, v["remark"])
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default") o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
@@ -528,7 +535,7 @@ for k, v in pairs(nodes_table) do
s.fields["dns_mode"]:depends({ _acl_node_bool = "1" }) s.fields["dns_mode"]:depends({ _acl_node_bool = "1" })
break break
end end
if v.protocol == "_shunt" then if v.protocol and v.protocol == "_shunt" then
if v.type == "Xray" and has_xray then if v.type == "Xray" and has_xray then
o_node:value(v.id, v["remark"]) o_node:value(v.id, v["remark"])
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default") o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
@@ -544,6 +551,7 @@ for k, v in pairs(nodes_table) do
s.fields["_node_sel_shunt"]:depends({ node = v.id }) s.fields["_node_sel_shunt"]:depends({ node = v.id })
s.fields["remote_rewrite_ttl"]:depends({ _acl_node_bool = "1", node = v.id }) s.fields["remote_rewrite_ttl"]:depends({ _acl_node_bool = "1", node = v.id })
end end
shunt_list[#shunt_list + 1] = v
else else
o_node:value(v.id, v["remark"]) o_node:value(v.id, v["remark"])
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default") o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
@@ -552,4 +560,19 @@ end
m:appendTemplate("/acl/config_footer", {section = arg[1]}) m:appendTemplate("/acl/config_footer", {section = arg[1]})
--[[
-- Shunt
if current_node.protocol == "_shunt" then
local shunt_lua = loadfile("/usr/lib/lua/luci/model/cbi/passwall/client/include/shunt_options.lua")
setfenv(shunt_lua, getfenv(1))(m, s, {
s_cfgid = s.section,
node_id = current_node_id,
node = current_node,
verify_option = s.fields["node"]
})
end
m:appendTemplate("/acl/shunt", { shunt_list = api.jsonc.stringify(shunt_list), section = s.section })
]]--
return api.return_map(m) return api.return_map(m)
@@ -139,7 +139,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
tips.cfgvalue = function(t, n) tips.cfgvalue = function(t, n)
return string.format('<a style="color: red">%s</a>', translate("There are no available nodes, please add or subscribe nodes first.")) return string.format('<a style="color: red">%s</a>', translate("There are no available nodes, please add or subscribe nodes first."))
end end
tips:depends({ node = "", ["!reverse"] = true }) tips:depends("_node", "1")
for k, v in pairs(shunt_list) do for k, v in pairs(shunt_list) do
tips:depends("node", v.id) tips:depends("node", v.id)
end end
@@ -153,7 +153,7 @@ o = s:taboption("Main", Value, "node_socks_port", translate("Node") .. " Socks "
o.default = 1070 o.default = 1070
o.placeholder = 1070 o.placeholder = 1070
o.datatype = "range(1,65535)" o.datatype = "range(1,65535)"
o:depends({ node = "", ["!reverse"] = true }) o:depends("_node", "1")
--[[ --[[
if has_singbox or has_xray then if has_singbox or has_xray then
o = s:taboption("Main", Value, "node_http_port", translate("Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) o = s:taboption("Main", Value, "node_http_port", translate("Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use"))
@@ -163,7 +163,12 @@ end
]]-- ]]--
o = s:taboption("Main", Flag, "node_socks_bind_local", translate("Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) o = s:taboption("Main", Flag, "node_socks_bind_local", translate("Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
o.default = "1" o.default = "1"
o:depends({ node = "", ["!reverse"] = true }) o:depends("_node", "1")
o = s:taboption("Main", DummyValue, "_node", "")
o.template = m:template_path("/cbi/hidevalue")
o.value = "1"
o:depends({ node = "", ['!reverse'] = true })
-- Node → DNS Depends Settings -- Node → DNS Depends Settings
o = s:taboption("Main", DummyValue, "_node_sel_shunt", "") o = s:taboption("Main", DummyValue, "_node_sel_shunt", "")
@@ -787,7 +792,7 @@ for k, v in pairs(nodes_table) do
if #normal_list == 0 and #iface_list == 0 then if #normal_list == 0 and #iface_list == 0 then
break break
end end
if v.protocol == "_shunt" then if v.protocol and v.protocol == "_shunt" then
if has_singbox or has_xray then if has_singbox or has_xray then
o_node:value(v.id, v["remark"]) o_node:value(v.id, v["remark"])
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default") o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
@@ -4,6 +4,7 @@ if not data.node_id or not data.node then
return return
end end
local api = m.api
local s_cfgid = data.s_cfgid local s_cfgid = data.s_cfgid
local current_node_id = data.node_id local current_node_id = data.node_id
local node_list = data.node_list or api.get_node_list() local node_list = data.node_list or api.get_node_list()
+1 -1
View File
@@ -13,7 +13,7 @@ jsonc = require "luci.jsonc"
i18n = require "luci.i18n" i18n = require "luci.i18n"
appname = "passwall" appname = "passwall"
curl_args = { "-skfL", "--connect-timeout 3", "--retry 3" } curl_args = { "-skfL", "--connect-timeout 3", "--retry 3", "-H 'Accept: */*'" }
command_timeout = 300 command_timeout = 300
OPENWRT_ARCH = nil OPENWRT_ARCH = nil
DISTRIB_ARCH = nil DISTRIB_ARCH = nil
@@ -1196,7 +1196,7 @@ function gen_config(var)
format = format, format = format,
path = _type == "local" and w or nil, path = _type == "local" and w or nil,
url = _type == "remote" and w or nil, url = _type == "remote" and w or nil,
http_client = _type == "remote" and "remote_http_client" or nil, http_client = (_type == "remote" and version_ge_1_14_0) and "remote_http_client" or nil,
--update_interval = _type == "remote" and "1d" or nil, --update_interval = _type == "remote" and "1d" or nil,
} }
end end
@@ -2281,7 +2281,7 @@ function gen_config(var)
-- 实验性 -- 实验性
experimental = experimental, experimental = experimental,
-- HTTP Client -- HTTP Client
http_clients = http_clients http_clients = version_ge_1_14_0 and http_clients or nil,
} }
table.insert(outbounds, { table.insert(outbounds, {
type = "direct", type = "direct",
@@ -0,0 +1,59 @@
<%
local map = self.map
local api = map.api
local appname = map.config
local section = self.section
-%>
<script type="text/javascript">
//<![CDATA[
const shunt_list = JSON.parse('<%=self.shunt_list%>');
document.addEventListener("DOMContentLoaded", () => {
const id = "cbid.<%=appname%>.<%=section%>.node";
let node = null;
const onChange = (e) => {
const new_val = e.target.value;
const new_hasItem = shunt_list.some(element => element.id == new_val);
if (new_hasItem) {
XHR.get('<%=api.url("update_config")%>', {
id: "<%=section%>",
data: JSON.stringify({
node: new_val,
mode: "1"
})
}, function(x, data) {
if (x && x.status == 200 && data.code == 1) {
window.location.reload();
} else {
alert("<%:Error%>");
}
});
} else {
document.getElementById("cbi-<%=appname%>-shunt_option_list")?.style.setProperty("display", "none");
}
};
const check = () => {
const el = document.getElementById(id);
if (el === node) return;
if (node && !el) {
document.getElementById("cbi-<%=appname%>-shunt_option_list")?.style.setProperty("display", "none");
} else {
let o_hasItem = shunt_list.some(element => element.id == el.value);
if (o_hasItem) {
document.getElementById("cbi-<%=appname%>-shunt_option_list")?.style.setProperty("display", "");
}
}
node = el;
if (node) {
node.addEventListener("change", onChange);
}
};
const observer = new MutationObserver(check);
observer.observe(document.body, {
childList: true,
subtree: true
});
check();
});
//]]>
</script>
@@ -421,10 +421,10 @@ table td, .table .td {
<%- else %> <%- else %>
(function() { (function() {
if (typeof(cbi_t_switch) === "function") { if (typeof(cbi_t_switch) === "function") {
var old_switch = cbi_t_switch; const ori_cbi_t_switch = cbi_t_switch;
cbi_t_switch = function(section, tab) { cbi_t_switch = function(section, tab) {
dechecked_all_node(); dechecked_all_node();
return old_switch(section, tab); return ori_cbi_t_switch(section, tab);
}; };
} }
})(); })();
@@ -1516,37 +1516,71 @@ table td, .table .td {
//Node list option saving logic //Node list option saving logic
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
function onChange(option, value) { function onChange(option, value, refresh) {
ajax.abortAll(); ajax.abortAll();
XHR.get('<%=api.url("save_node_list_opt")%>', { XHR.get('<%=api.url("save_node_list_opt")%>', {
option: option, option: option,
value: value value: value
}, function(x) { }, function(x) {
if (x && x.status == 200) { if (x && x.status == 200) {
if (refresh) {
document.getElementById("node_list").innerHTML = ""; document.getElementById("node_list").innerHTML = "";
loadNodeList(); loadNodeList();
}
} else { } else {
alert("<%:Error%>"); alert("<%:Error%>");
} }
}); });
} }
function dom_event() {
waitForElement('input[type="checkbox"][name*="<%=appname%>"][name*="show_node_info"]', function(el) { waitForElement('input[type="checkbox"][name*="<%=appname%>"][name*="show_node_info"]', function(el) {
el.addEventListener("change", () => { el.addEventListener("change", () => {
el.blur(); el.blur();
show_node_info = el.checked ? "1" : "0"; show_node_info = el.checked ? "1" : "0";
onChange("show_node_info", show_node_info); onChange("auto_detection_time", auto_detection_time, true);
}); });
}); });
waitForElement('select[name*="<%=appname%>"][name*="auto_detection_time"]', function(el) { <% if api.is_js_luci() then -%>
waitForElement('div[id*="cbid.<%=appname%>"][id*="url_test_url"]', function(el) {
el.addEventListener("cbi-dropdown-change", () => {
if (el.value && (!el.new_val || el.new_val != el.value)) {
onChange("url_test_url", el.value, false);
el.new_val = el.value;
}
});
});
<% else -%>
waitForElement('select[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
el.addEventListener("change", () => { el.addEventListener("change", () => {
el.blur(); if (el.value && (!el.new_val || el.new_val != el.value)) {
auto_detection_time = el.value; onChange("url_test_url", el.value, false);
onChange("auto_detection_time", auto_detection_time); el.new_val = el.value;
}
}); });
}); });
waitForElement('input[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
el.addEventListener("change", () => {
if (el.value && (!el.new_val || el.new_val != el.value)) {
onChange("url_test_url", el.value, false);
el.new_val = el.value;
}
});
});
<% end -%>
}
<% if not api.is_js_luci() then -%>
const ori_cbi_d_update = cbi_d_update;
cbi_d_update = function() {
ori_cbi_d_update();
dom_event();
};
<% end -%>
dom_event();
const links = document.querySelectorAll('a'); const links = document.querySelectorAll('a');
links.forEach(link => { links.forEach(link => {
link.addEventListener('click', (e) => { link.addEventListener('click', (e) => {
@@ -111,7 +111,7 @@ api.uci_foreach_c("haproxy_config", function(t)
if server_node.type ~= "Socks" then if server_node.type ~= "Socks" then
local relay_port = server_node.port local relay_port = server_node.port
local new_port = api.get_new_port() local new_port = api.get_new_port()
local config_file = string.format("haproxy_%s_%s.json", t[".name"], new_port) local config_file = string.format("%s_%s.json", t[".name"], new_port)
sys.call(string.format('/usr/share/%s/app.sh run_socks "%s"> /dev/null', sys.call(string.format('/usr/share/%s/app.sh run_socks "%s"> /dev/null',
appname, appname,
string.format("flag=%s node=%s bind=%s socks_port=%s config_file=%s", string.format("flag=%s node=%s bind=%s socks_port=%s config_file=%s",
@@ -4,7 +4,8 @@
. /usr/share/passwall/utils.sh . /usr/share/passwall/utils.sh
LOCK_FILE=${LOCK_PATH}/${CONFIG}_lease2hosts.lock LOCK_FILE=${LOCK_PATH}/${CONFIG}_lease2hosts.lock
LEASE_FILE="/tmp/dhcp.leases" LEASE_FILE=$(uci -q get "dhcp.@dnsmasq[0].leasefile")
LEASE_FILE=${LEASE_FILE:="/tmp/dhcp.leases"}
HOSTS_FILE="$TMP_PATH2/dhcp-hosts" HOSTS_FILE="$TMP_PATH2/dhcp-hosts"
TMP_FILE="/tmp/dhcp-hosts.tmp" TMP_FILE="/tmp/dhcp-hosts.tmp"
@@ -103,6 +103,7 @@ local function curl(url, file)
"--connect-timeout 3", "--connect-timeout 3",
"--max-time 300", "--max-time 300",
"--speed-limit 51200 --speed-time 15", "--speed-limit 51200 --speed-time 15",
"-H 'Accept: */*'",
'-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"', '-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"',
"--dump-header -", "--dump-header -",
"-w '\\n%{http_code}'" "-w '\\n%{http_code}'"
@@ -1708,6 +1708,7 @@ local function curl(url, file, ua, mode)
"-fskL", "-fskL",
"--retry 3", "--retry 3",
"--connect-timeout 3", "--connect-timeout 3",
"-H 'Accept: */*'",
"-H 'Accept-Encoding: identity'", "-H 'Accept-Encoding: identity'",
"--dump-header -", "--dump-header -",
"-w '\\n%{http_code}'" "-w '\\n%{http_code}'"
@@ -40,9 +40,10 @@ config_n_get() {
echo "${ret:=$3}" echo "${ret:=$3}"
} }
config_t_set() { config_t_get() {
local index=${4:-0} local index=${4:-0}
local ret=$(uci -q set "${CONFIG}.@${1}[${index}].${2}=${3}" 2>/dev/null) local ret=$(uci -q get "${CONFIG}.@${1}[${index}].${2}" 2>/dev/null)
echo "${ret:=${3}}"
} }
first_type() { first_type() {
+33
View File
@@ -0,0 +1,33 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2026 luci-app-sysctl contributors
#
# LuCI application: manage kernel sysctl parameters from the web UI.
#
# Build inside OpenWrt 24.10 buildroot/SDK:
# - copy this directory to package/luci-app-sysctl (needs luci feed installed), or
# - copy to feeds/luci/applications/luci-app-sysctl and re-run feeds update/install
# then: make menuconfig -> LuCI -> Applications -> luci-app-sysctl
# make package/luci-app-sysctl/compile V=s
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-sysctl
PKG_VERSION:=1.5.9
PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=luci-app-sysctl contributors
LUCI_TITLE:=LuCI application to manage kernel sysctl parameters
LUCI_DESCRIPTION:=View live kernel parameters and manage custom sysctl entries \
stored in /etc/sysctl.d/99-luci-sysctl.conf from the LuCI web interface. \
Supports browsing /proc/sys, searching parameters, one-click apply and \
immediate runtime activation of single parameters.
LUCI_DEPENDS:=+luci-base +rpcd +rpcd-mod-ucode
LUCI_CONFFILES:=/etc/sysctl.d/99-luci-sysctl.conf
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
#
# build-ipk.sh - pack luci-app-sysctl into an opkg-installable .ipk
# without requiring the OpenWrt SDK/buildroot.
#
# Usage:
# ./build-ipk.sh [output-directory]
#
# The produced .ipk targets OpenWrt 24.10 (opkg, "all" architecture):
# opkg install luci-app-sysctl_<version>-<release>_all.ipk
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PKG_DIR="$SCRIPT_DIR"
OUT_DIR="${1:-$PKG_DIR}"
# --- read package identity from the OpenWrt Makefile -----------------------
get_var() {
sed -n "s/^$1:=//p" "$PKG_DIR/Makefile" | head -1
}
PKG_NAME="$(get_var PKG_NAME)"
PKG_VERSION="$(get_var PKG_VERSION)"
PKG_RELEASE="$(get_var PKG_RELEASE)"
for v in PKG_NAME PKG_VERSION PKG_RELEASE; do
if [ -z "$(eval "echo \$$v")" ]; then
echo "ERROR: $v not found in $PKG_DIR/Makefile" >&2
exit 1
fi
done
IPK_NAME="${PKG_NAME}_${PKG_VERSION}-${PKG_RELEASE}_all.ipk"
# --- sanity checks ----------------------------------------------------------
for f in \
"$PKG_DIR/htdocs/luci-static/resources/view/sysctl.js" \
"$PKG_DIR/root/usr/share/rpcd/ucode/luci.sysctl" \
"$PKG_DIR/root/usr/share/luci/menu.d/$PKG_NAME.json" \
"$PKG_DIR/root/usr/share/rpcd/acl.d/$PKG_NAME.json" \
"$PKG_DIR/root/etc/sysctl.d/99-luci-sysctl.conf"
do
if [ ! -f "$f" ]; then
echo "ERROR: required file missing: $f" >&2
exit 1
fi
done
# --- staging ----------------------------------------------------------------
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
DATA="$WORK/data"
CTRL="$WORK/control"
mkdir -p "$DATA" "$CTRL"
# root/ maps to /
cp -a "$PKG_DIR/root/." "$DATA/"
# htdocs/ maps to /www
mkdir -p "$DATA/www"
cp -a "$PKG_DIR/htdocs/." "$DATA/www/"
# uniform ownership/permissions; rpcd refuses world-writable ucode plugins
find "$DATA" -type d -exec chmod 755 {} +
find "$DATA" -type f -exec chmod 644 {} +
# --- control metadata ---------------------------------------------------------
cat > "$CTRL/control" <<EOF
Package: $PKG_NAME
Version: $PKG_VERSION-$PKG_RELEASE
Architecture: all
Maintainer: luci-app-sysctl contributors
Section: luci
Priority: optional
Depends: libc, luci-base, rpcd, rpcd-mod-ucode
Description: LuCI application to manage kernel sysctl parameters
View live kernel parameters and manage custom sysctl entries
in /etc/sysctl.d/99-luci-sysctl.conf from the LuCI web interface.
EOF
cat > "$CTRL/conffiles" <<'EOF'
/etc/sysctl.d/99-luci-sysctl.conf
EOF
cat > "$CTRL/postinst" <<'EOF'
#!/bin/sh
# register the new ubus object and invalidate the LuCI menu cache
if [ -x /etc/init.d/rpcd ]; then
/etc/init.d/rpcd restart
fi
rm -f /tmp/luci-indexcache* 2>/dev/null
exit 0
EOF
chmod 755 "$CTRL/postinst"
chmod 644 "$CTRL/control" "$CTRL/conffiles"
# --- archive ----------------------------------------------------------------
TAR_FLAGS=(--owner=0 --group=0 --numeric-owner)
tar "${TAR_FLAGS[@]}" -czf "$WORK/data.tar.gz" -C "$DATA" ./etc ./usr ./www
tar "${TAR_FLAGS[@]}" -czf "$WORK/control.tar.gz" -C "$CTRL" ./control ./conffiles ./postinst
printf '2.0\n' > "$WORK/debian-binary"
IPK_PATH="$OUT_DIR/$IPK_NAME"
mkdir -p "$OUT_DIR"
rm -f "$IPK_PATH"
tar -czf "$IPK_PATH" -C "$WORK" debian-binary control.tar.gz data.tar.gz
echo "OK: $IPK_PATH"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,10 @@
# Custom kernel parameters managed by luci-app-sysctl.
#
# Entries added or modified through the LuCI web interface
# (System -> 内核参数 / Kernel Parameters) are stored in this file.
#
# A line prefixed with "#" means the entry is disabled, e.g.:
# # net.core.somaxconn = 4096
#
# This file is loaded at boot time by /etc/init.d/sysctl and can be
# re-applied at runtime from the LuCI page ("应用配置" button).
@@ -0,0 +1,13 @@
{
"admin/system/sysctl": {
"title": "内核参数",
"order": 65,
"action": {
"type": "view",
"path": "sysctl"
},
"depends": {
"acl": [ "luci-app-sysctl" ]
}
}
}
@@ -0,0 +1,33 @@
{
"luci-app-sysctl": {
"description": "Grant access to kernel sysctl parameters",
"read": {
"ubus": {
"luci.sysctl": [
"status",
"list",
"browse",
"search",
"preset_status",
"preset_fetch",
"preset_check",
"file_view",
"preset_list"
]
}
},
"write": {
"ubus": {
"luci.sysctl": [
"set",
"remove",
"apply",
"preset_import",
"preset_remove",
"file_set",
"file_delete"
]
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -361,11 +361,11 @@ function refreshWirelessState() {
return _wirelessInit; return _wirelessInit;
const wifiDevices = uci.sections('wireless', 'wifi-device'); const wifiDevices = uci.sections('wireless', 'wifi-device');
const qcaOnly = wifiDevices.length > 0 && wifiDevices.every(function(device) { const configOnly = wifiDevices.length > 0 && wifiDevices.every(function(device) {
return (device.type == 'qcawifi' || device.type == 'qcawificfg80211'); return (device.type == 'mt_dbdc' || device.type == 'qcawifi' || device.type == 'qcawificfg80211');
}); });
if (qcaOnly) if (configOnly)
return Promise.resolve(); return Promise.resolve();
_wirelessInit = L.resolveDefault(callLuciWirelessDevices(), {}).then(function(radios) { _wirelessInit = L.resolveDefault(callLuciWirelessDevices(), {}).then(function(radios) {
@@ -407,12 +407,12 @@ function refreshWirelessState() {
function waitForWirelessState() { function waitForWirelessState() {
const wifiDevices = uci.sections('wireless', 'wifi-device'); const wifiDevices = uci.sections('wireless', 'wifi-device');
const hasQcaWifi = wifiDevices.some(function(device) { const hasConfigOnlyWifi = wifiDevices.some(function(device) {
return (device.type == 'qcawifi' || device.type == 'qcawificfg80211'); return (device.type == 'mt_dbdc' || device.type == 'qcawifi' || device.type == 'qcawificfg80211');
}); });
const refresh = refreshWirelessState(); const refresh = refreshWirelessState();
return hasQcaWifi ? Promise.resolve() : refresh; return hasConfigOnlyWifi ? Promise.resolve() : refresh;
} }
function initNetworkState(refresh) { function initNetworkState(refresh) {
@@ -72,6 +72,27 @@ function getQcaFallbackIfname(device, section) {
return null; return null;
} }
function getMtDbdcMainIfname(device) {
const match = String(device || '').match(/^(ra[xiyez]?)(?:0)?$/);
return match ? match[1] + '0' : null;
}
function getMtDbdcStaIfname(device) {
const ifname = getMtDbdcMainIfname(device);
if (ifname == 'rax0')
return 'apclix0';
if (ifname == 'rai0')
return 'apclii0';
return ifname ? 'apcli0' : null;
}
function isConfigOnlyWifiHwtype(hwtype) {
return (hwtype == 'mt_dbdc' || isQcaWifiHwtype(hwtype));
}
function buildIwinfoDeviceLookup(devices) { function buildIwinfoDeviceLookup(devices) {
const lookup = Object.create(null); const lookup = Object.create(null);
@@ -82,19 +103,24 @@ function buildIwinfoDeviceLookup(devices) {
return lookup; return lookup;
} }
function getQcaIwinfoDevicesFromConfig() { function getIwinfoDevicesFromConfig() {
const radios = uci.sections('wireless', 'wifi-device'); const radios = uci.sections('wireless', 'wifi-device');
const devices = []; const devices = [];
if (!radios.length || !radios.every((radio) => isQcaWifiHwtype(radio.type))) if (!radios.length || !radios.every((radio) => isConfigOnlyWifiHwtype(radio.type)))
return null; return null;
for (const iface of uci.sections('wireless', 'wifi-iface')) { for (const iface of uci.sections('wireless', 'wifi-iface')) {
if (isConfigWifiIfaceDisabled(iface) || const hwtype = uci.get('wireless', iface.device, 'type');
!isQcaWifiHwtype(uci.get('wireless', iface.device, 'type')))
if (isConfigWifiIfaceDisabled(iface) || !isConfigOnlyWifiHwtype(hwtype))
continue; continue;
pushUnique(devices, iface.ifname || getQcaFallbackIfname(iface.device, iface['.name'])); const fallback = isQcaWifiHwtype(hwtype)
? getQcaFallbackIfname(iface.device, iface['.name'])
: getMtDbdcMainIfname(iface.device);
pushUnique(devices, iface.ifname || fallback);
} }
return devices; return devices;
@@ -130,7 +156,10 @@ function getLegacyIwinfoProbeTargets() {
const device = iface.device; const device = iface.device;
const section = iface['.name']; const section = iface['.name'];
const configuredIfname = iface.ifname; const configuredIfname = iface.ifname;
const fallback = getQcaFallbackIfname(device, section); const hwtype = uci.get('wireless', device, 'type');
const fallback = isQcaWifiHwtype(hwtype)
? getQcaFallbackIfname(device, section)
: getMtDbdcMainIfname(device);
pushUnique(targets, configuredIfname); pushUnique(targets, configuredIfname);
pushUnique(targets, section); pushUnique(targets, section);
@@ -220,13 +249,13 @@ function loadIwinfoResolver(force) {
if (!force && cachedIwinfoResolver != null) if (!force && cachedIwinfoResolver != null)
return Promise.resolve(cachedIwinfoResolver); return Promise.resolve(cachedIwinfoResolver);
const qcaDevices = getQcaIwinfoDevicesFromConfig(); const configuredDevices = getIwinfoDevicesFromConfig();
const deviceRequest = qcaDevices != null const deviceRequest = configuredDevices != null
? Promise.resolve({ devices: qcaDevices }) ? Promise.resolve({ devices: configuredDevices })
: L.resolveDefault(callIwinfoDevices(), {}); : L.resolveDefault(callIwinfoDevices(), {});
cachedIwinfoResolverPromise = deviceRequest.then((res) => { cachedIwinfoResolverPromise = deviceRequest.then((res) => {
cachedIwinfoResolver = buildIwinfoResolver(res?.devices, qcaDevices != null); cachedIwinfoResolver = buildIwinfoResolver(res?.devices, configuredDevices != null);
cachedIwinfoResolverPromise = null; cachedIwinfoResolverPromise = null;
return cachedIwinfoResolver; return cachedIwinfoResolver;
}).catch(() => { }).catch(() => {
@@ -2586,11 +2615,11 @@ return view.extend({
const configuredRadios = network.getWifiDevicesFromConfig().sort(function(a, b) { const configuredRadios = network.getWifiDevicesFromConfig().sort(function(a, b) {
return a.getName() > b.getName(); return a.getName() > b.getName();
}); });
const hasQcaWifi = configuredRadios.some(function(radio) { const hasConfigOnlyWifi = configuredRadios.some(function(radio) {
return isQcaWifiHwtype(uci.get('wireless', radio.getName(), 'type')); return isConfigOnlyWifiHwtype(uci.get('wireless', radio.getName(), 'type'));
}); });
if (hasQcaWifi) { if (hasConfigOnlyWifi) {
this.radios = configuredRadios; this.radios = configuredRadios;
this.wifis = network.getWifiNetworksFromConfig(); this.wifis = network.getWifiNetworksFromConfig();
return Promise.resolve(); return Promise.resolve();
@@ -4553,10 +4582,9 @@ return view.extend({
return network.addNetwork(nameval, { proto: 'dhcp' }).then(function(net) { return network.addNetwork(nameval, { proto: 'dhcp' }).then(function(net) {
if (hwtype == 'mt_dbdc') { if (hwtype == 'mt_dbdc') {
const radioName = radioDev.getName(); const staDevice = getMtDbdcStaIfname(radioDev.getName());
const staDevice = (radioName == 'rax') ? 'apclix0' :
(radioName == 'rai') ? 'apclii0' : 'apcli0';
if (staDevice)
uci.set('network', nameval, 'device', staDevice); uci.set('network', nameval, 'device', staDevice);
} }
else if (hwtype == 'qcawifi' || hwtype == 'qcawificfg80211') { else if (hwtype == 'qcawifi' || hwtype == 'qcawificfg80211') {