mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 07:05:05 -04:00
- Enable renaming of own display name permanently via UI
- Make peerId completely ephemeral - Stabilize RTCConnection by closing connections cleanly
This commit is contained in:
parent
a3b348d9b6
commit
d56ee87437
9 changed files with 377 additions and 115 deletions
11
index.js
11
index.js
|
@ -453,7 +453,7 @@ class Peer {
|
|||
this._setIP(request);
|
||||
|
||||
// set peer id
|
||||
this._setPeerId(request)
|
||||
this.id = crypto.randomUUID();
|
||||
|
||||
// is WebRTC supported ?
|
||||
this.rtcSupported = request.url.indexOf('webrtc') > -1;
|
||||
|
@ -525,15 +525,6 @@ class Peer {
|
|||
return false;
|
||||
}
|
||||
|
||||
_setPeerId(request) {
|
||||
let peer_id = new URL(request.url, "http://server").searchParams.get("peer_id");
|
||||
if (peer_id && Peer.isValidUuid(peer_id)) {
|
||||
this.id = peer_id;
|
||||
} else {
|
||||
this.id = crypto.randomUUID();
|
||||
}
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `<Peer id=${this.id} ip=${this.ip} rtcSupported=${this.rtcSupported}>`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue