🤞 Sync 2026-09-27 22:16:29

This commit is contained in:
github-actions[bot] committed 2026-09-27 22:16:29 +08:00
1 parent 8ede4a8320
commit 618f51e9dc
459 files changed
+44817 -2191

No files matched your search

+1
View File
@@ -0,0 +1 @@
@@ -1,19 +1,11 @@
#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-wolplus.json" ] && {
cat > /usr/share/ucitrack/luci-app-wolplus.json << EEOF
{
"config": "wolplus",
"init": "wolplus"
}
EEOF
}
uci -q batch <<-EOF >/dev/null
delete ucitrack.@wolplus[-1]
add ucitrack wolplus
set ucitrack.@wolplus[-1].init=wolplus
commit ucitrack
EOF
# 修复 rpcd ucode 脚本执行权限(rpcd 仅加载带可执行位的脚本)
chmod 0755 /usr/share/rpcd/ucode/luci.wolplus 2>/dev/null
# 清理缓存并重载 rpcd
rm -f /tmp/luci-indexcache.*
rm -rf /tmp/luci-modulecache/
/etc/init.d/rpcd reload 2>/dev/null
rm -f /tmp/luci-indexcache
exit 0
@@ -0,0 +1,14 @@
{
"admin/services/wolplus": {
"title": "Wake on LAN +",
"order": 95,
"action": {
"type": "view",
"path": "wolplus"
},
"depends": {
"acl": [ "luci-app-wolplus" ],
"fs": { "/etc/config/wolplus": "file" }
}
}
}
@@ -2,9 +2,16 @@
"luci-app-wolplus": {
"description": "Grant UCI access for luci-app-wolplus",
"read": {
"ubus": {
"luci.wolplus": [ "awake" ],
"luci-rpc": [ "getHostHints", "getNetworkDevices" ]
},
"uci": [ "wolplus" ]
},
"write": {
"ubus": {
"luci.wolplus": [ "awake" ]
},
"uci": [ "wolplus" ]
}
}
@@ -0,0 +1,45 @@
#!/usr/bin/ucode
'use strict';
import { popen } from 'fs';
import { cursor } from 'uci';
const etherwake = '/usr/bin/etherwake';
function shellquote(s) {
return "'" + replace(s, "'", "'\\''") + "'";
}
const methods = {
awake: {
args: { section: 'string' },
call: function(request) {
const section = request.args.section;
if (!section || match(section, /[^A-Za-z0-9_]/))
return { data: 'invalid section' };
let ctx = cursor();
let lan = ctx.get('wolplus', section, 'maceth') || '';
let mac = ctx.get('wolplus', section, 'macaddr') || '';
if (!mac)
return { data: 'missing MAC address' };
let cmd = etherwake + ' -D' +
(lan ? ' -i ' + shellquote(lan) : '') +
' -b ' + shellquote(mac) + ' 2>&1';
const fd = popen(cmd);
let out = fd.read('all') || '';
fd.close();
if (length(out) > 500)
out = substr(out, 0, 500) + '...';
return { data: out };
}
}
};
return { 'luci.wolplus': methods };