mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-25 17:26:18 -04:00
readd persistent peerId via sessionStorage
This commit is contained in:
parent
8dc0f1cb0c
commit
621c525d11
2 changed files with 16 additions and 5 deletions
|
@ -43,6 +43,7 @@ class ServerConnection {
|
|||
this.send({ type: 'pong' });
|
||||
break;
|
||||
case 'display-name':
|
||||
sessionStorage.setItem("peer_id", msg.message.peerId);
|
||||
Events.fire('display-name', msg);
|
||||
break;
|
||||
default:
|
||||
|
@ -59,7 +60,11 @@ class ServerConnection {
|
|||
// hack to detect if deployment or development environment
|
||||
const protocol = location.protocol.startsWith('https') ? 'wss' : 'ws';
|
||||
const webrtc = window.isRtcSupported ? '/webrtc' : '/fallback';
|
||||
return protocol + '://' + location.host + location.pathname + 'server' + webrtc;
|
||||
let url = new URL(protocol + '://' + location.host + location.pathname + 'server' + webrtc);
|
||||
if (sessionStorage.getItem('peer_id')) {
|
||||
url.searchParams.append('peer_id', sessionStorage.getItem('peer_id'))
|
||||
}
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
_disconnect() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue