Skip to content

Commit d6ad1e4

Browse files
authored
Merge pull request #37 from isontheline/staging
chore: Update systeminformation dependency to version 5.23.5
2 parents 95dda33 + 8797d3e commit d6ad1e4

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.vscode/launch.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [],
7+
"console": "integratedTerminal",
8+
"outputCapture": "std"
9+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
"typescript": "^4.3.2"
254254
},
255255
"dependencies": {
256-
"systeminformation": "5.12.3"
256+
"systeminformation": "5.23.5"
257257
},
258258
"bugs": {
259259
"url": "https://github.com/isontheline/vscode-sysmon/issues"

src/command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Command {
2626
env.clipboard.writeText(ip);
2727
window.showInformationMessage(`The IP ${ip} was copied successfully`);
2828
} else {
29-
window.showInformationMessage(`Not found IP`);
29+
window.showInformationMessage(`IP Not Found`);
3030
}
3131
} catch (err) {
3232
if (err instanceof Error) {

src/sysinfo/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,15 @@ export async function getLoadavg() {
3939
export async function getIP() {
4040
const defaultInterface = await si.networkInterfaceDefault();
4141
const res = await si.networkInterfaces();
42-
const cur = res.find(item => item.iface === defaultInterface);
43-
return cur?.ip4;
42+
if (!Array.isArray(res)) {
43+
return res.ip4;
44+
}
45+
for (const item of res) {
46+
if (item.iface === defaultInterface) {
47+
return item.ip4;
48+
}
49+
}
50+
return null;
4451
}
4552

4653
export async function getNetworkSpeed() {

0 commit comments

Comments
 (0)