mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 23:55:13 +08:00
💋 Sync 2026-07-26 20:25:59
This commit is contained in:
1 parent
6efc8c18ce
commit
4069ab0119
19 files changed
+164
-102
No files matched your search
@@ -1398,6 +1398,21 @@ Network = baseclass.extend(/** @lends LuCI.network.prototype */ {
|
||||
}, this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtain configured radio devices without querying runtime state.
|
||||
*
|
||||
* @returns {Array<LuCI.network.WifiDevice>}
|
||||
* Returns radio instances populated from UCI only.
|
||||
*/
|
||||
getWifiDevicesFromConfig() {
|
||||
const rv = [];
|
||||
|
||||
for (const wfd of uci.sections('wireless', 'wifi-device'))
|
||||
rv.push(this.instantiateWifiDevice(wfd['.name'], {}));
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a {@link LuCI.network.WifiNetwork WifiNetwork} instance describing
|
||||
* the given wireless network.
|
||||
@@ -1443,6 +1458,30 @@ Network = baseclass.extend(/** @lends LuCI.network.prototype */ {
|
||||
}, this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Obtain configured wireless networks without querying runtime state.
|
||||
*
|
||||
* @returns {Array<LuCI.network.WifiNetwork>}
|
||||
* Returns wireless network instances populated from UCI only.
|
||||
*/
|
||||
getWifiNetworksFromConfig() {
|
||||
const rv = [];
|
||||
|
||||
for (const wifiIface of uci.sections('wireless', 'wifi-iface')) {
|
||||
const sid = wifiIface['.name'];
|
||||
const netid = getWifiNetidBySid(sid);
|
||||
|
||||
rv.push(this.instantiateWifiNetwork(sid, wifiIface.device, {},
|
||||
L.toArray(netid)[0], null));
|
||||
}
|
||||
|
||||
rv.sort(function(a, b) {
|
||||
return L.naturalCompare(a.getID(), b.getID());
|
||||
});
|
||||
|
||||
return rv;
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a new wireless network to the configuration and sets its options
|
||||
* to the provided values.
|
||||
@@ -3579,7 +3618,7 @@ WifiDevice = baseclass.extend(/** @lends LuCI.network.WifiDevice.prototype */ {
|
||||
* Returns `true` when the radio device is up, else `false`.
|
||||
*/
|
||||
isUp() {
|
||||
if (L.isObject(_state.radios[this.sid]))
|
||||
if (_state != null && L.isObject(_state.radios[this.sid]))
|
||||
return (_state.radios[this.sid].up == true);
|
||||
|
||||
return false;
|
||||
@@ -3930,6 +3969,9 @@ WifiNetwork = baseclass.extend(/** @lends LuCI.network.WifiNetwork.prototype */
|
||||
* Returns `true` when the network is up, else `false`.
|
||||
*/
|
||||
isUp() {
|
||||
if (_state == null)
|
||||
return false;
|
||||
|
||||
const device = this.getDevice();
|
||||
|
||||
if (device == null)
|
||||
|
||||
Reference in new issue
Block a user