luci: add getETHInfo
method
Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
parent
9d4f357904
commit
3dc3696915
@ -664,6 +664,26 @@ const methods = {
|
||||
return { onlineusers: error() };
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getETHInfo: {
|
||||
call: function() {
|
||||
if (!access('/sbin/ethinfo'))
|
||||
return {};
|
||||
|
||||
const fd = popen('/sbin/ethinfo');
|
||||
if (fd) {
|
||||
let ethinfo = fd.read('all');
|
||||
if (!ethinfo)
|
||||
ethinfo = '{}';
|
||||
ethinfo = json(ethinfo);
|
||||
fd.close();
|
||||
|
||||
return { result: ethinfo };
|
||||
} else {
|
||||
return { result: error() };
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"description": "Grant access to autocore",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci": [ "getCPUInfo", "getTempInfo", "getCPUBench", "getCPUUsage", "getOnlineUsers" ]
|
||||
"luci": [ "getCPUInfo", "getTempInfo", "getCPUBench", "getCPUUsage", "getOnlineUsers", "getETHInfo" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user