mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 18:15:13 +08:00
⛅ Sync 2026-09-04 03:19:40
This commit is contained in:
1 parent
92c3e430e5
commit
a65cd2a696
3 files changed
+26
-18
No files matched your search
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-wechatpush
|
PKG_NAME:=luci-app-wechatpush
|
||||||
PKG_VERSION:=3.6.12
|
PKG_VERSION:=3.6.12
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=7
|
||||||
|
|
||||||
PKG_MAINTAINER:=tty228 <tty228@yeah.net>
|
PKG_MAINTAINER:=tty228 <tty228@yeah.net>
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|||||||
@@ -16,25 +16,34 @@ return view.extend({
|
|||||||
|
|
||||||
load: function () {
|
load: function () {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
this.callHostHints(),
|
this.callHostHints()
|
||||||
fs.read('/proc/net/arp')
|
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
parseArp: function (data) {
|
parseHostHints: function (data) {
|
||||||
var lines = data.split('\n'),
|
var hosts = [];
|
||||||
hosts = [];
|
|
||||||
|
|
||||||
for (var i = 1; i < lines.length; i++) {
|
Object.keys(data || {}).forEach(function (mac) {
|
||||||
var columns = lines[i].replace(/ +/g, ' ').split(' ');
|
var hint = data[mac] || {},
|
||||||
|
ipaddrs = hint.ipaddrs || hint.ipv4 || [];
|
||||||
|
|
||||||
if (columns.length >= 6) {
|
if (!Array.isArray(ipaddrs))
|
||||||
hosts.push({
|
ipaddrs = [ ipaddrs ];
|
||||||
ip: columns[0],
|
|
||||||
mac: columns[3]
|
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
|
// Sort hosts array by IP address
|
||||||
hosts.sort(function (a, b) {
|
hosts.sort(function (a, b) {
|
||||||
@@ -62,8 +71,7 @@ return view.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render: function (data) {
|
render: function (data) {
|
||||||
var arpData = data[1],
|
var hosts = this.parseHostHints(data[0]),
|
||||||
hosts = this.parseArp(arpData),
|
|
||||||
m, s, o,
|
m, s, o,
|
||||||
programPath = '/usr/share/wechatpush/wechatpush';
|
programPath = '/usr/share/wechatpush/wechatpush';
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
"read": {
|
"read": {
|
||||||
"file": {
|
"file": {
|
||||||
"/etc/init.d/wechatpush": [ "exec" ],
|
"/etc/init.d/wechatpush": [ "exec" ],
|
||||||
"/proc/net/arp": [ "read" ],
|
|
||||||
"/usr/share/wechatpush/wechatpush": [ "exec" ],
|
"/usr/share/wechatpush/wechatpush": [ "exec" ],
|
||||||
"/tmp/wechatpush/*": [ "read" ],
|
"/tmp/wechatpush/*": [ "read" ],
|
||||||
"/usr/share/wechatpush/api/*": [ "read" ],
|
"/usr/share/wechatpush/api/*": [ "read" ],
|
||||||
"/usr/libexec/wechatpush-call": [ "exec" ]
|
"/usr/libexec/wechatpush-call": [ "exec" ]
|
||||||
},
|
},
|
||||||
"ubus": {
|
"ubus": {
|
||||||
|
"luci-rpc": [ "getHostHints" ],
|
||||||
"service": [ "list" ]
|
"service": [ "list" ]
|
||||||
},
|
},
|
||||||
"uci": [ "wechatpush" ]
|
"uci": [ "wechatpush" ]
|
||||||
|
|||||||
Reference in new issue
Block a user