node-red-contrib-homekit-bridged 1.6.1 → 1.7.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ const uuid = HapNodeJS.uuid;
30
30
  const StreamController = HapNodeJS.StreamController;
31
31
  const crypto = require('crypto');
32
32
  const fs = require('fs');
33
- const ip = require('ip');
33
+ const os = require('os');
34
34
  const spawn = require('child_process').spawn;
35
35
  const log = (0, logger_1.logger)('CameraSource');
36
36
  module.exports = {
@@ -249,17 +249,16 @@ Camera.prototype.prepareStream = function (request, callback) {
249
249
  sessionInfo['audio_srtp'] = Buffer.concat([srtp_key, srtp_salt]);
250
250
  sessionInfo['audio_ssrc'] = ssrc;
251
251
  }
252
- let currentAddress = ip.address(this.interfaceName);
253
- const addressResp = {
254
- address: currentAddress,
255
- };
256
- if (ip.isV4Format(currentAddress)) {
257
- addressResp['type'] = 'v4';
258
- }
259
- else {
260
- addressResp['type'] = 'v6';
252
+ const networkInterfaces = os.networkInterfaces();
253
+ if (this.interfaceName && networkInterfaces[this.interfaceName]) {
254
+ const currentAddress = networkInterfaces[this.interfaceName];
255
+ if (currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress[0]) {
256
+ response['address'] = {
257
+ address: currentAddress[0].address,
258
+ type: currentAddress[0].family === 'IPv4' ? 'v4' : 'v6',
259
+ };
260
+ }
261
261
  }
262
- response['address'] = addressResp;
263
262
  this.pendingSessions[uuid.unparse(sessionID)] = sessionInfo;
264
263
  callback(response);
265
264
  };
@@ -37,7 +37,10 @@ const MdnsUtils = () => {
37
37
  if (!availableInterfaces) {
38
38
  availableInterfaces = [];
39
39
  const networkInterfaces = os.networkInterfaces();
40
- Object.keys(networkInterfaces).forEach((key) => networkInterfaces[key].forEach((networkInterface) => availableInterfaces.push(networkInterface.address)));
40
+ Object.keys(networkInterfaces).forEach((key) => {
41
+ var _a;
42
+ return (_a = networkInterfaces[key]) === null || _a === void 0 ? void 0 : _a.forEach((networkInterface) => availableInterfaces.push(networkInterface.address));
43
+ });
41
44
  }
42
45
  return availableInterfaces.indexOf(value) > -1;
43
46
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "node-red-contrib-homekit-bridged",
3
- "version": "1.6.1",
3
+ "version": "1.7.0-dev.0",
4
4
  "description": "Node-RED nodes to simulate Apple HomeKit devices.",
5
5
  "main": "build/nodes/nrchkb.js",
6
6
  "scripts": {
7
7
  "build": "npm run clean && tsc",
8
- "clean": "rimraf build/lib build/**/*.js",
8
+ "clean": "del-cli \"build/lib\" \"build/**/*.js\"",
9
9
  "test": "mocha -r ts-node/register './src/**/*.test.[tj]s' --exit --timeout 30000",
10
10
  "prettier": "prettier --write \"**/*.{js,ts}\"",
11
11
  "eslint": "eslint \"src/**/*.ts\"",
@@ -43,40 +43,39 @@
43
43
  "homepage": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged#readme",
44
44
  "dependencies": {
45
45
  "@nrchkb/logger": "^2.0.2",
46
- "hap-nodejs": "0.11.1",
47
- "ip": "^2.0.1",
48
- "node-persist": "^3.1.3",
49
- "semver": "^7.6.0",
50
- "uuid": "^9.0.1"
46
+ "hap-nodejs": "0.12.2",
47
+ "node-persist": "^4.0.1",
48
+ "semver": "^7.6.2",
49
+ "uuid": "^10.0.0"
51
50
  },
52
51
  "devDependencies": {
53
- "@homebridge/ciao": "^1.1.8",
54
- "@node-red/registry": "^3.1.3",
52
+ "@homebridge/ciao": "^1.2.0",
53
+ "@node-red/registry": "^3.1.10",
55
54
  "@types/mocha": "^10.0.6",
56
- "@types/node": "^12",
55
+ "@types/node": "^18",
57
56
  "@types/node-persist": "^3.1.8",
58
- "@types/node-red": "^1.3.4",
59
- "@types/node-red-node-test-helper": "^0.3.3",
60
- "@types/semver": "^7.5.7",
57
+ "@types/node-red": "^1.3.5",
58
+ "@types/node-red-node-test-helper": "^0.3.4",
59
+ "@types/semver": "^7.5.8",
61
60
  "@types/uuid": "^9.0.8",
62
- "@typescript-eslint/eslint-plugin": "^7.0.2",
63
- "@typescript-eslint/parser": "^7.0.2",
61
+ "@typescript-eslint/eslint-plugin": "^7.13.0",
62
+ "@typescript-eslint/parser": "^7.13.0",
64
63
  "babel-eslint": "^10.1.0",
65
- "eslint": "^8.56.0",
64
+ "del-cli": "^5.1.0",
65
+ "eslint": "^8",
66
66
  "eslint-config-prettier": "^9.1.0",
67
67
  "eslint-plugin-prettier": "^5.1.3",
68
- "eslint-plugin-simple-import-sort": "^12.0.0",
68
+ "eslint-plugin-simple-import-sort": "^12.1.0",
69
69
  "husky": "^9.0.11",
70
- "mocha": "^10.3.0",
71
- "node-red": "^3.1.3",
72
- "node-red-node-test-helper": "^0.3.3",
73
- "prettier": "^3.2.5",
74
- "rimraf": "^5.0.5",
70
+ "mocha": "^10.4.0",
71
+ "node-red": "^3.1.10",
72
+ "node-red-node-test-helper": "^0.3.4",
73
+ "prettier": "^3.3.2",
75
74
  "ts-node": "^10.9.2",
76
- "typescript": "^5.3.3"
75
+ "typescript": "^5.4.5"
77
76
  },
78
77
  "engines": {
79
- "node": ">=12"
78
+ "node": ">=18"
80
79
  },
81
80
  "files": [
82
81
  "/build",