Merge remote-tracking branch 'origin/master' into vnext

This commit is contained in:
Danny Coates 2018-07-13 12:25:28 -07:00
commit dd0cb78ea2
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
48 changed files with 4748 additions and 7858 deletions

View file

@ -216,6 +216,7 @@ function download(id, keychain, onprogress, canceller) {
const blob = new Blob([xhr.response]);
resolve(blob);
});
xhr.addEventListener('progress', function(event) {
if (event.lengthComputable && event.target.status === 200) {
onprogress([event.loaded, event.total]);
@ -224,8 +225,10 @@ function download(id, keychain, onprogress, canceller) {
const auth = await keychain.authHeader();
xhr.open('get', `/api/download/${id}`);
xhr.setRequestHeader('Authorization', auth);
xhr.setRequestHeader('Connection', 'close');
xhr.responseType = 'blob';
xhr.send();
onprogress([0, 1]);
});
}

View file

@ -4,6 +4,7 @@ import app from './routes';
import locale from '../common/locales';
import fileManager from './fileManager';
import dragManager from './dragManager';
import pasteManager from './pasteManager';
import { canHasSend } from './utils';
import storage from './storage';
import metrics from './metrics';
@ -48,5 +49,6 @@ app.use(metrics);
app.use(fileManager);
app.use(dragManager);
app.use(experiments);
app.use(pasteManager);
app.mount('body');

25
app/pasteManager.js Normal file
View file

@ -0,0 +1,25 @@
/* global MAXFILESIZE */
import { bytes } from './utils';
export default function(state, emitter) {
window.addEventListener('paste', event => {
if (state.route !== '/' || state.uploading) return;
for (const item of event.clipboardData.items) {
if (!item.type.includes('image')) continue;
const file = item.getAsFile();
if (!file) continue; // Sometimes null
if (file.size > MAXFILESIZE) {
// eslint-disable-next-line no-alert
alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) }));
continue;
}
emitter.emit('upload', { file, type: 'paste' });
return; // return here since only one file is allowed to be uploaded at a time
}
});
}

View file

@ -19,7 +19,8 @@ module.exports = function(file, state, emit) {
onclick=${copyClick}
src="${assets.get('copy-16.svg')}"
class="cursor--pointer"
title="${state.translate('copyUrlHover')}">
title="${state.translate('copyUrlHover')}"
tabindex="0">
<span hidden="true">
${state.translate('copiedUrl')}
</span>
@ -33,7 +34,8 @@ module.exports = function(file, state, emit) {
onclick=${showPopup}
src="${assets.get('close-16.svg')}"
class="cursor--pointer"
title="${state.translate('deleteButtonHover')}">
title="${state.translate('deleteButtonHover')}"
tabindex="0">
${deletePopup(
state.translate('deletePopupText'),
state.translate('deletePopupYes'),

View file

@ -6,8 +6,7 @@ module.exports = function(state) {
<div class="legalSection">
<a
href="https://www.mozilla.org"
class="legalSection__link"
role="presentation">
class="legalSection__link">
<img
class="legalSection__mozLogo"
src="${assets.get('mozilla-logo.svg')}"
@ -43,8 +42,7 @@ module.exports = function(state) {
<div class="socialSection">
<a
href="https://github.com/mozilla/send"
class="socialSection__link"
role="presentation">
class="socialSection__link">
<img
class="socialSection__icon"
src="${assets.get('github-icon.svg')}"
@ -52,8 +50,7 @@ module.exports = function(state) {
</a>
<a
href="https://twitter.com/FxTestPilot"
class="socialSection__link"
role="presentation">
class="socialSection__link">
<img
class="socialSection__icon"
src="${assets.get('twitter-icon.svg')}"