mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-14 12:24:33 +08:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb845a1f2d | ||
|
|
3f15c041aa | ||
|
|
b2ff7cbe2f | ||
|
|
c27f496810 |
@@ -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
|
||||
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=filebrowser-q
|
||||
PKG_VERSION:=1.5.6-stable
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/gtsteffaniak/filebrowser/tar.gz/v$(PKG_VERSION)?
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
CONF="filebrowser-q"
|
||||
PROG="/usr/bin/filebrowser-q"
|
||||
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"
|
||||
|
||||
local enabled
|
||||
@@ -19,7 +19,6 @@ start() {
|
||||
config_get listen_port "config" "listen_port" "8787"
|
||||
config_get root_path "config" "root_path" "/"
|
||||
|
||||
# 路径为 / 时 name 设为 root,否则留空
|
||||
root_name=""
|
||||
[ "$root_path" = "/" ] && root_name="root"
|
||||
|
||||
@@ -28,7 +27,7 @@ start() {
|
||||
cat <<EOF > "$CONF_PATH"
|
||||
server:
|
||||
port: $listen_port
|
||||
database: "/etc/filebrowser-q/database.db"
|
||||
database: "$DB_PATH"
|
||||
sources:
|
||||
- path: "$root_path"
|
||||
name: "$root_name"
|
||||
@@ -49,12 +48,20 @@ EOF
|
||||
-i "$CONF_PATH"
|
||||
fi
|
||||
|
||||
echo "Starting filebrowser..."
|
||||
start-stop-daemon -S -q -b -m -p "$PID_FILE" -x "$PROG" -- -c "$CONF_PATH"
|
||||
procd_open_instance
|
||||
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() {
|
||||
kill -9 `pidof filebrowser-q | sed "s/$$//g"` 2>/dev/null
|
||||
rm -f "$PID_FILE"
|
||||
echo "filebrowser stopped"
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
||||
|
||||
@@ -6,9 +6,21 @@
|
||||
'require view';
|
||||
'require fs';
|
||||
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
function getServiceStatus() {
|
||||
return L.resolveDefault(callServiceList('filebrowser-q'), {}).then(function(res) {
|
||||
let isRunning = false;
|
||||
try {
|
||||
isRunning = res['filebrowser-q']['instances']['instance1']['running'];
|
||||
} catch (e) { }
|
||||
return isRunning;
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatus(isRunning, port) {
|
||||
@@ -26,16 +38,8 @@ function renderStatus(isRunning, port) {
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load: async function () {
|
||||
const promises = await Promise.all([
|
||||
L.resolveDefault(fs.stat('/var/run/filebrowser-q.pid'), null),
|
||||
uci.load('filebrowser-q')
|
||||
]);
|
||||
const data = {
|
||||
isRunning: promises[0],
|
||||
conf: promises[1]
|
||||
};
|
||||
return data;
|
||||
load() {
|
||||
return uci.load('filebrowser-q');
|
||||
},
|
||||
|
||||
render(data) {
|
||||
@@ -50,23 +54,16 @@ return view.extend({
|
||||
s.anonymous = true;
|
||||
s.render = 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');
|
||||
if (view) {
|
||||
view.innerHTML = renderStatus(stat, webport);
|
||||
}
|
||||
}).catch(function() {
|
||||
let view = document.getElementById('service_status');
|
||||
if (view) {
|
||||
view.innerHTML = renderStatus(null, webport);
|
||||
}
|
||||
view.innerHTML = renderStatus(res, webport);
|
||||
});
|
||||
});
|
||||
|
||||
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
|
||||
E('p', { id: 'service_status' }, _('Collecting data...'))
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
s = m.section(form.NamedSection, 'config', 'filebrowser');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mosdns
|
||||
PKG_VERSION:=1.7.13
|
||||
PKG_RELEASE:=21
|
||||
PKG_RELEASE:=22
|
||||
|
||||
LUCI_TITLE:=LuCI Support for mosdns
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
#!/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
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.9.1
|
||||
PKG_RELEASE:=257
|
||||
PKG_RELEASE:=258
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -47,6 +47,11 @@ function waitForElement(selector, callback) {
|
||||
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() {
|
||||
return window.location.origin + window.location.pathname;
|
||||
}
|
||||
|
||||
@@ -192,10 +192,15 @@ o.rmempty = false
|
||||
o:depends({ _hide_node_option = "1", ['!reverse'] = true })
|
||||
|
||||
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.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.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"})
|
||||
|
||||
local o_node = s.fields["node"]
|
||||
local shunt_list = {}
|
||||
|
||||
for k, v in pairs(socks_list) do
|
||||
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")
|
||||
@@ -528,7 +535,7 @@ for k, v in pairs(nodes_table) do
|
||||
s.fields["dns_mode"]:depends({ _acl_node_bool = "1" })
|
||||
break
|
||||
end
|
||||
if v.protocol == "_shunt" then
|
||||
if v.protocol and v.protocol == "_shunt" then
|
||||
if v.type == "Xray" and has_xray then
|
||||
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")
|
||||
@@ -544,6 +551,7 @@ for k, v in pairs(nodes_table) do
|
||||
s.fields["_node_sel_shunt"]:depends({ node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ _acl_node_bool = "1", node = v.id })
|
||||
end
|
||||
shunt_list[#shunt_list + 1] = v
|
||||
else
|
||||
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")
|
||||
@@ -552,4 +560,19 @@ end
|
||||
|
||||
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)
|
||||
|
||||
@@ -139,7 +139,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
||||
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."))
|
||||
end
|
||||
tips:depends({ node = "", ["!reverse"] = true })
|
||||
tips:depends("_node", "1")
|
||||
for k, v in pairs(shunt_list) do
|
||||
tips:depends("node", v.id)
|
||||
end
|
||||
@@ -153,7 +153,7 @@ o = s:taboption("Main", Value, "node_socks_port", translate("Node") .. " Socks "
|
||||
o.default = 1070
|
||||
o.placeholder = 1070
|
||||
o.datatype = "range(1,65535)"
|
||||
o:depends({ node = "", ["!reverse"] = true })
|
||||
o:depends("_node", "1")
|
||||
--[[
|
||||
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"))
|
||||
@@ -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.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
|
||||
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
|
||||
break
|
||||
end
|
||||
if v.protocol == "_shunt" then
|
||||
if v.protocol and v.protocol == "_shunt" then
|
||||
if has_singbox or has_xray then
|
||||
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")
|
||||
|
||||
@@ -4,6 +4,7 @@ if not data.node_id or not data.node then
|
||||
return
|
||||
end
|
||||
|
||||
local api = m.api
|
||||
local s_cfgid = data.s_cfgid
|
||||
local current_node_id = data.node_id
|
||||
local node_list = data.node_list or api.get_node_list()
|
||||
|
||||
@@ -13,7 +13,7 @@ jsonc = require "luci.jsonc"
|
||||
i18n = require "luci.i18n"
|
||||
|
||||
appname = "passwall"
|
||||
curl_args = { "-skfL", "--connect-timeout 3", "--retry 3" }
|
||||
curl_args = { "-skfL", "--connect-timeout 3", "--retry 3", "-H 'Accept: */*'" }
|
||||
command_timeout = 300
|
||||
OPENWRT_ARCH = nil
|
||||
DISTRIB_ARCH = nil
|
||||
|
||||
@@ -1196,7 +1196,7 @@ function gen_config(var)
|
||||
format = format,
|
||||
path = _type == "local" 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,
|
||||
}
|
||||
end
|
||||
@@ -2281,7 +2281,7 @@ function gen_config(var)
|
||||
-- 实验性
|
||||
experimental = experimental,
|
||||
-- HTTP Client
|
||||
http_clients = http_clients
|
||||
http_clients = version_ge_1_14_0 and http_clients or nil,
|
||||
}
|
||||
table.insert(outbounds, {
|
||||
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 %>
|
||||
(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) {
|
||||
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
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function onChange(option, value) {
|
||||
function onChange(option, value, refresh) {
|
||||
ajax.abortAll();
|
||||
XHR.get('<%=api.url("save_node_list_opt")%>', {
|
||||
option: option,
|
||||
value: value
|
||||
}, function(x) {
|
||||
if (x && x.status == 200) {
|
||||
if (refresh) {
|
||||
document.getElementById("node_list").innerHTML = "";
|
||||
loadNodeList();
|
||||
}
|
||||
} else {
|
||||
alert("<%:Error%>");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function dom_event() {
|
||||
waitForElement('input[type="checkbox"][name*="<%=appname%>"][name*="show_node_info"]', function(el) {
|
||||
el.addEventListener("change", () => {
|
||||
el.blur();
|
||||
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.blur();
|
||||
auto_detection_time = el.value;
|
||||
onChange("auto_detection_time", auto_detection_time);
|
||||
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||
onChange("url_test_url", el.value, false);
|
||||
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');
|
||||
links.forEach(link => {
|
||||
link.addEventListener('click', (e) => {
|
||||
|
||||
@@ -111,7 +111,7 @@ api.uci_foreach_c("haproxy_config", function(t)
|
||||
if server_node.type ~= "Socks" then
|
||||
local relay_port = server_node.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',
|
||||
appname,
|
||||
string.format("flag=%s node=%s bind=%s socks_port=%s config_file=%s",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
. /usr/share/passwall/utils.sh
|
||||
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"
|
||||
TMP_FILE="/tmp/dhcp-hosts.tmp"
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ local function curl(url, file)
|
||||
"--connect-timeout 3",
|
||||
"--max-time 300",
|
||||
"--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"',
|
||||
"--dump-header -",
|
||||
"-w '\\n%{http_code}'"
|
||||
|
||||
@@ -1708,6 +1708,7 @@ local function curl(url, file, ua, mode)
|
||||
"-fskL",
|
||||
"--retry 3",
|
||||
"--connect-timeout 3",
|
||||
"-H 'Accept: */*'",
|
||||
"-H 'Accept-Encoding: identity'",
|
||||
"--dump-header -",
|
||||
"-w '\\n%{http_code}'"
|
||||
|
||||
@@ -40,9 +40,10 @@ config_n_get() {
|
||||
echo "${ret:=$3}"
|
||||
}
|
||||
|
||||
config_t_set() {
|
||||
config_t_get() {
|
||||
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() {
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
const wifiDevices = uci.sections('wireless', 'wifi-device');
|
||||
const qcaOnly = wifiDevices.length > 0 && wifiDevices.every(function(device) {
|
||||
return (device.type == 'qcawifi' || device.type == 'qcawificfg80211');
|
||||
const configOnly = wifiDevices.length > 0 && wifiDevices.every(function(device) {
|
||||
return (device.type == 'mt_dbdc' || device.type == 'qcawifi' || device.type == 'qcawificfg80211');
|
||||
});
|
||||
|
||||
if (qcaOnly)
|
||||
if (configOnly)
|
||||
return Promise.resolve();
|
||||
|
||||
_wirelessInit = L.resolveDefault(callLuciWirelessDevices(), {}).then(function(radios) {
|
||||
@@ -407,12 +407,12 @@ function refreshWirelessState() {
|
||||
|
||||
function waitForWirelessState() {
|
||||
const wifiDevices = uci.sections('wireless', 'wifi-device');
|
||||
const hasQcaWifi = wifiDevices.some(function(device) {
|
||||
return (device.type == 'qcawifi' || device.type == 'qcawificfg80211');
|
||||
const hasConfigOnlyWifi = wifiDevices.some(function(device) {
|
||||
return (device.type == 'mt_dbdc' || device.type == 'qcawifi' || device.type == 'qcawificfg80211');
|
||||
});
|
||||
const refresh = refreshWirelessState();
|
||||
|
||||
return hasQcaWifi ? Promise.resolve() : refresh;
|
||||
return hasConfigOnlyWifi ? Promise.resolve() : refresh;
|
||||
}
|
||||
|
||||
function initNetworkState(refresh) {
|
||||
|
||||
@@ -72,6 +72,27 @@ function getQcaFallbackIfname(device, section) {
|
||||
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) {
|
||||
const lookup = Object.create(null);
|
||||
|
||||
@@ -82,19 +103,24 @@ function buildIwinfoDeviceLookup(devices) {
|
||||
return lookup;
|
||||
}
|
||||
|
||||
function getQcaIwinfoDevicesFromConfig() {
|
||||
function getIwinfoDevicesFromConfig() {
|
||||
const radios = uci.sections('wireless', 'wifi-device');
|
||||
const devices = [];
|
||||
|
||||
if (!radios.length || !radios.every((radio) => isQcaWifiHwtype(radio.type)))
|
||||
if (!radios.length || !radios.every((radio) => isConfigOnlyWifiHwtype(radio.type)))
|
||||
return null;
|
||||
|
||||
for (const iface of uci.sections('wireless', 'wifi-iface')) {
|
||||
if (isConfigWifiIfaceDisabled(iface) ||
|
||||
!isQcaWifiHwtype(uci.get('wireless', iface.device, 'type')))
|
||||
const hwtype = uci.get('wireless', iface.device, 'type');
|
||||
|
||||
if (isConfigWifiIfaceDisabled(iface) || !isConfigOnlyWifiHwtype(hwtype))
|
||||
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;
|
||||
@@ -130,7 +156,10 @@ function getLegacyIwinfoProbeTargets() {
|
||||
const device = iface.device;
|
||||
const section = iface['.name'];
|
||||
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, section);
|
||||
@@ -220,13 +249,13 @@ function loadIwinfoResolver(force) {
|
||||
if (!force && cachedIwinfoResolver != null)
|
||||
return Promise.resolve(cachedIwinfoResolver);
|
||||
|
||||
const qcaDevices = getQcaIwinfoDevicesFromConfig();
|
||||
const deviceRequest = qcaDevices != null
|
||||
? Promise.resolve({ devices: qcaDevices })
|
||||
const configuredDevices = getIwinfoDevicesFromConfig();
|
||||
const deviceRequest = configuredDevices != null
|
||||
? Promise.resolve({ devices: configuredDevices })
|
||||
: L.resolveDefault(callIwinfoDevices(), {});
|
||||
|
||||
cachedIwinfoResolverPromise = deviceRequest.then((res) => {
|
||||
cachedIwinfoResolver = buildIwinfoResolver(res?.devices, qcaDevices != null);
|
||||
cachedIwinfoResolver = buildIwinfoResolver(res?.devices, configuredDevices != null);
|
||||
cachedIwinfoResolverPromise = null;
|
||||
return cachedIwinfoResolver;
|
||||
}).catch(() => {
|
||||
@@ -2586,11 +2615,11 @@ return view.extend({
|
||||
const configuredRadios = network.getWifiDevicesFromConfig().sort(function(a, b) {
|
||||
return a.getName() > b.getName();
|
||||
});
|
||||
const hasQcaWifi = configuredRadios.some(function(radio) {
|
||||
return isQcaWifiHwtype(uci.get('wireless', radio.getName(), 'type'));
|
||||
const hasConfigOnlyWifi = configuredRadios.some(function(radio) {
|
||||
return isConfigOnlyWifiHwtype(uci.get('wireless', radio.getName(), 'type'));
|
||||
});
|
||||
|
||||
if (hasQcaWifi) {
|
||||
if (hasConfigOnlyWifi) {
|
||||
this.radios = configuredRadios;
|
||||
this.wifis = network.getWifiNetworksFromConfig();
|
||||
return Promise.resolve();
|
||||
@@ -4553,10 +4582,9 @@ return view.extend({
|
||||
|
||||
return network.addNetwork(nameval, { proto: 'dhcp' }).then(function(net) {
|
||||
if (hwtype == 'mt_dbdc') {
|
||||
const radioName = radioDev.getName();
|
||||
const staDevice = (radioName == 'rax') ? 'apclix0' :
|
||||
(radioName == 'rai') ? 'apclii0' : 'apcli0';
|
||||
const staDevice = getMtDbdcStaIfname(radioDev.getName());
|
||||
|
||||
if (staDevice)
|
||||
uci.set('network', nameval, 'device', staDevice);
|
||||
}
|
||||
else if (hwtype == 'qcawifi' || hwtype == 'qcawificfg80211') {
|
||||
|
||||
Reference in New Issue
Block a user