From c674e2c8d2c238a72666f2ff8a65bab6f61a7b8e Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Sat, 4 Feb 2023 17:03:25 +0100 Subject: [PATCH] remove WSPeer completely as the implementation has never been finished and routing all traffic through the server is not desirable for public PairDrop. ([see this issue for reasons](https://github.com/schlagmichdoch/PairDrop/issues/18#issuecomment-1416788548) --- public/scripts/network.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/public/scripts/network.js b/public/scripts/network.js index ff26d0d..6ab4201 100644 --- a/public/scripts/network.js +++ b/public/scripts/network.js @@ -1,6 +1,8 @@ window.URL = window.URL || window.webkitURL; window.isRtcSupported = !!(window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection); +if (!window.isRtcSupported) alert("WebRTC must be enabled for PairDrop to work"); + class ServerConnection { constructor() { @@ -632,15 +634,6 @@ class RTCPeer extends Peer { } } -class WSPeer extends Peer { - _send(message) { - message.to = this._peerId; - message.roomType = this._roomType; - message.roomSecret = this._roomSecret; - this._server.send(message); - } -} - class PeersManager { constructor(serverConnection) { @@ -682,11 +675,7 @@ class PeersManager { if (this.peers[peer.id].roomType !== msg.roomType) return; this.peers[peer.id].refresh(); } - if (window.isRtcSupported && peer.rtcSupported) { - this.peers[peer.id] = new RTCPeer(this._server, peer.id, msg.roomType, msg.roomSecret); - } else { - this.peers[peer.id] = new WSPeer(this._server, peer.id, msg.roomType, msg.roomSecret); - } + this.peers[peer.id] = new RTCPeer(this._server, peer.id, msg.roomType, msg.roomSecret); }) }