Compare commits

..

2 Commits

Author SHA1 Message Date
schlagmichdoch
27ac7786d0 increase version to v1.4.1 2023-03-06 03:48:23 +01:00
schlagmichdoch
edf2ab5eb3 revert some changes to regain stability 2023-03-06 03:47:24 +01:00
7 changed files with 17 additions and 25 deletions

View File

@@ -368,6 +368,10 @@ class PairDropServer {
// delete the peer
delete this._rooms[room][peer.id];
if (roomType === 'ip') {
peer.socket.terminate();
}
//if room is empty, delete the room
if (!Object.keys(this._rooms[room]).length) {
delete this._rooms[room];

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "pairdrop",
"version": "1.4.0",
"version": "1.4.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pairdrop",
"version": "1.4.0",
"version": "1.4.1",
"license": "ISC",
"dependencies": {
"express": "^4.18.2",

View File

@@ -1,6 +1,6 @@
{
"name": "pairdrop",
"version": "1.4.0",
"version": "1.4.1",
"description": "",
"main": "index.js",
"scripts": {

View File

@@ -8,7 +8,6 @@ class ServerConnection {
constructor() {
this._connect();
Events.on('pagehide', _ => this._disconnect());
Events.on('beforeunload', _ => this._onBeforeUnload());
document.addEventListener('visibilitychange', _ => this._onVisibilityChange());
if (navigator.connection) navigator.connection.addEventListener('change', _ => this._reconnect());
Events.on('room-secrets', e => this._sendRoomSecrets(e.detail));
@@ -137,7 +136,8 @@ class ServerConnection {
return ws_url.toString();
}
_onBeforeUnload() {
_disconnect() {
this.send({ type: 'disconnect' });
if (this._socket) {
this._socket.onclose = null;
this._socket.close();
@@ -147,10 +147,6 @@ class ServerConnection {
}
}
_disconnect() {
this.send({ type: 'disconnect' });
}
_onDisconnect() {
console.log('WS: server disconnected');
Events.fire('notify-user', 'Connecting..');
@@ -573,7 +569,7 @@ class RTCPeer extends Peer {
const channel = event.channel || event.target;
channel.binaryType = 'arraybuffer';
channel.onmessage = e => this._onMessage(e.data);
channel.onclose = e => this._onChannelClosed(e);
channel.onclose = _ => this._onChannelClosed();
this._channel = channel;
Events.on('beforeunload', e => this._onBeforeUnload(e));
Events.on('pagehide', _ => this._onPageHide());
@@ -617,8 +613,6 @@ class RTCPeer extends Peer {
if (this._busy) {
e.preventDefault();
return "There are unfinished transfers. Are you sure you want to close?";
} else {
this._disconnect();
}
}
@@ -798,7 +792,7 @@ class PeersManager {
_notifyPeerDisplayNameChanged(peerId) {
const peer = this.peers[peerId];
if (!peer || (peer._conn && (peer._conn.signalingState !== "stable" || !peer._channel || peer._channel.readyState !== "open"))) return;
if (!peer) return;
this.peers[peerId].sendJSON({type: 'display-name-changed', displayName: this._displayName});
}

View File

@@ -1,4 +1,4 @@
const cacheVersion = 'v1.4.0';
const cacheVersion = 'v1.4.1';
const cacheTitle = `pairdrop-cache-${cacheVersion}`;
const urlsToCache = [
'index.html',

View File

@@ -6,7 +6,6 @@ class ServerConnection {
constructor() {
this._connect();
Events.on('pagehide', _ => this._disconnect());
Events.on('beforeunload', _ => this._onBeforeUnload());
document.addEventListener('visibilitychange', _ => this._onVisibilityChange());
if (navigator.connection) navigator.connection.addEventListener('change', _ => this._reconnect());
Events.on('room-secrets', e => this._sendRoomSecrets(e.detail));
@@ -148,7 +147,8 @@ class ServerConnection {
return ws_url.toString();
}
_onBeforeUnload() {
_disconnect() {
this.send({ type: 'disconnect' });
if (this._socket) {
this._socket.onclose = null;
this._socket.close();
@@ -158,10 +158,6 @@ class ServerConnection {
}
}
_disconnect() {
this.send({ type: 'disconnect' });
}
_onDisconnect() {
console.log('WS: server disconnected');
Events.fire('notify-user', 'Connecting..');
@@ -584,7 +580,7 @@ class RTCPeer extends Peer {
const channel = event.channel || event.target;
channel.binaryType = 'arraybuffer';
channel.onmessage = e => this._onMessage(e.data);
channel.onclose = e => this._onChannelClosed(e);
channel.onclose = _ => this._onChannelClosed();
this._channel = channel;
Events.on('beforeunload', e => this._onBeforeUnload(e));
Events.on('pagehide', _ => this._onPageHide());
@@ -628,8 +624,6 @@ class RTCPeer extends Peer {
if (this._busy) {
e.preventDefault();
return "There are unfinished transfers. Are you sure you want to close?";
} else {
this._disconnect();
}
}
@@ -879,7 +873,7 @@ class PeersManager {
_notifyPeerDisplayNameChanged(peerId) {
const peer = this.peers[peerId];
if (!peer || (peer._conn && (peer._conn.signalingState !== "stable" || !peer._channel || peer._channel.readyState !== "open"))) return;
if (!peer) return;
this.peers[peerId].sendJSON({type: 'display-name-changed', displayName: this._displayName});
}

View File

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