소스 검색

Merge branch 'master' into refactoring/ts

# Conflicts:
#	src/models/realm.js
#	test/services/checkBrokenConnections/index.ts
afrokick 5 년 전
부모
커밋
d46628067b
6개의 변경된 파일19개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 0
      .gitpod.yml
  2. 2 0
      README.md
  3. 5 0
      package-lock.json
  4. 2 1
      package.json
  5. 2 2
      test/models/realm.ts
  6. 1 1
      test/services/checkBrokenConnections/index.ts

+ 7 - 0
.gitpod.yml

@@ -0,0 +1,7 @@
+tasks:
+  - init: npm i
+    command: npm start
+
+ports:
+  - port: 9000
+    onOpen: open-preview

+ 2 - 0
README.md

@@ -4,6 +4,8 @@
 
 PeerServer helps broker connections between PeerJS clients. Data is not proxied through the server.
 
+[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/peers/peerjs-server)
+
 ## [https://peerjs.com](https://peerjs.com)
 
 ### Run PeerServer

+ 5 - 0
package-lock.json

@@ -4738,6 +4738,11 @@
       "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
       "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
     },
+    "uuid4": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmjs.org/uuid4/-/uuid4-1.1.4.tgz",
+      "integrity": "sha512-Gr1q2k40LpF8CokcnQFjPDsdslzJbTCTBG5xQIEflUov431gFkY5KduiGIeKYAamkQnNn4IfdHJbLnl9Bib8TQ=="
+    },
     "v8-compile-cache": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz",

+ 2 - 1
package.json

@@ -34,6 +34,7 @@
     "cors": "~2.8.4",
     "express": "^4.17.1",
     "optimist": "~0.6.1",
+    "uuid4": "^1.1.4",
     "ws": "^7.1.2"
   },
   "devDependencies": {
@@ -53,6 +54,6 @@
     "typescript": "^3.5.3"
   },
   "engines": {
-    "node": "^10"
+    "node": ">=10"
   }
 }

+ 2 - 2
test/models/realm.ts

@@ -4,9 +4,9 @@ import { Client } from '../../src/models/client';
 
 describe('Realm', () => {
   describe('#generateClientId', () => {
-    it('should generate a 16-character ID', () => {
+    it('should generate a 36-character UUID', () => {
       const realm = new Realm();
-      expect(realm.generateClientId().length).to.eq(16);
+      expect(realm.generateClientId().length).to.eq(36);
     });
   });
 

+ 1 - 1
test/services/checkBrokenConnections/index.ts

@@ -17,7 +17,7 @@ describe('checkBrokenConnections service', () => {
             expect(realm.getClientById('id')).to.be.undefined;
             checkBrokenConnections.stop();
             done();
-        }, checkBrokenConnections.checkInterval * 2 + 10);
+        }, checkBrokenConnections.checkInterval * 2 + 30);
     });
 
     it('should remove client after 1 ping', (done) => {