Compare commits

...

11 Commits

Author SHA1 Message Date
Danny Coates
d039c38f00 v2.2.1 2017-12-08 10:00:13 -08:00
Danny Coates
81f3347981 retry setPassword on first nonce failure. fixes #664 2017-12-08 09:45:00 -08:00
Danny Coates
b96d2949f7 Merge pull request #665 from mozilla/dragleave
stop drag target from flickering when dragging over children
2017-12-08 09:18:54 -08:00
Erica Wright
a2e745a349 stop drag target from flickering when dragging over children 2017-12-08 10:48:44 -05:00
RickieES
0fe02b18ce Pontoon: Update Spanish (Spain) (es-ES) localization of Test Pilot: Firefox Send
Localization authors:
- RickieES <rpmdisguise-nave@yahoo.es>
2017-12-08 12:30:51 +00:00
Juraj Cigáň
655eb8c253 Pontoon: Update Slovak (sk) localization of Test Pilot: Firefox Send
Localization authors:
- Juraj Cigáň <kusavica@gmail.com>
2017-12-07 23:10:49 +00:00
Fjoerfoks
d9356f8171 Pontoon: Update Frisian (fy-NL) localization of Test Pilot: Firefox Send
Localization authors:
- Fjoerfoks <fryskefirefox@gmail.com>
2017-12-07 21:11:05 +00:00
Frederick Villaluna
be7d23163c Pontoon: Update Tagalog (tl) localization of Test Pilot: Firefox Send
Localization authors:
- Frederick Villaluna <fv_comscie@yahoo.com>
2017-12-07 09:30:56 +00:00
Artem Polivanchuk
7ac2e57484 Pontoon: Update Ukrainian (uk) localization of Test Pilot: Firefox Send
Localization authors:
- Artem Polivanchuk <artem@mozilla.org.ua>
2017-12-07 08:31:03 +00:00
Artem Polivanchuk
727ea1283a Pontoon: Update Ukrainian (uk) localization of Test Pilot: Firefox Send
Localization authors:
- Artem Polivanchuk <artem@mozilla.org.ua>
2017-12-07 08:11:00 +00:00
Lobodzets
3314057059 Pontoon: Update Ukrainian (uk) localization of Test Pilot: Firefox Send
Localization authors:
- Lobodzets <Lobodzets@meta.ua>
2017-12-07 06:51:08 +00:00
10 changed files with 73 additions and 32 deletions

View File

@@ -12,6 +12,33 @@ async function getAuthHeader(authKey, nonce) {
return `send-v1 ${arrayToB64(new Uint8Array(sig))}`;
}
async function sendPassword(file, authKey, rawAuth) {
const authHeader = await getAuthHeader(authKey, file.nonce);
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
return resolve(xhr.response);
}
if (xhr.status === 401) {
const nonce = xhr.getResponseHeader('WWW-Authenticate').split(' ')[1];
file.nonce = nonce;
}
reject(new Error(xhr.status));
}
};
xhr.onerror = () => reject(new Error(0));
xhr.ontimeout = () => reject(new Error(0));
xhr.open('post', `/api/password/${file.id}`);
xhr.setRequestHeader('Authorization', authHeader);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.responseType = 'json';
xhr.timeout = 2000;
xhr.send(JSON.stringify({ auth: arrayToB64(new Uint8Array(rawAuth)) }));
});
}
export default class FileSender extends Nanobus {
constructor(file) {
super('FileSender');
@@ -259,7 +286,6 @@ export default class FileSender extends Nanobus {
true,
['sign']
);
const authHeader = await getAuthHeader(authKey, file.nonce);
const pwdKey = await window.crypto.subtle.importKey(
'raw',
encoder.encode(password),
@@ -283,30 +309,14 @@ export default class FileSender extends Nanobus {
['sign']
);
const rawAuth = await window.crypto.subtle.exportKey('raw', newAuthKey);
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
return resolve(xhr.response);
}
if (xhr.status === 401) {
const nonce = xhr
.getResponseHeader('WWW-Authenticate')
.split(' ')[1];
file.nonce = nonce;
}
reject(new Error(xhr.status));
}
};
xhr.onerror = () => reject(new Error(0));
xhr.ontimeout = () => reject(new Error(0));
xhr.open('post', `/api/password/${file.id}`);
xhr.setRequestHeader('Authorization', authHeader);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.responseType = 'json';
xhr.timeout = 2000;
xhr.send(JSON.stringify({ auth: arrayToB64(new Uint8Array(rawAuth)) }));
});
try {
await sendPassword(file, authKey, rawAuth);
} catch (e) {
if (e.message === '401' && file.nonce !== e.nonce) {
await sendPassword(file, authKey, rawAuth);
} else {
throw e;
}
}
}
}

View File

@@ -236,6 +236,10 @@ a {
text-align: center;
}
.upload-window.ondrag * {
pointer-events: none;
}
.link {
color: #0094fb;
text-decoration: none;

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "firefox-send",
"version": "2.2.0",
"version": "2.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "firefox-send",
"description": "File Sharing Experiment",
"version": "2.2.0",
"version": "2.2.1",
"author": "Mozilla (https://mozilla.org)",
"repository": "mozilla/send",
"homepage": "https://github.com/mozilla/send/",

View File

@@ -98,3 +98,4 @@ addPasswordButton = Añadir contraseña
passwordTryAgain = Contraseña incorrecta. Inténtelo de nuevo.
// This label is followed by the password needed to download a file
passwordResult = Contraseña: { $password }
reportIPInfringement = Denunciar vulneración de propiedad intelectual

View File

@@ -98,3 +98,4 @@ addPasswordButton = Wachtwurd tafoegje
passwordTryAgain = Net krekt wachtwurd. Probearje it opnij.
// This label is followed by the password needed to download a file
passwordResult = Wachtwurd: { $password }
reportIPInfringement = IP-ynbrek melde

View File

@@ -25,6 +25,17 @@ uploadingFileNotification = Upozorniť ma na ukončenie nahrávania
uploadSuccessConfirmHeader = Pripravené na odoslanie
uploadSvgAlt = Nahrať
uploadSuccessTimingHeader = Platnosť odkazu vyprší po 1 prevzatí alebo po uplynutí 24 hodín.
expireInfo = Platnosť odkazu na váš súbor vyprší po { $downloadCount } alebo po { $timespan }.
downloadCount = { $num ->
[one] 1 prevzatí
[few] { $num } prevzatiach
*[other] { $num } prevzatiach
}
timespanHours = { $num ->
[one] 1 hodine
[few] { $num } hodinách
*[other] { $num } hodinách
}
copyUrlFormLabelWithName = Skopírovaním a zdieľaním odkazu odošlete váš súbor: { $filename }
copyUrlFormButton = Kopírovať do schránky
copiedUrl = Skopírované!
@@ -89,3 +100,4 @@ addPasswordButton = Pridať heslo
passwordTryAgain = Nesprávne heslo. Skúste to znova.
// This label is followed by the password needed to download a file
passwordResult = Heslo: { $password }
reportIPInfringement = Nahlásiť porušenie práv duševného vlastníctva

View File

@@ -97,3 +97,4 @@ addPasswordButton = Magdagdag ng password
passwordTryAgain = Maling password. Subukan muli.
// This label is followed by the password needed to download a file
passwordResult = Password: { $password }
reportIPInfringement = Report IP Infringement

View File

@@ -25,6 +25,17 @@ uploadingFileNotification = Сповістити мене, коли вивант
uploadSuccessConfirmHeader = Готовий до надсилання
uploadSvgAlt = Вивантажити
uploadSuccessTimingHeader = Час дії цього посилання закінчиться після 1 завантаження, або через 24 години.
expireInfo = Посилання на ваш файл стане недійсним після { $downloadCount } файла, або через { $timespan }.
downloadCount = { $num ->
[one] 1 завантаження
[few] { $num } завантаження
*[other] { $num } завантажень
}
timespanHours = { $num ->
[one] 1 година
[few] { $num } години
*[other] { $num } годин
}
copyUrlFormLabelWithName = Скопіювати і поділитися посиланням на ваш файл: { $filename }
copyUrlFormButton = Копіювати у буфер обміну
copiedUrl = Скопійовано!
@@ -89,3 +100,4 @@ addPasswordButton = Додати пароль
passwordTryAgain = Невірний пароль. Спробуйте знову.
// This label is followed by the password needed to download a file
passwordResult = Пароль: { $password }
reportIPInfringement = Повідомити про порушення прав на інтелектуальну власність

View File

@@ -24,12 +24,12 @@ module.exports = async function(req, res) {
res.set('WWW-Authenticate', `send-v1 ${meta.nonce}`);
return res.sendStatus(401);
}
const nonce = crypto.randomBytes(16).toString('base64');
storage.setField(id, 'nonce', nonce);
res.set('WWW-Authenticate', `send-v1 ${nonce}`);
} catch (e) {
res.sendStatus(404);
return res.sendStatus(404);
}
const nonce = crypto.randomBytes(16).toString('base64');
storage.setField(id, 'nonce', nonce);
res.set('WWW-Authenticate', `send-v1 ${nonce}`);
storage.setField(id, 'auth', req.body.auth);
storage.setField(id, 'pwd', 1);
res.sendStatus(200);