From d886106f22eb1438ce9be8e0008490b4c0127736 Mon Sep 17 00:00:00 2001 From: Florian <64581222+fm-sys@users.noreply.github.com> Date: Wed, 4 Nov 2020 16:29:08 +0100 Subject: [PATCH 01/16] Fix broken FAQ link --- client/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index 41e8338..34d2501 100644 --- a/client/index.html +++ b/client/index.html @@ -141,7 +141,7 @@ - + @@ -218,4 +218,4 @@ } - \ No newline at end of file + From 1d81e93c360206e2c4e33302b3ac6f201770c7ae Mon Sep 17 00:00:00 2001 From: Bellisario <72039923+Bellisario@users.noreply.github.com> Date: Sun, 13 Dec 2020 18:43:52 +0100 Subject: [PATCH 02/16] Update index.html --- client/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index 41e8338..0179991 100644 --- a/client/index.html +++ b/client/index.html @@ -62,7 +62,7 @@
The easiest way to transfer data across devices.
-
Allow me to be discovered by: Everyone in this network.
+
Your device is discoverable by everyone on this network.
@@ -218,4 +218,4 @@ } - \ No newline at end of file + From a1fa992942c1f4548e3b23e32be4c15f98bf7af5 Mon Sep 17 00:00:00 2001 From: Wenzel <17035115+lowewenzel@users.noreply.github.com> Date: Mon, 14 Dec 2020 19:35:23 -0800 Subject: [PATCH 03/16] Smol typo fix --- client/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/styles.css b/client/styles.css index bd713c2..924a01c 100644 --- a/client/styles.css +++ b/client/styles.css @@ -262,7 +262,7 @@ x-peer[transfer] x-icon { } x-peer[transfer] .status:before { - content: 'Transfering...'; + content: 'Transferring...'; } x-peer x-icon { From 366f105ac18955ef989ebf1269f0444c50d392dc Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Tue, 15 Dec 2020 22:29:02 +0100 Subject: [PATCH 04/16] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 888f90e..3c9cc32 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,12 @@ * [NodeJS](https://nodejs.org/en/) * [Material Design](https://material.google.com/) + +> Have any questions? You can read our [FAQ](/docs/faq.md) + > If you want to self-host your own instance, [you can 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: @@ -27,7 +31,6 @@ Alternatively, you can become a [Github Sponsor](https://github.com/sponsors/Rob Thanks a lot for supporting free and open software! -> Have any questions? You can read our [FAQ](/docs/faq.md) From 694d7bddcab99044731bf3a7934eec8c1772e07a Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Tue, 15 Dec 2020 22:36:01 +0100 Subject: [PATCH 05/16] Update docs --- README.md | 17 +++-------------- docs/faq.md | 11 +++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3c9cc32..a7a9500 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,15 @@ #### Snapdrop is built with the following awesome technologies: * Vanilla HTML5 / ES6 / CSS3 -* Progressive Web App +* [Progressive Web App](https://de.wikipedia.org/wiki/Progressive_Web_App) * [WebRTC](http://webrtc.org/) * [WebSockets](http://www.websocket.org/) * [NodeJS](https://nodejs.org/en/) -* [Material Design](https://material.google.com/) -> Have any questions? You can read our [FAQ](/docs/faq.md) +> Have any questions? You can read our [FAQ](/docs/faq.md). -> If you want to self-host your own instance, [you can with docker.](/docs/local-dev.md) +> If you want to self-host your own instance, [you can with docker](/docs/local-dev.md). ## Support the Snapdrop Community @@ -32,13 +31,3 @@ Thanks a lot for supporting free and open software! - - -## Apps -1. [Snapdrop PWA](/docs/faq.md) - - 1. [Snapdrop Desktop App](https://github.com/infin1tyy/snapdrop-desktop) built on top of Electron. (Thanks to [Infin1tyy!](https://github.com/infin1tyy/)). - - 1. Feel free to make one :) - - diff --git a/docs/faq.md b/docs/faq.md index c4a8e67..c10548d 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -32,4 +32,15 @@ We are not trying to optimize for some edge-cases. We are optimizing the user fl * Fix bugs and make a pull request. * Do security analysis and suggestions + + +## Apps +1. [Snapdrop PWA](/docs/faq.md) + +1. [Snapdrop Desktop App](https://github.com/infin1tyy/snapdrop-desktop) built on top of Electron. (Thanks to [Infin1tyy!](https://github.com/infin1tyy/)). + +1. Feel free to make one :) + + + [< Back](/README.md) \ No newline at end of file From ea9ce951123b2cc7ac8b577588e24fe7d9f79918 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Wed, 16 Dec 2020 03:08:24 +0100 Subject: [PATCH 06/16] Simplify discoverability hint --- client/index.html | 2 +- client/styles.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/index.html b/client/index.html index 7ce05ab..3eb7c4b 100644 --- a/client/index.html +++ b/client/index.html @@ -62,7 +62,7 @@
The easiest way to transfer data across devices.
-
Your device is discoverable by everyone on this network.
+
You can be discovered by everyone on this network.
diff --git a/client/styles.css b/client/styles.css index 924a01c..78a5b19 100644 --- a/client/styles.css +++ b/client/styles.css @@ -293,6 +293,7 @@ footer { right: 0; align-items: center; padding: 0 0 16px 0; + text-align: center; } footer .logo { From 612d8cf1ea0733499d0e55399aeaaf0e819e142d Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Wed, 16 Dec 2020 04:16:21 +0100 Subject: [PATCH 07/16] Use device type as display name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pro: - Device types are more descriptive. - Device types don’t change after every reload Con: - Device types may not be unique. --- server/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/server/index.js b/server/index.js index 208a61b..9f0e494 100644 --- a/server/index.js +++ b/server/index.js @@ -1,5 +1,4 @@ const parser = require('ua-parser-js'); -const { uniqueNamesGenerator, animals, colors } = require('unique-names-generator'); class SnapdropServer { @@ -36,7 +35,7 @@ class SnapdropServer { } catch (e) { return; // TODO: handle malformed JSON } - + switch (message.type) { case 'disconnect': this._leaveRoom(sender); @@ -186,13 +185,22 @@ class Peer { } _setName(req) { - var ua = parser(req.headers['user-agent']); + let ua = parser(req.headers['user-agent']); + + + let displayName = ua.os.name.replace('Mac OS', 'Mac') + ' '; + if (ua.device.model) { + displayName += ua.device.model; + } else { + displayName += ua.browser.name; + } + this.name = { model: ua.device.model, os: ua.os.name, browser: ua.browser.name, type: ua.device.type, - displayName: uniqueNamesGenerator({ length: 2, separator: ' ', dictionaries: [colors, animals], style: 'capital' }) + displayName: displayName }; } @@ -231,4 +239,4 @@ class Peer { }; } -const server = new SnapdropServer(process.env.PORT || 3000); +const server = new SnapdropServer(process.env.PORT || 3000); \ No newline at end of file From 85dedf03ceda52116a139165fd07ae44215e790d Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Wed, 16 Dec 2020 04:16:53 +0100 Subject: [PATCH 08/16] Cleanup --- client/scripts/network.js | 4 ++-- client/scripts/ui.js | 4 ++-- client/styles.css | 1 + server/index.js | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/scripts/network.js b/client/scripts/network.js index db19f4b..3774cc7 100644 --- a/client/scripts/network.js +++ b/client/scripts/network.js @@ -41,8 +41,8 @@ class ServerConnection { case 'ping': this.send({ type: 'pong' }); break; - case 'displayName': - Events.fire('displayName', msg); + case 'display-name': + Events.fire('display-name', msg); break; default: console.error('WS: unkown message type', msg); diff --git a/client/scripts/ui.js b/client/scripts/ui.js index 030b2a6..c0550af 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -6,8 +6,8 @@ window.isProductionEnvironment = !window.location.host.startsWith('localhost'); window.iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; // set display name -Events.on('displayName', e => { - $("displayName").textContent = "You are known as " + e.detail.message; +Events.on('display-name', e => { + $('displayName').textContent = 'You are known as ' + e.detail.message; }); class PeersUI { diff --git a/client/styles.css b/client/styles.css index 78a5b19..b9d9898 100644 --- a/client/styles.css +++ b/client/styles.css @@ -593,6 +593,7 @@ x-instructions { opacity: 0.5; transition: opacity 300ms; z-index: -1; + text-align: center; } x-instructions:before { diff --git a/server/index.js b/server/index.js index 9f0e494..3279c0f 100644 --- a/server/index.js +++ b/server/index.js @@ -19,7 +19,7 @@ class SnapdropServer { this._keepAlive(peer); // send displayName - this._send(peer, { type: 'displayName', message: peer.name.displayName }); + this._send(peer, { type: 'display-name', message: peer.name.displayName }); } _onHeaders(headers, response) { From ee62b47305c85e29827947e354dd73fbbb7b096e Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Wed, 16 Dec 2020 04:41:28 +0100 Subject: [PATCH 09/16] Update local-dev.md --- docs/local-dev.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/local-dev.md b/docs/local-dev.md index 437902c..1486e19 100644 --- a/docs/local-dev.md +++ b/docs/local-dev.md @@ -9,13 +9,16 @@ Then, clone the repository: cd snapdrop docker-compose up -d ``` - -To restart the containers run `docker-compose restart`. -To stop the containers run `docker-compose stop`. - - Now point your browser to `http://localhost:8080`. +- To restart the containers run `docker-compose restart`. +- To stop the containers run `docker-compose stop`. +- To display the nodejs logs for debugging run `docker logs snapdrop_node_1`. + + + + + ## Testing PWA related features PWAs require that the app is served under a correctly set up and trusted TLS endpoint. @@ -41,4 +44,4 @@ By default, the server listens on port 3000. For an nginx configuration example, see `docker/nginx/default.conf`. -[< Back](/README.md) \ No newline at end of file +[< Back](/README.md) From 830367651b4917c9262971afd05ffb17063d5e5c Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Wed, 16 Dec 2020 04:53:36 +0100 Subject: [PATCH 10/16] Remove verbose punctuation --- client/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/index.html b/client/index.html index 3eb7c4b..1a20e74 100644 --- a/client/index.html +++ b/client/index.html @@ -53,16 +53,16 @@ -

Open Snapdrop on other devices to send files.

+

Open Snapdrop on other devices to send files

- +
-
The easiest way to transfer data across devices.
-
You can be discovered by everyone on this network.
+
The easiest way to transfer data across devices
+
You can be discovered by everyone on this network
@@ -124,7 +124,7 @@

Snapdrop

-
The easiest way to transfer files across devices.
+
The easiest way to transfer files across devices
@@ -204,7 +204,7 @@

Enable Javascript

-

Snapdrop works only with Javascript.

+

Snapdrop works only with Javascript