autocore: ethinfo: remove useless script
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -50,7 +50,6 @@ endif
|
||||
$(CP) ./files/luci-mod-status-autocore.json $(1)/usr/share/rpcd/acl.d/
|
||||
|
||||
ifeq ($(filter ipq806x%, $(TARGETID)),)
|
||||
$(INSTALL_BIN) ./files/ethinfo $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/status/include
|
||||
$(INSTALL_DATA) ./files/29_ethinfo.js $(1)/www/luci-static/resources/view/status/include/
|
||||
endif
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
'require network';
|
||||
'require firewall';
|
||||
|
||||
var callLuciETHInfo = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getETHInfo',
|
||||
var callNetworkStatus = rpc.declare({
|
||||
object: 'network.device',
|
||||
method: 'status',
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
@@ -292,7 +292,7 @@ return baseclass.extend({
|
||||
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
L.resolveDefault(callLuciETHInfo(), {}),
|
||||
L.resolveDefault(callNetworkStatus(), {}),
|
||||
firewall.getZones(),
|
||||
network.getNetworks(),
|
||||
uci.load('network')
|
||||
@@ -303,11 +303,13 @@ return baseclass.extend({
|
||||
var known_ports = [],
|
||||
port_map = buildInterfaceMapping(data[1], data[2]);
|
||||
|
||||
if (Array.isArray(data[0].ethinfo))
|
||||
data[0].ethinfo.forEach((k) => known_ports.push({
|
||||
device: k,
|
||||
netdev: network.instantiateDevice(k)
|
||||
}));
|
||||
Object.keys(data[0]).forEach((k) => {
|
||||
if (['dsa', 'ethernet'].includes(data[0][k].devtype) && data[0][k]['link-advertising'].length)
|
||||
known_ports.push({
|
||||
device: k,
|
||||
netdev: network.instantiateDevice(k)
|
||||
});
|
||||
});
|
||||
|
||||
known_ports.sort(function(a, b) {
|
||||
return L.naturalCompare(a.device, b.device);
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/ucode
|
||||
/* Copyright (C) 2022 ImmortalWrt.org */
|
||||
|
||||
'use strict';
|
||||
|
||||
import { connect } from 'ubus';
|
||||
|
||||
const ubus = connect();
|
||||
const stat = ubus.call('network.device', 'status', {});
|
||||
if (!stat) {
|
||||
print('{}');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
let device_list = [];
|
||||
map(keys(stat), (ifname) => {
|
||||
if (ifname && stat[ifname]?.devtype in ['ethernet', 'dsa'] && length(stat[ifname]['link-advertising']))
|
||||
push(device_list, ifname);
|
||||
});
|
||||
|
||||
sort(device_list, (a, b) => {
|
||||
return a > b;
|
||||
});
|
||||
|
||||
print(device_list);
|
||||
@@ -3,7 +3,8 @@
|
||||
"description": "Grant access to autocore",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"luci": [ "getCPUInfo", "getETHInfo", "getTempInfo" ]
|
||||
"luci": [ "getCPUInfo", "getTempInfo" ],
|
||||
"network.device": [ "status" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user