فهرست منبع

Merge branch 'master' into rc

Jonas Gloning 2 سال پیش
والد
کامیت
965b5968f8
5فایلهای تغییر یافته به همراه548 افزوده شده و 278 حذف شده
  1. 3 3
      .github/workflows/release.yml
  2. 532 260
      package-lock.json
  3. 8 8
      package.json
  4. 3 5
      src/index.ts
  5. 2 2
      src/services/webSocketServer/index.ts

+ 3 - 3
.github/workflows/release.yml

@@ -10,18 +10,18 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
         with:
           fetch-depth: 0
       - name: Setup Node.js
-        uses: actions/setup-node@v2
+        uses: actions/setup-node@v3
         with:
           node-version: "lts/*"
       - name: Install dependencies
         run: npm ci
       - name: Import GPG key
         id: import_gpg
-        uses: crazy-max/ghaction-import-gpg@v4
+        uses: crazy-max/ghaction-import-gpg@v5
         with:
           gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
           passphrase: ${{ secrets.GPG_PASSPHRASE }}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 532 - 260
package-lock.json


+ 8 - 8
package.json

@@ -55,13 +55,13 @@
     "coverage": "nyc mocha",
     "coverage:lcov": "nyc --reporter=lcov mocha",
     "start": "node dist/bin/peerjs.js --port ${PORT:=9000}",
-    "dev": "nodemon --watch src -e ts --exec npm run start",
+    "dev": "nodemon --watch src -e ts --exec 'npm run build && npm run start'",
     "semantic-release": "semantic-release"
   },
   "dependencies": {
     "cors": "^2.8.5",
     "express": "^4.17.1",
-    "ws": "^7.2.3",
+    "ws": "^7.2.3 || ^8.0.0",
     "yargs": "^17.6.2"
   },
   "devDependencies": {
@@ -73,14 +73,14 @@
     "@types/chai": "^4.2.11",
     "@types/cors": "^2.8.6",
     "@types/express": "^4.17.3",
-    "@types/mocha": "^7.0.2",
+    "@types/mocha": "^10.0.0",
     "@types/node": "^14.18.33",
-    "@types/ws": "^7.2.3",
+    "@types/ws": "^7.2.3 || ^8.0.0",
     "@types/yargs": "^17.0.19",
-    "@typescript-eslint/eslint-plugin": "^2.24.0",
-    "@typescript-eslint/parser": "^2.24.0",
+    "@typescript-eslint/eslint-plugin": "^5.0.0",
+    "@typescript-eslint/parser": "^5.0.0",
     "chai": "^4.2.0",
-    "eslint": "^6.8.0",
+    "eslint": "^8.0.0",
     "mocha": "^10.1.0",
     "mock-socket": "^9.1.5",
     "nodemon": "^2.0.20",
@@ -88,7 +88,7 @@
     "parcel": "^2.8.2",
     "semantic-release": "^19.0.5",
     "source-map-support": "^0.5.21",
-    "ts-node": "^8.10.2",
+    "ts-node": "^10.0.0",
     "typescript": "^4.1.2"
   }
 }

+ 3 - 5
src/index.ts

@@ -1,8 +1,6 @@
 import express from "express";
 import http from "node:http";
 import https from "node:https";
-import {Server as HttpServer} from "node:http";
-import {Server as HttpsServer} from "node:https";
 import type {Express} from 'express-serve-static-core';
 
 import type {IConfig} from "./config";
@@ -12,7 +10,7 @@ import {createInstance} from "./instance";
 
 export type {MessageType} from "./enums"
 
-function ExpressPeerServer(server: HttpsServer | HttpServer, options?: Partial<IConfig>) {
+function ExpressPeerServer(server: https.Server | http.Server, options?: Partial<IConfig>) {
   const app = express();
 
   const newOptions: IConfig = {
@@ -36,7 +34,7 @@ function ExpressPeerServer(server: HttpsServer | HttpServer, options?: Partial<I
 	return app as Express & PeerServerEvents
 }
 
-function PeerServer(options: Partial<IConfig> = {}, callback?: (server: HttpsServer | HttpServer) => void) {
+function PeerServer(options: Partial<IConfig> = {}, callback?: (server: https.Server | http.Server) => void) {
   const app = express();
 
   let newOptions: IConfig = {
@@ -47,7 +45,7 @@ function PeerServer(options: Partial<IConfig> = {}, callback?: (server: HttpsSer
   const port = newOptions.port;
   const host = newOptions.host;
 
-  let server: HttpsServer | HttpServer;
+  let server: https.Server | http.Server;
 
   const { ssl, ...restOptions } = newOptions;
   if (ssl && Object.keys(ssl).length) {

+ 2 - 2
src/services/webSocketServer/index.ts

@@ -130,9 +130,9 @@ export class WebSocketServer extends EventEmitter implements IWebSocketServer {
     });
 
     // Handle messages from peers.
-    socket.on("message", (data: WebSocketLib.Data) => {
+    socket.on("message", (data) => {
       try {
-        const message = JSON.parse(data as string);
+        const message = JSON.parse(data.toString());
 
         message.src = client.getId();
 

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است