From e4301963a2c7dbdc30190238319a431421af7c76 Mon Sep 17 00:00:00 2001 From: Daniela Arcese Date: Wed, 19 Jul 2017 17:27:08 -0400 Subject: [PATCH 1/6] add alert when uploading multiple files --- frontend/src/upload.js | 28 +++++++++++++++++++++------- public/locales/send.en-US.ftl | 3 ++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 7764a088..583b41c2 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -70,18 +70,32 @@ $(document).ready(function() { // on file upload by browse or drag & drop function onUpload(event) { event.preventDefault(); + let file = ''; + if (event.type === 'drop') { + if (event.originalEvent.dataTransfer.files.length > 1){ + document.l10n.formatValue('uploadPageMultipleFilesAlert') + .then(str => { + alert(str); + }); + return; + } + file = event.originalEvent.dataTransfer.files[0]; + } else { + if (event.target.files.length > 1){ + document.l10n.formatValue('uploadPageMultipleFilesAlert') + .then(str => { + alert(str); + }); + return; + } + file = event.target.files[0]; + } + $('#page-one').attr('hidden', true); $('#upload-error').attr('hidden', true); $('#upload-progress').removeAttr('hidden'); //don't allow drag and drop when not on page-one $('body').off('drop', onUpload); - - let file = ''; - if (event.type === 'drop') { - file = event.originalEvent.dataTransfer.files[0]; - } else { - file = event.target.files[0]; - } const expiration = 24 * 60 * 60 * 1000; //will eventually come from a field const fileSender = new FileSender(file); diff --git a/public/locales/send.en-US.ftl b/public/locales/send.en-US.ftl index a1c73b6b..a3873fbb 100644 --- a/public/locales/send.en-US.ftl +++ b/public/locales/send.en-US.ftl @@ -4,10 +4,11 @@ uploadPageHeader = Private, Encrypted File Sharing uploadPageExplainer = Send files through a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever. uploadPageLearnMore = Learn more -uploadPageDropMessage = Drop your files here to start uploading +uploadPageDropMessage = Drop your file here to start uploading uploadPageSizeMessage = For the most reliable operation, it’s best to keep your file under 1GB uploadPageBrowseButton = Select a file on your computer .title = {uploadPageBrowseButtonTitle} +uploadPageMultipleFilesAlert = Uploading multiple files or a folder is currently not supported. uploadPageBrowseButtonTitle = Upload file From 80cf343516a2ebfb1cda22ee5bd02803d21168c1 Mon Sep 17 00:00:00 2001 From: Daniela Arcese Date: Thu, 20 Jul 2017 09:21:26 -0400 Subject: [PATCH 2/6] remove check for uploads on browse --- frontend/src/upload.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/frontend/src/upload.js b/frontend/src/upload.js index 583b41c2..d32ebcb3 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -81,13 +81,6 @@ $(document).ready(function() { } file = event.originalEvent.dataTransfer.files[0]; } else { - if (event.target.files.length > 1){ - document.l10n.formatValue('uploadPageMultipleFilesAlert') - .then(str => { - alert(str); - }); - return; - } file = event.target.files[0]; } From a9e0ab17e563a212ed38c30ebefc735696e31b18 Mon Sep 17 00:00:00 2001 From: Daniela Arcese Date: Thu, 20 Jul 2017 09:25:04 -0400 Subject: [PATCH 3/6] sync download progress bar with percentage --- frontend/src/download.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/download.js b/frontend/src/download.js index fd3085ea..a6d96449 100644 --- a/frontend/src/download.js +++ b/frontend/src/download.js @@ -15,7 +15,8 @@ $(document).ready(function() { value: 0.0, startAngle: -Math.PI / 2, fill: '#00C8D7', - size: 158 + size: 158, + animation: { duration: 300 } }); $('#download-btn').click(download); function download() { From 60bfd1b67ce431f1cdc2f50cba9457f02c81ed89 Mon Sep 17 00:00:00 2001 From: Daniela Arcese Date: Thu, 20 Jul 2017 10:31:39 -0400 Subject: [PATCH 4/6] make alert show when uploading a folder --- frontend/src/upload.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/upload.js b/frontend/src/upload.js index d32ebcb3..194d50af 100644 --- a/frontend/src/upload.js +++ b/frontend/src/upload.js @@ -19,7 +19,6 @@ $(document).ready(function() { $('#link').attr('disabled', false); $copyBtn.attr('data-l10n-id', 'copyUrlFormButton'); - if (localStorage.length === 0) { toggleHeader(); } else { @@ -72,7 +71,8 @@ $(document).ready(function() { event.preventDefault(); let file = ''; if (event.type === 'drop') { - if (event.originalEvent.dataTransfer.files.length > 1){ + if (event.originalEvent.dataTransfer.files.length > 1 || event.originalEvent.dataTransfer.files[0].size === 0){ + $('.upload-window').removeClass('ondrag'); document.l10n.formatValue('uploadPageMultipleFilesAlert') .then(str => { alert(str); @@ -169,7 +169,7 @@ $(document).ready(function() { $('#upload-progress').attr('hidden', true); $('#upload-error').attr('hidden', true); $('#share-link').removeAttr('hidden'); - }, 2000); + }, 1000); populateFileList(JSON.stringify(fileData)); document.l10n.formatValue('notifyUploadDone') From 4f36f2befa5896c107e9c9a490972be1561e1b3d Mon Sep 17 00:00:00 2001 From: Chuck Harmston Date: Thu, 20 Jul 2017 09:08:13 -0600 Subject: [PATCH 5/6] Adds 'Available on Test Pilot' badge. Also changes the style of the CircleCI badge to match. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ac01d549..9ac1ade4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Firefox Send -[![CircleCI](https://circleci.com/gh/mozilla/send.svg?style=svg)](https://circleci.com/gh/mozilla/send) +[![CircleCI](https://img.shields.io/circleci/project/github/mozilla/send.svg)](https://circleci.com/gh/mozilla/send) +[![Available on Test Pilot](https://img.shields.io/badge/available_on-Test_Pilot-0996F8.svg)](https://testpilot.firefox.com/experiments/send) **Docs:** [Docker](docs/docker.md), [Metrics](docs/metrics.md) From 34f26fc017cd440f78f65540156c579620d69698 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 20 Jul 2017 08:36:05 -0700 Subject: [PATCH 6/6] added git package to docker image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 4b7916d1..998c72b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM node:8-alpine +RUN apk add --no-cache git RUN addgroup -S -g 10001 app && adduser -S -D -G app -u 10001 app COPY . /app RUN chown -R app /app