@cocreate/socket-server 1.21.7 → 1.21.9
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 +14 -0
- package/package.json +1 -1
- package/src/index.js +14 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.21.9](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.21.8...v1.21.9) (2023-11-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* sync console.log ([b49bb6a](https://github.com/CoCreate-app/CoCreate-socket-server/commit/b49bb6a2ccf8cf3f166b9f7acd511a28109202eb))
|
|
7
|
+
|
|
8
|
+
## [1.21.8](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.21.7...v1.21.8) (2023-11-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* url bug ([5265962](https://github.com/CoCreate-app/CoCreate-socket-server/commit/526596254d9554de67dc78b296abe57765cb51fc))
|
|
14
|
+
|
|
1
15
|
## [1.21.7](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.21.6...v1.21.7) (2023-11-09)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -57,8 +57,10 @@ class SocketServer extends EventEmitter {
|
|
|
57
57
|
socket.socketUrl = socket.origin + socket.pathname
|
|
58
58
|
|
|
59
59
|
if (socket.origin && socket.origin !== 'null') {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (socket.origin.includes('://'))
|
|
61
|
+
socket.host = new URL(socket.origin).host
|
|
62
|
+
else
|
|
63
|
+
socket.host = socket.origin;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
if (!organization || organization && organization.status !== false) {
|
|
@@ -414,14 +416,17 @@ class SocketServer extends EventEmitter {
|
|
|
414
416
|
return
|
|
415
417
|
|
|
416
418
|
for (let i = 0; i < data.object.length; i++) {
|
|
417
|
-
data.object[i].data
|
|
418
|
-
|
|
419
|
+
if (data.object[i].data) {
|
|
420
|
+
data.object[i].data._id = data.object[i]._id
|
|
421
|
+
data.object[i].data.sync = true
|
|
419
422
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
const authorized = await this.authorize.check(data.object[i].data, socket.user_id)
|
|
424
|
+
if (authorized && authorized.authorized)
|
|
425
|
+
socket.send(JSON.stringify(authorized.authorized));
|
|
426
|
+
else
|
|
427
|
+
socket.send(JSON.stringify(data.object[i].data));
|
|
428
|
+
} else
|
|
429
|
+
console.log('server sync missing data')
|
|
425
430
|
}
|
|
426
431
|
} else {
|
|
427
432
|
const sent = []
|