uuid() fix unique mac address issue (Android)

This commit is contained in:
Sebastian Hildebrandt 2023-02-28 11:32:28 +01:00
parent 35f3b3d3c1
commit b5f5c4eceb
4 changed files with 27 additions and 17 deletions

View File

@ -82,7 +82,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- | | ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.17.11 | 2023-02-27 | `blockDevices()` raid added label, uuid (linux) | | 5.17.12 | 2023-02-28 | `uuid()` fix unique mac address issue (Android) |
| 5.17.11 | 2023-02-27 | `blockDevices()` raid added label, uuid (linux) |
| 5.17.10 | 2023-02-23 | `blockDevices()` fixed parsing raids (linux) | | 5.17.10 | 2023-02-23 | `blockDevices()` fixed parsing raids (linux) |
| 5.17.9 | 2023-02-11 | `system()` fixed model Apple Silicon | | 5.17.9 | 2023-02-11 | `system()` fixed model Apple Silicon |
| 5.17.8 | 2023-01-30 | `system()` improved virtual host detection for Parallels | | 5.17.8 | 2023-01-30 | `system()` improved virtual host detection for Parallels |

View File

@ -57,6 +57,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.17.12</th>
<td>2023-02-28</td>
<td><span class="code">uuid()</span> fix unique mac address issue (Android)</td>
</tr>
<tr> <tr>
<th scope="row">5.17.11</th> <th scope="row">5.17.11</th>
<td>2023-02-27</td> <td>2023-02-27</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo"> <img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.17.10</span></div> <div class="version">New Version: <span id="version">5.17.12</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button> <button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div> </div>
<div class="down"> <div class="down">

View File

@ -1047,25 +1047,29 @@ function shell(callback) {
exports.shell = shell; exports.shell = shell;
function getUniqueMacAdresses() { function getUniqueMacAdresses() {
const ifaces = os.networkInterfaces();
let macs = []; let macs = [];
for (let dev in ifaces) { try {
if ({}.hasOwnProperty.call(ifaces, dev)) { const ifaces = os.networkInterfaces();
ifaces[dev].forEach(function (details) { for (let dev in ifaces) {
if (details && details.mac && details.mac !== '00:00:00:00:00:00') { if ({}.hasOwnProperty.call(ifaces, dev)) {
const mac = details.mac.toLowerCase(); ifaces[dev].forEach(function (details) {
if (macs.indexOf(mac) === -1) { if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
macs.push(mac); const mac = details.mac.toLowerCase();
if (macs.indexOf(mac) === -1) {
macs.push(mac);
}
} }
} });
}); }
} }
macs = macs.sort(function (a, b) {
if (a < b) { return -1; }
if (a > b) { return 1; }
return 0;
});
} catch (e) {
macs.push('00:00:00:00:00:00');
} }
macs = macs.sort(function (a, b) {
if (a < b) { return -1; }
if (a > b) { return 1; }
return 0;
});
return macs; return macs;
} }