@cocreate/socket-server 1.4.19 → 1.4.20
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 +7 -0
- package/package.json +1 -1
- package/src/index.js +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.4.20](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.4.19...v1.4.20) (2022-12-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* comment syncServer requires security improvements ([60f73de](https://github.com/CoCreate-app/CoCreate-socket-server/commit/60f73ded3927f7c6a5005b0f339e846ead920c2e))
|
|
7
|
+
|
|
1
8
|
## [1.4.19](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.4.18...v1.4.19) (2022-12-07)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -132,9 +132,9 @@ class SocketServer extends EventEmitter{
|
|
|
132
132
|
// return;
|
|
133
133
|
// }
|
|
134
134
|
|
|
135
|
-
const
|
|
135
|
+
const {action, data} = JSON.parse(message)
|
|
136
136
|
|
|
137
|
-
if (
|
|
137
|
+
if (action) {
|
|
138
138
|
this.recordTransfer('in', message, organization_id)
|
|
139
139
|
|
|
140
140
|
let user_id = null;
|
|
@@ -143,9 +143,13 @@ class SocketServer extends EventEmitter{
|
|
|
143
143
|
|
|
144
144
|
//. check permission
|
|
145
145
|
if (this.permissionInstance) {
|
|
146
|
-
const passStatus = await this.permissionInstance.check(
|
|
146
|
+
const passStatus = await this.permissionInstance.check(action, data, req, user_id)
|
|
147
147
|
if (passStatus !== true) {
|
|
148
|
-
|
|
148
|
+
// if (action == 'syncServer' && passStatus.database === true)
|
|
149
|
+
// if (action == 'syncServer')
|
|
150
|
+
// this.emit(action, socket, data);
|
|
151
|
+
// else
|
|
152
|
+
this.send(socket, 'Access Denied', passStatus)
|
|
149
153
|
return;
|
|
150
154
|
}
|
|
151
155
|
}
|
|
@@ -158,7 +162,7 @@ class SocketServer extends EventEmitter{
|
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
//. checking async status....
|
|
161
|
-
if (
|
|
165
|
+
if (data.async == true) {
|
|
162
166
|
console.log('async true')
|
|
163
167
|
const asyncMessage = this.asyncMessages.get(socket.config.key);
|
|
164
168
|
socket.config.asyncId = uid.generate();
|
|
@@ -167,7 +171,7 @@ class SocketServer extends EventEmitter{
|
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
this.emit(
|
|
174
|
+
this.emit(action, socket, data);
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
} catch(e) {
|