Merge branch 'master' into enable_renaming

This commit is contained in:
schlagmichdoch 2023-03-04 20:52:10 +01:00
commit b7e7fd1b68
13 changed files with 160 additions and 63 deletions

View file

@ -52,16 +52,23 @@ class ServerConnection {
_onPairDeviceJoin(roomKey) {
if (!this._isConnected()) {
setTimeout(_ => this._onPairDeviceJoin(roomKey), 5000);
setTimeout(_ => this._onPairDeviceJoin(roomKey), 1000);
return;
}
this.send({ type: 'pair-device-join', roomKey: roomKey })
}
_setRtcConfig(config) {
window.rtcConfig = config;
}
_onMessage(msg) {
msg = JSON.parse(msg);
if (msg.type !== 'ping') console.log('WS:', msg);
switch (msg.type) {
case 'rtc-config':
this._setRtcConfig(msg.config);
break;
case 'peers':
Events.fire('peers', msg);
break;
@ -151,7 +158,7 @@ class ServerConnection {
console.log('WS: server disconnected');
Events.fire('notify-user', 'Connecting..');
clearTimeout(this._reconnectTimer);
this._reconnectTimer = setTimeout(_ => this._connect(), 5000);
this._reconnectTimer = setTimeout(_ => this._connect(), 1000);
Events.fire('ws-disconnected');
this._isReconnect = true;
}
@ -517,7 +524,7 @@ class RTCPeer extends Peer {
_openConnection(peerId, isCaller) {
this._isCaller = isCaller;
this._peerId = peerId;
this._conn = new RTCPeerConnection(RTCPeer.config);
this._conn = new RTCPeerConnection(window.rtcConfig);
this._conn.onicecandidate = e => this._onIceCandidate(e);
this._conn.onconnectionstatechange = _ => this._onConnectionStateChange();
this._conn.oniceconnectionstatechange = e => this._onIceConnectionStateChange(e);
@ -967,20 +974,3 @@ class Events {
return window.removeEventListener(type, callback, false);
}
}
RTCPeer.config = {
'sdpSemantics': 'unified-plan',
'iceServers': [
{
urls: 'stun:stun.l.google.com:19302'
},
{
urls: 'stun:openrelay.metered.ca:80'
},
{
urls: 'turn:openrelay.metered.ca:443',
username: 'openrelayproject',
credential: 'openrelayproject',
},
]
}

View file

@ -1,4 +1,4 @@
const cacheVersion = 'v1.2.2';
const cacheVersion = 'v1.3.0';
const cacheTitle = `pairdrop-included-ws-fallback-cache-${cacheVersion}`;
const urlsToCache = [
'index.html',

View file

@ -996,6 +996,13 @@ button::-moz-focus-inner {
margin: 8px 8px -16px;
}
#about section {
flex-grow: 1;
}
#about header {
align-self: end;
}
/* Loading Indicator */