@cocreate/socket-server 1.24.2 → 1.25.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.25.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.3...v1.25.0) (2023-12-31)
2
+
3
+
4
+ ### Features
5
+
6
+ * Added '@cocreate/acme' for dynamic ssl management ([f01831b](https://github.com/CoCreate-app/CoCreate-socket-server/commit/f01831bf2d3a8a4812c369fb61927667af56f7d5))
7
+
8
+ ## [1.24.3](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.2...v1.24.3) (2023-12-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * if no sockets[i] continue ([fcab2cc](https://github.com/CoCreate-app/CoCreate-socket-server/commit/fcab2ccbf5ea6199ac2e2ceb111aa1fa6f23cf28))
14
+
1
15
  ## [1.24.2](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.1...v1.24.2) (2023-12-09)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.24.2",
3
+ "version": "1.25.0",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
package/src/index.js CHANGED
@@ -63,6 +63,9 @@ class SocketServer extends EventEmitter {
63
63
  socket.host = socket.origin;
64
64
  }
65
65
 
66
+ if (!await self.acme.checkCertificate(socket.host, organization_id))
67
+ return socket.send(JSON.stringify({ method: 'Access Denied', error: 'Host not whitelisted' }))
68
+
66
69
  if (!organization || organization && organization.status !== false) {
67
70
  let data = {
68
71
  socket,
@@ -461,6 +464,9 @@ class SocketServer extends EventEmitter {
461
464
  delete data.socket
462
465
 
463
466
  for (let i = 0; i < sockets.length; i++) {
467
+ if (!sockets[i])
468
+ continue
469
+
464
470
  const authorized = await this.authorize.check(data, sockets[i].user_id)
465
471
  if (authorized && authorized.authorized)
466
472
  sockets[i].send(JSON.stringify(authorized.authorized));