Sync 2026-09-04 03:19:40

This commit is contained in:
github-actions[bot]
2026-09-04 03:19:40 +08:00
parent 92c3e430e5
commit a65cd2a696
3 changed files with 26 additions and 18 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-wechatpush
PKG_VERSION:=3.6.12
PKG_RELEASE:=6
PKG_RELEASE:=7
PKG_MAINTAINER:=tty228 <tty228@yeah.net>
PKG_CONFIG_DEPENDS:= \
@@ -16,25 +16,34 @@ return view.extend({
load: function () {
return Promise.all([
this.callHostHints(),
fs.read('/proc/net/arp')
this.callHostHints()
]);
},
parseArp: function (data) {
var lines = data.split('\n'),
hosts = [];
parseHostHints: function (data) {
var hosts = [];
for (var i = 1; i < lines.length; i++) {
var columns = lines[i].replace(/ +/g, ' ').split(' ');
Object.keys(data || {}).forEach(function (mac) {
var hint = data[mac] || {},
ipaddrs = hint.ipaddrs || hint.ipv4 || [];
if (columns.length >= 6) {
hosts.push({
ip: columns[0],
mac: columns[3]
});
}
}
if (!Array.isArray(ipaddrs))
ipaddrs = [ ipaddrs ];
ipaddrs.forEach(function (ip) {
var octets = (typeof(ip) === 'string' && /^\d{1,3}(\.\d{1,3}){3}$/.test(ip))
? ip.split('.').map(Number) : [];
if (octets.length === 4 && octets.every(function (octet) {
return octet >= 0 && octet <= 255;
})) {
hosts.push({
ip: ip,
mac: mac
});
}
});
});
// Sort hosts array by IP address
hosts.sort(function (a, b) {
@@ -62,8 +71,7 @@ return view.extend({
},
render: function (data) {
var arpData = data[1],
hosts = this.parseArp(arpData),
var hosts = this.parseHostHints(data[0]),
m, s, o,
programPath = '/usr/share/wechatpush/wechatpush';
@@ -4,13 +4,13 @@
"read": {
"file": {
"/etc/init.d/wechatpush": [ "exec" ],
"/proc/net/arp": [ "read" ],
"/usr/share/wechatpush/wechatpush": [ "exec" ],
"/tmp/wechatpush/*": [ "read" ],
"/usr/share/wechatpush/api/*": [ "read" ],
"/usr/libexec/wechatpush-call": [ "exec" ]
},
"ubus": {
"luci-rpc": [ "getHostHints" ],
"service": [ "list" ]
},
"uci": [ "wechatpush" ]