Skip to content

Commit

Permalink
update systeminformation (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 authored Sep 30, 2023
1 parent 064c555 commit 30c55c1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"reflect-metadata": "0.1.13",
"rxjs": "7.8.1",
"semver": "7.5.4",
"systeminformation": "5.16.9",
"systeminformation": "5.21.9",
"tail": "2.2.6",
"tar": "6.2.0",
"tcp-port-used": "1.0.2",
Expand Down
4 changes: 4 additions & 0 deletions src/bin/hb-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ export class HomebridgeServiceHelper {
*/
public async printPostInstallInstructions() {
const defaultAdapter = await si.networkInterfaceDefault();
// These ts-ignore should be able to be removed in the next major release of 'systeminformation' (v6)
// See https://github.com/sebhildebrandt/systeminformation/issues/775#issuecomment-1741836906
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const defaultInterface = (await si.networkInterfaces()).find(x => x.iface === defaultAdapter);

console.log('\nManage Homebridge by going to one of the following in your browser:\n');
Expand Down
6 changes: 5 additions & 1 deletion src/modules/server/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class ServerService {

/**
* Return a single device pairing
* @param deviceId
* @param deviceId
*/
public async getDevicePairingById(deviceId: string) {
const persistPath = path.join(this.configService.storagePath, 'persist');
Expand Down Expand Up @@ -343,6 +343,10 @@ export class ServerService {
public async getSystemNetworkInterfaces(): Promise<si.Systeminformation.NetworkInterfacesData[]> {
const fromCache: si.Systeminformation.NetworkInterfacesData[] = this.serverServiceCache.get('network-interfaces');

// These ts-ignore should be able to be removed in the next major release of 'systeminformation' (v6)
// See https://github.com/sebhildebrandt/systeminformation/issues/775#issuecomment-1741836906
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const networkInterfaces = fromCache || (await si.networkInterfaces()).filter((adapter) => {
return !adapter.internal
&& (adapter.ip4 || (adapter.ip6));
Expand Down
5 changes: 5 additions & 0 deletions src/modules/status/status.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ export class StatusService {
}

const defaultInterfaceName = await si.networkInterfaceDefault();

// These ts-ignore should be able to be removed in the next major release of 'systeminformation' (v6)
// See https://github.com/sebhildebrandt/systeminformation/issues/775#issuecomment-1741836906
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const defaultInterface = defaultInterfaceName ? (await si.networkInterfaces()).find(x => x.iface === defaultInterfaceName) : undefined;

if (defaultInterface) {
Expand Down

0 comments on commit 30c55c1

Please sign in to comment.