Merge branch 'master' into envvar
This commit is contained in:
commit
117c6ea12d
|
@ -42,10 +42,6 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#expired-send-new').click(function() {
|
|
||||||
storage.referrer = 'errored-download';
|
|
||||||
});
|
|
||||||
|
|
||||||
const filename = $('#dl-filename').text();
|
const filename = $('#dl-filename').text();
|
||||||
const bytelength = Number($('#dl-bytelength').text());
|
const bytelength = Number($('#dl-bytelength').text());
|
||||||
const timeToExpiry = Number($('#dl-ttl').text());
|
const timeToExpiry = Number($('#dl-ttl').text());
|
||||||
|
|
|
@ -67,7 +67,8 @@ class FileReceiver extends EventEmitter {
|
||||||
{
|
{
|
||||||
name: 'AES-GCM',
|
name: 'AES-GCM',
|
||||||
iv: hexToArray(fdata.iv),
|
iv: hexToArray(fdata.iv),
|
||||||
additionalData: hexToArray(fdata.aad)
|
additionalData: hexToArray(fdata.aad),
|
||||||
|
tagLength: 128
|
||||||
},
|
},
|
||||||
key,
|
key,
|
||||||
fdata.data
|
fdata.data
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global MAXFILESIZE */
|
/* global MAXFILESIZE EXPIRE_SECONDS */
|
||||||
require('./common');
|
require('./common');
|
||||||
const FileSender = require('./fileSender');
|
const FileSender = require('./fileSender');
|
||||||
const {
|
const {
|
||||||
|
@ -143,6 +143,10 @@ $(document).ready(function() {
|
||||||
|
|
||||||
let file = '';
|
let file = '';
|
||||||
if (event.type === 'drop') {
|
if (event.type === 'drop') {
|
||||||
|
if (!event.originalEvent.dataTransfer.files[0]) {
|
||||||
|
$('.upload-window').removeClass('ondrag');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
event.originalEvent.dataTransfer.files.length > 1 ||
|
event.originalEvent.dataTransfer.files.length > 1 ||
|
||||||
event.originalEvent.dataTransfer.files[0].size === 0
|
event.originalEvent.dataTransfer.files[0].size === 0
|
||||||
|
@ -256,7 +260,7 @@ $(document).ready(function() {
|
||||||
const totalTime = endTime - startTime;
|
const totalTime = endTime - startTime;
|
||||||
const uploadTime = endTime - uploadStart;
|
const uploadTime = endTime - uploadStart;
|
||||||
const uploadSpeed = file.size / (uploadTime / 1000);
|
const uploadSpeed = file.size / (uploadTime / 1000);
|
||||||
const expiration = 24 * 60 * 60 * 1000; //will eventually come from a field
|
const expiration = EXPIRE_SECONDS * 1000;
|
||||||
|
|
||||||
// record upload-stopped (completed) by sender
|
// record upload-stopped (completed) by sender
|
||||||
sendEvent('sender', 'upload-stopped', {
|
sendEvent('sender', 'upload-stopped', {
|
||||||
|
|
|
@ -41,6 +41,11 @@ const conf = convict({
|
||||||
format: Number,
|
format: Number,
|
||||||
default: 1024 * 1024 * 1024 * 2,
|
default: 1024 * 1024 * 1024 * 2,
|
||||||
env: 'MAX_FILE_SIZE'
|
env: 'MAX_FILE_SIZE'
|
||||||
|
},
|
||||||
|
expire_seconds: {
|
||||||
|
format: Number,
|
||||||
|
default: 86400,
|
||||||
|
env: 'EXPIRE_SECONDS'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ app.get('/jsconfig.js', (req, res) => {
|
||||||
trackerId: conf.analytics_id,
|
trackerId: conf.analytics_id,
|
||||||
dsn: conf.sentry_id,
|
dsn: conf.sentry_id,
|
||||||
maxFileSize: conf.max_file_size,
|
maxFileSize: conf.max_file_size,
|
||||||
|
expireSeconds: conf.expire_seconds,
|
||||||
layout: false
|
layout: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -152,7 +152,7 @@ function localSet(newId, file, filename, meta) {
|
||||||
});
|
});
|
||||||
fstream.on('finish', () => {
|
fstream.on('finish', () => {
|
||||||
redis_client.hmset(newId, meta);
|
redis_client.hmset(newId, meta);
|
||||||
redis_client.expire(newId, 86400000);
|
redis_client.expire(newId, conf.expire_seconds);
|
||||||
log.info('localSet:', 'Upload Finished of ' + newId);
|
log.info('localSet:', 'Upload Finished of ' + newId);
|
||||||
resolve(meta.delete);
|
resolve(meta.delete);
|
||||||
});
|
});
|
||||||
|
@ -238,7 +238,7 @@ function awsSet(newId, file, filename, meta) {
|
||||||
return upload.promise().then(
|
return upload.promise().then(
|
||||||
() => {
|
() => {
|
||||||
redis_client.hmset(newId, meta);
|
redis_client.hmset(newId, meta);
|
||||||
redis_client.expire(newId, 86400000);
|
redis_client.expire(newId, conf.expire_seconds);
|
||||||
log.info('awsUploadFinish', 'Upload Finished of ' + filename);
|
log.info('awsUploadFinish', 'Upload Finished of ' + filename);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|
|
@ -115,7 +115,7 @@ describe('Testing Set using aws', function() {
|
||||||
.set('123', {on: sinon.stub()}, 'Filename.moz', {})
|
.set('123', {on: sinon.stub()}, 'Filename.moz', {})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
assert(expire.calledOnce);
|
assert(expire.calledOnce);
|
||||||
assert(expire.calledWith('123', 86400000));
|
assert(expire.calledWith('123', 86400));
|
||||||
})
|
})
|
||||||
.catch(err => assert.fail());
|
.catch(err => assert.fail());
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,3 +5,4 @@ window.dsn = '{{{dsn}}}';
|
||||||
window.trackerId = '{{{trackerId}}}';
|
window.trackerId = '{{{trackerId}}}';
|
||||||
{{/if}}
|
{{/if}}
|
||||||
const MAXFILESIZE = {{{maxFileSize}}};
|
const MAXFILESIZE = {{{maxFileSize}}};
|
||||||
|
const EXPIRE_SECONDS = {{{expireSeconds}}};
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
<img src="/resources/illustration_expired.svg" id="expired-img" data-l10n-id="linkExpiredAlt"/>
|
<img src="/resources/illustration_expired.svg" id="expired-img" data-l10n-id="linkExpiredAlt"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="expired-description" data-l10n-id="uploadPageExplainer"></div>
|
<div class="expired-description" data-l10n-id="uploadPageExplainer"></div>
|
||||||
<a class="send-new" id="expired-send-new" data-l10n-id="sendYourFilesLink"></a>
|
<a class="send-new" href="/" id="expired-send-new" data-l10n-id="sendYourFilesLink"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue