@cocreate/socket-server 1.12.1 → 1.13.1
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/.github/workflows/automated.yml +39 -15
- package/CHANGELOG.md +20 -0
- package/CoCreate.config.js +3 -5
- package/package.json +2 -4
- package/src/index.js +3 -1
|
@@ -42,18 +42,42 @@ jobs:
|
|
|
42
42
|
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
43
43
|
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
upload:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
|
|
48
|
+
steps:
|
|
49
|
+
- name: Checkout
|
|
50
|
+
uses: actions/checkout@v3
|
|
51
|
+
|
|
52
|
+
- name: Setup Node.js
|
|
53
|
+
uses: actions/setup-node@v3
|
|
54
|
+
with:
|
|
55
|
+
node-version: 16
|
|
56
|
+
|
|
57
|
+
- name: Get Environment Variables
|
|
58
|
+
run: |
|
|
59
|
+
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
60
|
+
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
61
|
+
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
62
|
+
|
|
63
|
+
- name: Install @cocreate/cli
|
|
64
|
+
run: npm install -g @cocreate/cli
|
|
65
|
+
|
|
66
|
+
- name: CoCreate CLI Upload
|
|
67
|
+
run: coc upload
|
|
68
|
+
|
|
69
|
+
# docs:
|
|
70
|
+
# runs-on: ubuntu-latest
|
|
71
|
+
# steps:
|
|
72
|
+
# - name: Checkout
|
|
73
|
+
# uses: actions/checkout@v3
|
|
74
|
+
# - name: setup nodejs
|
|
75
|
+
# uses: actions/setup-node@v3
|
|
76
|
+
# with:
|
|
77
|
+
# node-version: 16
|
|
78
|
+
# - name: update documentation
|
|
79
|
+
# uses: CoCreate-app/CoCreate-docs@master
|
|
80
|
+
# env:
|
|
81
|
+
# organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
|
|
82
|
+
# key: ${{ secrets.COCREATE_KEY }}
|
|
83
|
+
# host: ${{ secrets.COCREATE_HOST }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [1.13.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.13.0...v1.13.1) (2023-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Refactor authentication method to use token decoding 🚀 ([249cf69](https://github.com/CoCreate-app/CoCreate-socket-server/commit/249cf69c3ce918a2d5bee324456008e1923d8226))
|
|
7
|
+
* Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([b7d21f3](https://github.com/CoCreate-app/CoCreate-socket-server/commit/b7d21f334dd160fbad19b4f3539b6adfbfed9861))
|
|
8
|
+
|
|
9
|
+
# [1.13.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.12.1...v1.13.0) (2023-06-10)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([c5ea592](https://github.com/CoCreate-app/CoCreate-socket-server/commit/c5ea592a82ee5ed079bb51e876e52eadfda8df31))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Add CLI prompts for "organization_id" and "db" string ([5e2b5ba](https://github.com/CoCreate-app/CoCreate-socket-server/commit/5e2b5babee1a28d084bd60c417d7e3c2b7ecdad0))
|
|
20
|
+
|
|
1
21
|
## [1.12.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.12.0...v1.12.1) (2023-06-08)
|
|
2
22
|
|
|
3
23
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/socket-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "CoCreate-socket-server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cocreate-socket",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"demo": "PORT=5000 node demo/server.js",
|
|
29
29
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
30
|
-
"docs": "node ./node_modules/@cocreate/docs/src/index.js",
|
|
31
30
|
"postinstall": "node ./node_modules/@cocreate/cli/check-coc.js"
|
|
32
31
|
},
|
|
33
32
|
"repository": {
|
|
@@ -44,8 +43,7 @@
|
|
|
44
43
|
"@cocreate/cli": "^1.29.3"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"@cocreate/
|
|
48
|
-
"@cocreate/uuid": "^1.4.15",
|
|
46
|
+
"@cocreate/uuid": "^1.4.16",
|
|
49
47
|
"ws": "7.5.9"
|
|
50
48
|
}
|
|
51
49
|
}
|
package/src/index.js
CHANGED
|
@@ -2,12 +2,14 @@ const WebSocket = require('ws');
|
|
|
2
2
|
const url = require("url");
|
|
3
3
|
const EventEmitter = require("events").EventEmitter;
|
|
4
4
|
const uid = require('@cocreate/uuid')
|
|
5
|
+
const { config } = require('@cocreate/cli')
|
|
5
6
|
|
|
6
7
|
class SocketServer extends EventEmitter {
|
|
7
8
|
constructor(server, prefix) {
|
|
8
9
|
super();
|
|
9
10
|
this.clients = new Map();
|
|
10
11
|
this.prefix = prefix || "crud";
|
|
12
|
+
config({ key: 'organization_id', prompt: 'Enter your organization_id: ' })
|
|
11
13
|
|
|
12
14
|
this.wss = new WebSocket.Server({ noServer: true });
|
|
13
15
|
this.wss.on('headers', (headers, request) => {
|
|
@@ -127,7 +129,7 @@ class SocketServer extends EventEmitter {
|
|
|
127
129
|
});
|
|
128
130
|
let user_id = null;
|
|
129
131
|
if (this.authenticate)
|
|
130
|
-
user_id = await this.authenticate.
|
|
132
|
+
user_id = await this.authenticate.decodeToken(req);
|
|
131
133
|
|
|
132
134
|
if (this.authorize) {
|
|
133
135
|
data.host = this.getHost(req)
|