From 529be8c55ee7a4b8bbc7c2ca89122595583adddf Mon Sep 17 00:00:00 2001 From: Haocen Date: Tue, 13 Sep 2022 01:35:05 -0400 Subject: [PATCH 01/21] QoL: Native notification improvements Only send native notification when document is not visible, clear notifications when document become visible. --- client/scripts/ui.js | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/client/scripts/ui.js b/client/scripts/ui.js index 0c159841..7fff1f7e 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -420,7 +420,7 @@ class Notifications { }); } - _notify(message, body, closeTimeout = 20000) { + _notify(message, body) { const config = { body: body, icon: '/images/logo_transparent_128x128.png', @@ -435,27 +435,35 @@ class Notifications { } // Notification is persistent on Android. We have to close it manually - if (closeTimeout) { - setTimeout(_ => notification.close(), closeTimeout); - } + const visibilitychangeHandler = () => { + if (document.visibilityState === 'visible') { + notification.close(); + document.removeEventListener('visibilitychange', visibilitychangeHandler); + } + }; + document.addEventListener('visibilitychange', visibilitychangeHandler); return notification; } _messageNotification(message) { - if (isURL(message)) { - const notification = this._notify(message, 'Click to open link'); - this._bind(notification, e => window.open(message, '_blank', null, true)); - } else { - const notification = this._notify(message, 'Click to copy text'); - this._bind(notification, e => this._copyText(message, notification)); + if (document.visibilityState !== 'visible') { + if (isURL(message)) { + const notification = this._notify(message, 'Click to open link'); + this._bind(notification, e => window.open(message, '_blank', null, true)); + } else { + const notification = this._notify(message, 'Click to copy text'); + this._bind(notification, e => this._copyText(message, notification)); + } } } _downloadNotification(message) { - const notification = this._notify(message, 'Click to download'); - if (!window.isDownloadSupported) return; - this._bind(notification, e => this._download(notification)); + if (document.visibilityState !== 'visible') { + const notification = this._notify(message, 'Click to download'); + if (!window.isDownloadSupported) return; + this._bind(notification, e => this._download(notification)); + } } _download(notification) { From 29bd7787578db19c05cc423b0ea0c6345fe0c6aa Mon Sep 17 00:00:00 2001 From: Haocen Date: Tue, 13 Sep 2022 08:33:03 -0400 Subject: [PATCH 02/21] Implement off method for Events class --- client/scripts/network.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/scripts/network.js b/client/scripts/network.js index eb599014..7f50e679 100644 --- a/client/scripts/network.js +++ b/client/scripts/network.js @@ -512,6 +512,10 @@ class Events { static on(type, callback) { return window.addEventListener(type, callback, false); } + + static off(type, callback) { + return window.removeEventListener(type, callback, false); + } } From 9543c47900b9c1344f0469efc8ba7919f0fca1ca Mon Sep 17 00:00:00 2001 From: Haocen Date: Tue, 13 Sep 2022 08:34:44 -0400 Subject: [PATCH 03/21] Use Events class for handling visibilitychange --- client/scripts/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/scripts/ui.js b/client/scripts/ui.js index 7fff1f7e..426bbc9c 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -438,10 +438,10 @@ class Notifications { const visibilitychangeHandler = () => { if (document.visibilityState === 'visible') { notification.close(); - document.removeEventListener('visibilitychange', visibilitychangeHandler); + Events.off('visibilitychange', visibilitychangeHandler); } }; - document.addEventListener('visibilitychange', visibilitychangeHandler); + Events.on('visibilitychange', visibilitychangeHandler); return notification; } From 683470613cca81414ab33e7575f285a3354d6d32 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Wed, 12 Oct 2022 02:39:10 +0200 Subject: [PATCH 04/21] Update faq.md --- docs/faq.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index 7d7c7c54..a5fff98e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -38,6 +38,19 @@ If you want to learn more about simplicity you can read [Insanely Simple: The Ob * Do security analysis and suggestions +## "Inofficial" Instances +Here's a list of other people hosting inofficial instances of Snapdrop: + +- https://snapdrop.k26.ch/ +- https://snapdrop.9pfs.repl.co/ +- https://filedrop.codext.de/ +- https://s.hoothin.com/ +- https://www.wulingate.com/ +- https://snapdrop.fairysoft.net/ +- https://airtransferer.web.app/ + +DISCLAIMER: WE ARE NOT IN ANY WAY AFFILIATED WITH THE PEOPLE WHO RUN THESE INSTANCES. WE DO NOT KNOW THEM. WE CANNOT VERIFY THE CODE THEY ARE RUNNING! + ## Third-Party Apps Here's a list of some third-party Snapdrop apps: From 070f6a954f93b1ca6d165f97e41a6366e8d6d9ef Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Thu, 13 Oct 2022 01:13:56 +0200 Subject: [PATCH 05/21] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 7185bddf..5f43f696 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: https://www.paypal.com/donate/?cmd=_s-xclick&hosted_button_id=FTP9DXUR7LA7Q&source=url +custom: https://paypal.me/robinlinus From 2e0619fbbabbc01c5f39fc8c6acc98613740894d Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Thu, 13 Oct 2022 15:20:38 +0200 Subject: [PATCH 06/21] Add error handler to ws connection --- server/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/index.js b/server/index.js index 38fa399b..c47feb1e 100644 --- a/server/index.js +++ b/server/index.js @@ -30,6 +30,7 @@ class SnapdropServer { _onConnection(peer) { this._joinRoom(peer); peer.socket.on('message', message => this._onMessage(peer, message)); + peer.socket.on('error', console.error); this._keepAlive(peer); // send displayName @@ -288,4 +289,4 @@ Object.defineProperty(String.prototype, 'hashCode', { } }); -const server = new SnapdropServer(process.env.PORT || 3000); \ No newline at end of file +const server = new SnapdropServer(process.env.PORT || 3000); From 7bb4c1916a59552c6380f266649397efc36c8c25 Mon Sep 17 00:00:00 2001 From: MahmoudAboelazm Date: Fri, 21 Oct 2022 02:54:14 +0200 Subject: [PATCH 07/21] fix error: Failed to execute 'readAsArrayBuffer' on 'FileReader': The object is already busy reading Blobs --- client/scripts/network.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/scripts/network.js b/client/scripts/network.js index 7f50e679..838c8c8e 100644 --- a/client/scripts/network.js +++ b/client/scripts/network.js @@ -448,7 +448,8 @@ class FileChunker { this._offset += chunk.byteLength; this._partitionSize += chunk.byteLength; this._onChunk(chunk); - if (this._isPartitionEnd() || this.isFileEnd()) { + if (this.isFileEnd()) return; + if (this._isPartitionEnd()) { this._onPartitionEnd(this._offset); return; } From 09da05e700349ef36d216db4de681ffa9e656004 Mon Sep 17 00:00:00 2001 From: MahmoudAboelazm Date: Sun, 23 Oct 2022 06:17:39 +0200 Subject: [PATCH 08/21] Fix transferring issue --- client/scripts/network.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/scripts/network.js b/client/scripts/network.js index 838c8c8e..e1383f3d 100644 --- a/client/scripts/network.js +++ b/client/scripts/network.js @@ -258,7 +258,6 @@ class RTCPeer extends Peer { ordered: true, reliable: true // Obsolete. See https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/reliable }); - channel.binaryType = 'arraybuffer'; channel.onopen = e => this._onChannelOpened(e); this._conn.createOffer().then(d => this._onDescription(d)).catch(e => this._onError(e)); } @@ -295,6 +294,7 @@ class RTCPeer extends Peer { _onChannelOpened(event) { console.log('RTC: channel opened with', this._peerId); const channel = event.channel || event.target; + channel.binaryType = 'arraybuffer'; channel.onmessage = e => this._onMessage(e.data); channel.onclose = e => this._onChannelClosed(); this._channel = channel; From d1144670efcff6e9635b17914a689566f0df9de5 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Tue, 8 Nov 2022 19:14:25 +0100 Subject: [PATCH 09/21] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 5f43f696..d0fb2a6e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: https://paypal.me/robinlinus +custom: https://www.paypal.com/donate/?hosted_button_id=MG8GV7YCYT352 From 89b0bcc20c9d598e50fb970a9d030207185e5b99 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Tue, 8 Nov 2022 19:14:55 +0100 Subject: [PATCH 10/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1806dd8f..d34fa32a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ You can [host your own instance with Docker](/docs/local-dev.md). ## Support the Snapdrop Community Snapdrop is free. Still, we have to pay for the server. If you want to contribute, please use PayPal: -[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FTP9DXUR7LA7Q&source=url) +[](https://www.paypal.com/donate/?hosted_button_id=MG8GV7YCYT352) or Bitcoin: From 50b025acfcad95b49729a657c3eaf48dd7285db4 Mon Sep 17 00:00:00 2001 From: SUNWUYUAN <88357633+SUNWUYUAN@users.noreply.github.com> Date: Fri, 18 Nov 2022 20:21:48 +0800 Subject: [PATCH 11/21] Update faq.md A new self managed snapdrop, which I modified to suit Chinese --- docs/faq.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/faq.md b/docs/faq.md index a5fff98e..7557779f 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -48,6 +48,7 @@ Here's a list of other people hosting inofficial instances of Snapdrop: - https://www.wulingate.com/ - https://snapdrop.fairysoft.net/ - https://airtransferer.web.app/ +- https://drop.wuyuan.dev DISCLAIMER: WE ARE NOT IN ANY WAY AFFILIATED WITH THE PEOPLE WHO RUN THESE INSTANCES. WE DO NOT KNOW THEM. WE CANNOT VERIFY THE CODE THEY ARE RUNNING! From c769810150219ddce82303b2a6c9dca028aa7bed Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Fri, 6 Jan 2023 18:08:33 +0100 Subject: [PATCH 12/21] fix image overflow --- client/styles.css | 1 + 1 file changed, 1 insertion(+) diff --git a/client/styles.css b/client/styles.css index 0a9aca98..7b5b6595 100644 --- a/client/styles.css +++ b/client/styles.css @@ -719,6 +719,7 @@ x-dialog x-paper { } /* Image Preview */ #img-preview{ + max-width: 100%; max-height: 50vh; margin: auto; display: block; From db7f8cc91c847231e8530018af0e1d7b6e36c49a Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Fri, 20 Jan 2023 16:48:49 +0100 Subject: [PATCH 13/21] Update faq.md --- docs/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index 7557779f..e5a8a5fd 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -40,7 +40,7 @@ If you want to learn more about simplicity you can read [Insanely Simple: The Ob ## "Inofficial" Instances Here's a list of other people hosting inofficial instances of Snapdrop: - +- https://pairdrop.net/ - https://snapdrop.k26.ch/ - https://snapdrop.9pfs.repl.co/ - https://filedrop.codext.de/ From 6fa6e61669d25a057d00115ee28f5e6417a38115 Mon Sep 17 00:00:00 2001 From: Jack Bailey Date: Sun, 5 Feb 2023 22:18:53 +0000 Subject: [PATCH 14/21] Add my instance to the FAQ --- docs/faq.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/faq.md b/docs/faq.md index e5a8a5fd..4a5934e0 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -49,6 +49,7 @@ Here's a list of other people hosting inofficial instances of Snapdrop: - https://snapdrop.fairysoft.net/ - https://airtransferer.web.app/ - https://drop.wuyuan.dev +- https://share.jck.cx DISCLAIMER: WE ARE NOT IN ANY WAY AFFILIATED WITH THE PEOPLE WHO RUN THESE INSTANCES. WE DO NOT KNOW THEM. WE CANNOT VERIFY THE CODE THEY ARE RUNNING! From 21f82c7ffd58abd49ceda6275480269c9480dc5f Mon Sep 17 00:00:00 2001 From: Sagnik Das Date: Mon, 6 Feb 2023 16:23:55 +0530 Subject: [PATCH 15/21] Removed the / as it breaks reverse proxying --- client/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index e4752dbe..9523cab5 100644 --- a/client/index.html +++ b/client/index.html @@ -218,8 +218,8 @@

Snapdrop