mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-21 22:54:53 +08:00
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)
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
window.URL = window.URL || window.webkitURL;
|
window.URL = window.URL || window.webkitURL;
|
||||||
window.isRtcSupported = !!(window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection);
|
window.isRtcSupported = !!(window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection);
|
||||||
|
|
||||||
|
if (!window.isRtcSupported) alert("WebRTC must be enabled for PairDrop to work");
|
||||||
|
|
||||||
class ServerConnection {
|
class ServerConnection {
|
||||||
|
|
||||||
constructor() {
|
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 {
|
class PeersManager {
|
||||||
|
|
||||||
constructor(serverConnection) {
|
constructor(serverConnection) {
|
||||||
@@ -682,11 +675,7 @@ class PeersManager {
|
|||||||
if (this.peers[peer.id].roomType !== msg.roomType) return;
|
if (this.peers[peer.id].roomType !== msg.roomType) return;
|
||||||
this.peers[peer.id].refresh();
|
this.peers[peer.id].refresh();
|
||||||
}
|
}
|
||||||
if (window.isRtcSupported && peer.rtcSupported) {
|
this.peers[peer.id] = new RTCPeer(this._server, peer.id, msg.roomType, msg.roomSecret);
|
||||||
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);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user