signalk-onvif-camera 1.1.0 → 1.1.2

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.
Files changed (39) hide show
  1. package/README.md +93 -91
  2. package/dist/index.js +8 -4
  3. package/dist/lib/config/defaults.js +0 -1
  4. package/dist/lib/modules/device.js +0 -1
  5. package/dist/lib/modules/http-auth.js +0 -1
  6. package/dist/lib/modules/service-device.js +0 -1
  7. package/dist/lib/modules/service-events.js +0 -1
  8. package/dist/lib/modules/service-media.js +0 -1
  9. package/dist/lib/modules/service-ptz.js +0 -1
  10. package/dist/lib/modules/soap.js +0 -1
  11. package/dist/lib/node-onvif.js +0 -1
  12. package/dist/lib/types.js +0 -1
  13. package/dist/lib/utils/validation.js +0 -1
  14. package/package.json +58 -59
  15. package/public/index.html +175 -175
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.js.map +0 -1
  18. package/dist/lib/config/defaults.d.ts +0 -4
  19. package/dist/lib/config/defaults.js.map +0 -1
  20. package/dist/lib/modules/device.d.ts +0 -1
  21. package/dist/lib/modules/device.js.map +0 -1
  22. package/dist/lib/modules/http-auth.d.ts +0 -1
  23. package/dist/lib/modules/http-auth.js.map +0 -1
  24. package/dist/lib/modules/service-device.d.ts +0 -1
  25. package/dist/lib/modules/service-device.js.map +0 -1
  26. package/dist/lib/modules/service-events.d.ts +0 -1
  27. package/dist/lib/modules/service-events.js.map +0 -1
  28. package/dist/lib/modules/service-media.d.ts +0 -1
  29. package/dist/lib/modules/service-media.js.map +0 -1
  30. package/dist/lib/modules/service-ptz.d.ts +0 -1
  31. package/dist/lib/modules/service-ptz.js.map +0 -1
  32. package/dist/lib/modules/soap.d.ts +0 -1
  33. package/dist/lib/modules/soap.js.map +0 -1
  34. package/dist/lib/node-onvif.d.ts +0 -1
  35. package/dist/lib/node-onvif.js.map +0 -1
  36. package/dist/lib/types.d.ts +0 -180
  37. package/dist/lib/types.js.map +0 -1
  38. package/dist/lib/utils/validation.d.ts +0 -4
  39. package/dist/lib/utils/validation.js.map +0 -1
package/README.md CHANGED
@@ -1,91 +1,93 @@
1
- # signalk-onvif-camera
2
-
3
- ONVIF Camera interface for Signal K. For IP cameras that support ONVIF control, fixed and PTZ.
4
-
5
- ## Installation
6
-
7
- Install via the Signal K Appstore, or manually:
8
-
9
- ```bash
10
- npm install signalk-onvif-camera
11
- ```
12
-
13
- ## Plugin Configuration
14
-
15
- ![config](doc/config.jpg)
16
-
17
- - Enter ONVIF profile username and password
18
- - Add camera IP addresses to the list
19
-
20
- ## ONVIF Camera Setup
21
-
22
- Example of HikVision IP camera ONVIF configuration:
23
-
24
- ![onvif](doc/onvif.jpg)
25
-
26
- - Add an ONVIF user to your IP camera if applicable
27
-
28
- ## Webapp
29
-
30
- ![webapp](doc/webapp.jpg)
31
-
32
- Access the webapp from the Signal K Webapps menu by selecting "Signalk-onvif-camera".
33
-
34
- ## Camera Service
35
-
36
- ![service](doc/service.jpg)
37
-
38
- - ONVIF cameras are discovered on the local network
39
- - Select a device from the dropdown menu
40
- - Press "Connect" to connect to the camera
41
-
42
- ## Camera Controls
43
-
44
- ![inuse](doc/inuse.jpg)
45
-
46
- - PTZ controls: pan, tilt, and home button
47
- - Zoom in/out
48
- - Adjustable control speed
49
- - Disconnect
50
- - Hide/show controls
51
-
52
- ## Development
53
-
54
- ```bash
55
- npm install
56
- npm run build # Build frontend (cleans public/ first)
57
- npm run dev # Vite dev server
58
- npm test # Run tests with coverage
59
- npm run lint # Lint with ESLint
60
- ```
61
-
62
- ## Version control
63
-
64
- - v0.0.1, 1st version for testing
65
- - v0.0.2, license added
66
- - v0.1.0, 1st release
67
- - v0.1.1, ONVIF LAN selection
68
- - v0.1.2, Webpack bundled
69
- - v0.1.3, Webapp icon added
70
- - v0.1.4, updated to npm packages
71
- - v0.2.0, hide controls
72
- - v0.2.1, version update
73
- - v0.3.0, ws error handling
74
- - v0.3.1, icon loading error
75
- - v0.4.0, code refactoring
76
- - v0.5.0, improvements to streaming and viewing
77
- - v0.6.0, replace devcert with selfsigned
78
- - v0.6.1, extra console logs removed
79
- - v0.7.0, certs stored to permanent location
80
- - v0.7.1, fix WebSocket connection issues
81
- - v0.8.0, webpack changed to vite
82
- - v1.0.0: WebSocket noServer mode, build pipeline cleanup
83
- - v1.1.0: migrated TypeScript, hardened ONVIF discovery, auth, snapshot/MJPEG streaming, reconnect and shutdown behavior
84
-
85
- ## Credits
86
-
87
- https://github.com/futomi/node-onvif
88
-
89
- ## License
90
-
91
- MIT
1
+ # signalk-onvif-camera
2
+
3
+ ONVIF Camera interface for Signal K. For IP cameras that support ONVIF control, fixed and PTZ.
4
+
5
+ ## Installation
6
+
7
+ Install via the Signal K Appstore, or manually:
8
+
9
+ ```bash
10
+ npm install signalk-onvif-camera
11
+ ```
12
+
13
+ ## Plugin Configuration
14
+
15
+ ![config](doc/config.jpg)
16
+
17
+ - Enter ONVIF profile username and password
18
+ - Add camera IP addresses to the list
19
+
20
+ ## ONVIF Camera Setup
21
+
22
+ Example of HikVision IP camera ONVIF configuration:
23
+
24
+ ![onvif](doc/onvif.jpg)
25
+
26
+ - Add an ONVIF user to your IP camera if applicable
27
+
28
+ ## Webapp
29
+
30
+ ![webapp](doc/webapp.jpg)
31
+
32
+ Access the webapp from the Signal K Webapps menu by selecting "Signalk-onvif-camera".
33
+
34
+ ## Camera Service
35
+
36
+ ![service](doc/service.jpg)
37
+
38
+ - ONVIF cameras are discovered on the local network
39
+ - Select a device from the dropdown menu
40
+ - Press "Connect" to connect to the camera
41
+
42
+ ## Camera Controls
43
+
44
+ ![inuse](doc/inuse.jpg)
45
+
46
+ - PTZ controls: pan, tilt, and home button
47
+ - Zoom in/out
48
+ - Adjustable control speed
49
+ - Disconnect
50
+ - Hide/show controls
51
+
52
+ ## Development
53
+
54
+ ```bash
55
+ npm install
56
+ npm run build # Build frontend (cleans public/ first)
57
+ npm run dev # Vite dev server
58
+ npm test # Run tests with coverage
59
+ npm run lint # Lint with ESLint
60
+ ```
61
+
62
+ ## Version control
63
+
64
+ - v0.0.1, 1st version for testing
65
+ - v0.0.2, license added
66
+ - v0.1.0, 1st release
67
+ - v0.1.1, ONVIF LAN selection
68
+ - v0.1.2, Webpack bundled
69
+ - v0.1.3, Webapp icon added
70
+ - v0.1.4, updated to npm packages
71
+ - v0.2.0, hide controls
72
+ - v0.2.1, version update
73
+ - v0.3.0, ws error handling
74
+ - v0.3.1, icon loading error
75
+ - v0.4.0, code refactoring
76
+ - v0.5.0, improvements to streaming and viewing
77
+ - v0.6.0, replace devcert with selfsigned
78
+ - v0.6.1, extra console logs removed
79
+ - v0.7.0, certs stored to permanent location
80
+ - v0.7.1, fix WebSocket connection issues
81
+ - v0.8.0, webpack changed to vite
82
+ - v1.0.0: WebSocket noServer mode, build pipeline cleanup
83
+ - v1.1.0: migrated TypeScript, hardened ONVIF discovery, auth, snapshot/MJPEG streaming, reconnect and shutdown behavior
84
+ - v1.1.1: clean-up build output
85
+ - v1.1.2: small fixes
86
+
87
+ ## Credits
88
+
89
+ https://github.com/futomi/node-onvif
90
+
91
+ ## License
92
+
93
+ MIT
package/dist/index.js CHANGED
@@ -28,6 +28,11 @@ const WebSocket = require('ws');
28
28
  const fs = require('fs');
29
29
  const path = require('path');
30
30
  const { validateDeviceAddress, validatePTZCommand } = require('./lib/utils/validation');
31
+ function hasUpgradeListenerServer(server) {
32
+ return Boolean(server
33
+ && typeof server.on === 'function'
34
+ && typeof server.removeListener === 'function');
35
+ }
31
36
  function isRecord(value) {
32
37
  return typeof value === 'object' && value !== null;
33
38
  }
@@ -182,11 +187,11 @@ module.exports = function createPlugin(app) {
182
187
  wsServer.close();
183
188
  wsServer = null;
184
189
  }
185
- if (upgradeHandler && app.server) {
190
+ if (upgradeHandler && hasUpgradeListenerServer(app.server)) {
186
191
  app.server.removeListener('upgrade', upgradeHandler);
187
192
  upgradeHandler = null;
188
193
  }
189
- if (app.server) {
194
+ if (hasUpgradeListenerServer(app.server)) {
190
195
  // Use noServer mode so we don't interfere with SignalK's own
191
196
  // WebSocket server on the same HTTP server. With the default
192
197
  // { server } option the ws library adds its own 'upgrade'
@@ -410,7 +415,7 @@ module.exports = function createPlugin(app) {
410
415
  });
411
416
  mjpegStreams.clear();
412
417
  closeActiveWsConnections();
413
- if (upgradeHandler && app.server) {
418
+ if (upgradeHandler && hasUpgradeListenerServer(app.server)) {
414
419
  app.server.removeListener('upgrade', upgradeHandler);
415
420
  upgradeHandler = null;
416
421
  }
@@ -1485,4 +1490,3 @@ module.exports = function createPlugin(app) {
1485
1490
  }
1486
1491
  return plugin;
1487
1492
  };
1488
- //# sourceMappingURL=index.js.map
@@ -33,4 +33,3 @@ module.exports = {
33
33
  pongTimeout: 5000 // milliseconds
34
34
  }
35
35
  };
36
- //# sourceMappingURL=defaults.js.map
@@ -769,4 +769,3 @@ OnvifDevice.prototype._getSnapshotUri = function (directUri) {
769
769
  return rewriteUriHost(this.address, resolvedDirectUri);
770
770
  };
771
771
  module.exports = OnvifDevice;
772
- //# sourceMappingURL=device.js.map
@@ -187,4 +187,3 @@ OnvifHttpAuth.prototype._parseAuthHeader = function (h) {
187
187
  return o;
188
188
  };
189
189
  module.exports = new OnvifHttpAuth();
190
- //# sourceMappingURL=http-auth.js.map
@@ -1662,4 +1662,3 @@ OnvifServiceDevice.prototype.getServiceCapabilities = function (callback) {
1662
1662
  }
1663
1663
  };
1664
1664
  module.exports = OnvifServiceDevice;
1665
- //# sourceMappingURL=service-device.js.map
@@ -229,4 +229,3 @@ OnvifServiceEvents.prototype.getServiceCapabilities = function (callback) {
229
229
  }
230
230
  };
231
231
  module.exports = OnvifServiceEvents;
232
- //# sourceMappingURL=service-events.js.map
@@ -1556,4 +1556,3 @@ OnvifServiceMedia.prototype.getSnapshotUri = function (params, callback) {
1556
1556
  }
1557
1557
  };
1558
1558
  module.exports = OnvifServiceMedia;
1559
- //# sourceMappingURL=service-media.js.map
@@ -944,4 +944,3 @@ OnvifServicePtz.prototype.removePreset = function (params, callback) {
944
944
  }
945
945
  };
946
946
  module.exports = OnvifServicePtz;
947
- //# sourceMappingURL=service-ptz.js.map
@@ -366,4 +366,3 @@ OnvifSoap.prototype._getTypeOfValue = function (value) {
366
366
  }
367
367
  };
368
368
  module.exports = new OnvifSoap();
369
- //# sourceMappingURL=soap.js.map
@@ -319,4 +319,3 @@ class Onvif {
319
319
  }
320
320
  }
321
321
  module.exports = new Onvif();
322
- //# sourceMappingURL=node-onvif.js.map
package/dist/lib/types.js CHANGED
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -134,4 +134,3 @@ module.exports = {
134
134
  validatePluginOptions,
135
135
  sanitizeString
136
136
  };
137
- //# sourceMappingURL=validation.js.map
package/package.json CHANGED
@@ -1,59 +1,58 @@
1
- {
2
- "name": "signalk-onvif-camera",
3
- "version": "1.1.0",
4
- "description": "Signal K Onvif Camera Interface",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist/",
9
- "public/",
10
- "doc/"
11
- ],
12
- "engines": {
13
- "node": ">=18.0.0"
14
- },
15
- "scripts": {
16
- "test": "jest --coverage",
17
- "test:watch": "jest --watch",
18
- "lint": "eslint .",
19
- "lint:fix": "eslint . --ext .js,.ts --fix",
20
- "typecheck": "tsc --noEmit",
21
- "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build",
22
- "clean": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true});require('fs').rmSync('./public',{recursive:true,force:true})\"",
23
- "dev": "vite",
24
- "build": "npm run clean && tsc -p tsconfig.build.json && vite build",
25
- "preview": "vite preview"
26
- },
27
- "signalk": {
28
- "appIcon": "./icons/icon-72x72.png",
29
- "displayName": "Signalk-onvif-camera"
30
- },
31
- "keywords": [
32
- "signalk-node-server-plugin",
33
- "signalk-webapp",
34
- "signalk-category-utility"
35
- ],
36
- "repository": {
37
- "type": "git",
38
- "url": "https://github.com/KEGustafsson/signalk-onvif-camera"
39
- },
40
- "author": "Karl-Erik Gustafsson",
41
- "license": "MIT",
42
- "dependencies": {
43
- "ws": "^8.0.0",
44
- "xml2js": "^0.6.2"
45
- },
46
- "devDependencies": {
47
- "@types/jest": "^30.0.0",
48
- "@types/jquery": "^4.0.0",
49
- "@types/node": "^25.5.0",
50
- "@typescript-eslint/eslint-plugin": "^8.57.1",
51
- "@typescript-eslint/parser": "^8.57.1",
52
- "bootstrap": "^3.4.1",
53
- "eslint": "^8.57.0",
54
- "jest": "^29.7.0",
55
- "ts-jest": "^29.4.6",
56
- "typescript": "^5.9.3",
57
- "vite": "^6.0.5"
58
- }
59
- }
1
+ {
2
+ "name": "signalk-onvif-camera",
3
+ "version": "1.1.2",
4
+ "description": "Signal K Onvif Camera Interface",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/",
8
+ "public/",
9
+ "doc/"
10
+ ],
11
+ "engines": {
12
+ "node": ">=18.0.0"
13
+ },
14
+ "scripts": {
15
+ "test": "jest --coverage",
16
+ "test:watch": "jest --watch",
17
+ "lint": "eslint .",
18
+ "lint:fix": "eslint . --ext .js,.ts --fix",
19
+ "typecheck": "tsc --noEmit",
20
+ "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build",
21
+ "clean": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true});require('fs').rmSync('./public',{recursive:true,force:true})\"",
22
+ "dev": "vite",
23
+ "build": "npm run clean && tsc -p tsconfig.build.json && vite build",
24
+ "preview": "vite preview"
25
+ },
26
+ "signalk": {
27
+ "appIcon": "./icons/icon-72x72.png",
28
+ "displayName": "Signalk-onvif-camera"
29
+ },
30
+ "keywords": [
31
+ "signalk-node-server-plugin",
32
+ "signalk-webapp",
33
+ "signalk-category-utility"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/KEGustafsson/signalk-onvif-camera"
38
+ },
39
+ "author": "Karl-Erik Gustafsson",
40
+ "license": "MIT",
41
+ "dependencies": {
42
+ "ws": "^8.0.0",
43
+ "xml2js": "^0.6.2"
44
+ },
45
+ "devDependencies": {
46
+ "@types/jest": "^30.0.0",
47
+ "@types/jquery": "^4.0.0",
48
+ "@types/node": "^25.5.0",
49
+ "@typescript-eslint/eslint-plugin": "^8.57.1",
50
+ "@typescript-eslint/parser": "^8.57.1",
51
+ "bootstrap": "^3.4.1",
52
+ "eslint": "^8.57.0",
53
+ "jest": "^29.7.0",
54
+ "ts-jest": "^29.4.6",
55
+ "typescript": "^5.9.3",
56
+ "vite": "^6.0.5"
57
+ }
58
+ }