autocore: ethinfo: remove useless script

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2023-06-07 16:39:37 +08:00
parent 3495f95618
commit 26a5994069
4 changed files with 13 additions and 36 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -3,7 +3,8 @@
"description": "Grant access to autocore",
"read": {
"ubus": {
"luci": [ "getCPUInfo", "getETHInfo", "getTempInfo" ]
"luci": [ "getCPUInfo", "getTempInfo" ],
"network.device": [ "status" ]
}
}
}