mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 14:40:55 +03:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c97abb46ed | ||
|
|
b8f5e371c7 | ||
|
|
401311a05f | ||
|
|
652b8e4e15 | ||
|
|
99b7e7c0f1 | ||
|
|
81442bb6f2 | ||
|
|
137f474b69 | ||
|
|
8e14d3f8f7 |
2
.prettierignore
Normal file
2
.prettierignore
Normal file
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
assets/*.js
|
||||
@@ -22,7 +22,7 @@ const experiments = {
|
||||
return this.luckyNumber(state) >= 0.5;
|
||||
},
|
||||
variant: function(state) {
|
||||
return this.luckyNumber(state) < 0.5 ? 0 : 1;
|
||||
return this.luckyNumber(state) < 0.75 ? 0 : 1;
|
||||
},
|
||||
luckyNumber: function(state) {
|
||||
return luckyNumber(
|
||||
@@ -51,7 +51,7 @@ export default function initialize(state, emitter) {
|
||||
emitter.on('DOMContentLoaded', () => {
|
||||
const xp = experiments[state.query.x];
|
||||
if (xp) {
|
||||
xp.run(state.query.v, state, emitter);
|
||||
xp.run(+state.query.v, state, emitter);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* global EXPIRE_SECONDS */
|
||||
import FileSender from './fileSender';
|
||||
import FileReceiver from './fileReceiver';
|
||||
import { copyToClipboard, delay, fadeOut } from './utils';
|
||||
import { copyToClipboard, delay, fadeOut, percent } from './utils';
|
||||
import * as metrics from './metrics';
|
||||
|
||||
function saveFile(file) {
|
||||
@@ -54,6 +54,7 @@ function exists(id) {
|
||||
|
||||
export default function(state, emitter) {
|
||||
let lastRender = 0;
|
||||
let updateTitle = false;
|
||||
|
||||
function render() {
|
||||
emitter.emit('render');
|
||||
@@ -74,7 +75,21 @@ export default function(state, emitter) {
|
||||
}
|
||||
}
|
||||
|
||||
emitter.on('DOMContentLoaded', checkFiles);
|
||||
function updateProgress() {
|
||||
if (updateTitle) {
|
||||
emitter.emit('DOMTitleChange', percent(state.transfer.progressRatio));
|
||||
}
|
||||
render();
|
||||
}
|
||||
|
||||
emitter.on('DOMContentLoaded', () => {
|
||||
document.addEventListener('blur', () => (updateTitle = true));
|
||||
document.addEventListener('focus', () => {
|
||||
updateTitle = false;
|
||||
emitter.emit('DOMTitleChange', 'Firefox Send');
|
||||
});
|
||||
checkFiles();
|
||||
});
|
||||
|
||||
emitter.on('navigate', checkFiles);
|
||||
|
||||
@@ -107,7 +122,7 @@ export default function(state, emitter) {
|
||||
emitter.on('upload', async ({ file, type }) => {
|
||||
const size = file.size;
|
||||
const sender = new FileSender(file);
|
||||
sender.on('progress', render);
|
||||
sender.on('progress', updateProgress);
|
||||
sender.on('encrypting', render);
|
||||
state.transfer = sender;
|
||||
render();
|
||||
@@ -153,7 +168,7 @@ export default function(state, emitter) {
|
||||
const size = file.size;
|
||||
const url = `/api/download/${file.id}`;
|
||||
const receiver = new FileReceiver(url, file.key);
|
||||
receiver.on('progress', render);
|
||||
receiver.on('progress', updateProgress);
|
||||
receiver.on('decrypting', render);
|
||||
state.transfer = receiver;
|
||||
const links = openLinksInNewTab();
|
||||
|
||||
10
app/main.js
10
app/main.js
@@ -1,5 +1,4 @@
|
||||
import app from './routes';
|
||||
import log from 'choo-log';
|
||||
import locale from '../common/locales';
|
||||
import fileManager from './fileManager';
|
||||
import dragManager from './dragManager';
|
||||
@@ -14,8 +13,6 @@ if (navigator.doNotTrack !== '1' && window.RAVEN_CONFIG) {
|
||||
Raven.config(window.SENTRY_ID, window.RAVEN_CONFIG).install();
|
||||
}
|
||||
|
||||
app.use(log());
|
||||
|
||||
app.use((state, emitter) => {
|
||||
// init state
|
||||
state.transfer = null;
|
||||
@@ -28,6 +25,13 @@ app.use((state, emitter) => {
|
||||
uploadButtonStyle: 'browse btn'
|
||||
};
|
||||
emitter.on('DOMContentLoaded', async () => {
|
||||
if (
|
||||
/firefox/i.test(navigator.userAgent) &&
|
||||
parseInt(navigator.userAgent.match(/firefox\/*([^\n\r]*)\./i)[1], 10) <=
|
||||
49
|
||||
) {
|
||||
return emitter.emit('replaceState', '/unsupported/outdated');
|
||||
}
|
||||
const ok = await canHasSend(assets.get('cryptofill.js'));
|
||||
if (!ok) {
|
||||
const reason = /firefox/i.test(navigator.userAgent) ? 'outdated' : 'gcm';
|
||||
|
||||
@@ -4,7 +4,7 @@ const assets = require('../../common/assets');
|
||||
function timeLeft(milliseconds) {
|
||||
const minutes = Math.floor(milliseconds / 1000 / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const seconds = Math.floor(milliseconds / 1000 % 60);
|
||||
const seconds = Math.floor((milliseconds / 1000) % 60);
|
||||
if (hours >= 1) {
|
||||
return `${hours}h ${minutes % 60}m`;
|
||||
} else if (hours === 0) {
|
||||
|
||||
@@ -40,11 +40,16 @@ module.exports = function(state, emit) {
|
||||
state.translate('downloadFileSize', { size })}</span>
|
||||
</div>
|
||||
<div class="description">${state.translate('downloadMessage')}</div>
|
||||
<img src="${assets.get(
|
||||
'illustration_download.svg'
|
||||
)}" id="download-img" alt="${state.translate('downloadAltText')}"/>
|
||||
<img
|
||||
src="${assets.get('illustration_download.svg')}"
|
||||
id="download-img"
|
||||
alt="${state.translate('downloadAltText')}"/>
|
||||
<div>
|
||||
<button id="download-btn" class="btn" onclick=${download}>${state.translate(
|
||||
<button
|
||||
id="download-btn"
|
||||
class="btn"
|
||||
title="${state.translate('downloadButtonLabel')}"
|
||||
onclick=${download}>${state.translate(
|
||||
'downloadButtonLabel'
|
||||
)}</button>
|
||||
</div>
|
||||
|
||||
@@ -17,13 +17,13 @@ module.exports = function(state, emit) {
|
||||
})}</div>
|
||||
<div id="copy">
|
||||
<input id="link" type="url" value="${file.url}" readonly="true"/>
|
||||
<button id="copy-btn" class="btn" onclick=${copyLink}>${state.translate(
|
||||
'copyUrlFormButton'
|
||||
)}</button>
|
||||
<button id="copy-btn" class="btn" title="${state.translate(
|
||||
'copyUrlFormButton'
|
||||
)}" onclick=${copyLink}>${state.translate('copyUrlFormButton')}</button>
|
||||
</div>
|
||||
<button id="delete-file" class="btn" onclick=${deleteFile}>${state.translate(
|
||||
'deleteFileButton'
|
||||
)}</button>
|
||||
<button id="delete-file" class="btn" title="${state.translate(
|
||||
'deleteFileButton'
|
||||
)}" onclick=${deleteFile}>${state.translate('deleteFileButton')}</button>
|
||||
<a class="send-new" data-state="completed" href="/" onclick=${sendNew}>${state.translate(
|
||||
'sendAnotherFileLink'
|
||||
)}</a>
|
||||
|
||||
@@ -21,9 +21,9 @@ module.exports = function(state, emit) {
|
||||
transfer.msg,
|
||||
transfer.sizes
|
||||
)}</div>
|
||||
<button id="cancel-upload" onclick=${cancel}>${state.translate(
|
||||
'uploadingPageCancel'
|
||||
)}</button>
|
||||
<button id="cancel-upload" title="${state.translate(
|
||||
'uploadingPageCancel'
|
||||
)}" onclick=${cancel}>${state.translate('uploadingPageCancel')}</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -24,9 +24,9 @@ module.exports = function(state, emit) {
|
||||
)}</em></span>
|
||||
<form method="post" action="upload" enctype="multipart/form-data">
|
||||
<label for="file-upload" id="browse" class="${state.config
|
||||
.uploadButtonStyle}">${state.translate(
|
||||
.uploadButtonStyle}" title="${state.translate(
|
||||
'uploadPageBrowseButton1'
|
||||
)}</label>
|
||||
)}">${state.translate('uploadPageBrowseButton1')}</label>
|
||||
<input id="file-upload" type="file" name="fileUploaded" onchange=${upload} />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -278,7 +278,7 @@ a {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
input[type="file"] {
|
||||
input[type='file'] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ tbody {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.icon-copy[disabled="disabled"] {
|
||||
.icon-copy[disabled='disabled'] {
|
||||
pointer-events: none;
|
||||
opacity: 0.3;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ tbody {
|
||||
|
||||
/* Popup arrow */
|
||||
.popup .popuptext::after {
|
||||
content: "";
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -11px;
|
||||
left: 20px;
|
||||
|
||||
1967
package-lock.json
generated
1967
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "firefox-send",
|
||||
"description": "File Sharing Experiment",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.3",
|
||||
"author": "Mozilla (https://mozilla.org)",
|
||||
"repository": "mozilla/send",
|
||||
"homepage": "https://github.com/mozilla/send/",
|
||||
@@ -17,7 +17,7 @@
|
||||
"lint-locales": "node scripts/lint-locales",
|
||||
"lint-locales:dev": "npm run lint-locales",
|
||||
"lint-locales:prod": "npm run lint-locales -- --production",
|
||||
"format": "prettier '!(dist|node_modules|assets)/**/*.js' 'assets/*.css' --single-quote --write",
|
||||
"format": "prettier '**/*.js' 'assets/*.css' --single-quote --write",
|
||||
"get-prod-locales": "node scripts/get-prod-locales",
|
||||
"get-prod-locales:write": "npm run get-prod-locales -- --write",
|
||||
"changelog": "github-changes -o mozilla -r send --only-pulls --use-commit-body --no-merges",
|
||||
@@ -43,7 +43,7 @@
|
||||
"node": ">=8.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^7.1.2",
|
||||
"autoprefixer": "^7.1.4",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-plugin-yo-yoify": "^0.7.0",
|
||||
@@ -51,13 +51,12 @@
|
||||
"babel-preset-env": "^1.6.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"choo-log": "^7.2.1",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"cross-env": "^5.0.5",
|
||||
"css-loader": "^0.28.5",
|
||||
"css-loader": "^0.28.7",
|
||||
"css-mqpacker": "^6.0.1",
|
||||
"cssnano": "^3.10.0",
|
||||
"eslint": "^4.5.0",
|
||||
"eslint": "^4.7.2",
|
||||
"eslint-plugin-mocha": "^4.11.0",
|
||||
"eslint-plugin-node": "^5.1.1",
|
||||
"eslint-plugin-security": "^1.4.0",
|
||||
@@ -68,37 +67,37 @@
|
||||
"github-changes": "^1.1.0",
|
||||
"html-loader": "^0.5.1",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^4.0.4",
|
||||
"mocha": "^3.5.0",
|
||||
"lint-staged": "^4.2.3",
|
||||
"mocha": "^3.5.3",
|
||||
"nanobus": "^4.2.0",
|
||||
"npm-run-all": "^4.0.2",
|
||||
"npm-run-all": "^4.1.1",
|
||||
"postcss-loader": "^2.0.6",
|
||||
"prettier": "^1.5.3",
|
||||
"prettier": "^1.7.0",
|
||||
"proxyquire": "^1.8.0",
|
||||
"raven-js": "^3.17.0",
|
||||
"redis-mock": "^0.20.0",
|
||||
"require-from-string": "^1.2.1",
|
||||
"rimraf": "^2.6.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"selenium-webdriver": "^3.5.0",
|
||||
"sinon": "^3.2.1",
|
||||
"sinon": "^3.3.0",
|
||||
"string-hash": "^1.1.3",
|
||||
"stylelint-config-standard": "^17.0.0",
|
||||
"stylelint-no-unsupported-browser-features": "^1.0.0",
|
||||
"supertest": "^3.0.0",
|
||||
"testpilot-ga": "^0.3.0",
|
||||
"val-loader": "^1.0.2",
|
||||
"webpack": "^3.5.5",
|
||||
"webpack-dev-server": "^2.7.1",
|
||||
"webpack-manifest-plugin": "^1.3.1",
|
||||
"webpack": "^3.6.0",
|
||||
"webpack-dev-server": "^2.8.2",
|
||||
"webpack-manifest-plugin": "^1.3.2",
|
||||
"webpack-unassert-loader": "^1.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"aws-sdk": "^2.103.0",
|
||||
"body-parser": "^1.17.2",
|
||||
"choo": "^6.0.0",
|
||||
"aws-sdk": "^2.122.0",
|
||||
"body-parser": "^1.18.2",
|
||||
"choo": "^6.1.0",
|
||||
"connect-busboy": "0.0.2",
|
||||
"convict": "^4.0.0",
|
||||
"express": "^4.15.4",
|
||||
"express": "^4.15.5",
|
||||
"express-request-language": "^1.1.12",
|
||||
"fluent": "^0.4.1",
|
||||
"fluent-langneg": "^0.1.0",
|
||||
@@ -123,6 +122,7 @@
|
||||
"es-CL",
|
||||
"es-ES",
|
||||
"es-MX",
|
||||
"et",
|
||||
"fa",
|
||||
"fr",
|
||||
"fy-NL",
|
||||
|
||||
@@ -21,6 +21,7 @@ uploadingPageMessage = Aegumise sätteid saab muuta siis, kui faili üles laadit
|
||||
uploadingPageCancel = Katkesta üleslaadimine
|
||||
uploadCancelNotification = Üleslaadimine katkestati
|
||||
uploadingPageLargeFileMessage = Fail on suur ja selle üleslaadimine võib aega võtta.
|
||||
uploadingFileNotification = Teavita mind üleslaadimise lõppemisest.
|
||||
uploadSuccessConfirmHeader = Saatmiseks valmis
|
||||
uploadSvgAlt = Laadi üles
|
||||
uploadSuccessTimingHeader = Link failile aegub pärast 1. allalaadimist või 24 tunni möödumisel.
|
||||
@@ -64,6 +65,7 @@ copyFileList = Kopeeri URL
|
||||
// expiryFileList is used as a column header
|
||||
expiryFileList = Aegub
|
||||
deleteFileList = Kustuta
|
||||
nevermindButton = Ära pane tähele
|
||||
legalHeader = Tingimused ja privaatsusreeglid
|
||||
legalNoticeTestPilot = Firefox Send on praegu Test Piloti eksperiment ja sellele rakenduvad Test Piloti <a>teenusetingimused</a> ning <a>privaatsusreeglid</a>. Rohkem teavet selle eksperimendi ja kogutavate andmete kohta leiab <a>siit</a>.
|
||||
legalNoticeMozilla = Firefox Sendi veebilehe kasutamisele rakenduvad ka Mozilla <a>veebilehtede privaatsusreeglid</a> ja <a>veebilehtede teenusetingimused</a>.
|
||||
|
||||
@@ -48,6 +48,7 @@ linkExpiredAlt = లంకె గడువు ముగిసింది
|
||||
expiredPageHeader = ఈ లంకె గడువు ముగిసింది లేదా ముందు ఎప్పుడూ ఉనికిలో లేదు!
|
||||
notSupportedHeader = మీ విహారిణికి మద్దతు లేదు.
|
||||
notSupportedLink = నా విహారిణికి ఎందుకు మద్దతు లేదు?
|
||||
notSupportedOutdatedDetail = దురదృష్టవశాత్తు Firefox యొక్క ఈ వెర్షన్ Firefox సాంకేతికతను పంపే వెబ్ సాంకేతికతకు మద్దతు ఇవ్వదు. మీరు మీ బ్రౌజర్ని నవీకరించాలి.
|
||||
updateFirefox = Firefoxను నవీకరించు
|
||||
downloadFirefoxButtonSub = ఉచిత దిగుమతులు
|
||||
uploadedFile = దస్త్రం
|
||||
|
||||
@@ -19,6 +19,8 @@ module.exports = function(req) {
|
||||
uploadWindowStyle: 'upload-window',
|
||||
uploadButtonStyle: 'browse btn'
|
||||
},
|
||||
fira: false,
|
||||
fileInfo: {},
|
||||
layout
|
||||
};
|
||||
};
|
||||
|
||||
@@ -54,7 +54,9 @@ describe('Server integration tests', function() {
|
||||
}
|
||||
|
||||
it('Responds with a 200 when the service is up', function() {
|
||||
return request(server).get('/').expect(200);
|
||||
return request(server)
|
||||
.get('/')
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('Rejects with a 404 when a file id is not valid', function() {
|
||||
@@ -89,7 +91,9 @@ describe('Server integration tests', function() {
|
||||
});
|
||||
|
||||
it('Responds with a 200 if a file exists', function() {
|
||||
return request(server).get('/exists/' + fileId).expect(200);
|
||||
return request(server)
|
||||
.get('/exists/' + fileId)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('Exists in the redis server', function() {
|
||||
@@ -107,7 +111,9 @@ describe('Server integration tests', function() {
|
||||
});
|
||||
|
||||
it('Fails delete if the id is invalid', function() {
|
||||
return request(server).post('/delete/1').expect(404);
|
||||
return request(server)
|
||||
.post('/delete/1')
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('Successfully deletes if the id is valid and the delete token matches', function(
|
||||
@@ -129,7 +135,9 @@ describe('Server integration tests', function() {
|
||||
});
|
||||
|
||||
it('Responds with a 404 if a file does not exist', function() {
|
||||
return request(server).get('/exists/notfound').expect(404);
|
||||
return request(server)
|
||||
.get('/exists/notfound')
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('Uploads properly after a delete', function(done) {
|
||||
@@ -150,21 +158,25 @@ describe('Server integration tests', function() {
|
||||
});
|
||||
|
||||
it('Responds with a 200 for the download page', function() {
|
||||
return request(server).get('/download/' + fileId).expect(200);
|
||||
return request(server)
|
||||
.get('/download/' + fileId)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('Downloads a file properly', function() {
|
||||
return request(server).get('/assets/download/' + fileId).then(res => {
|
||||
assert(res.header.hasOwnProperty('content-disposition'));
|
||||
assert(res.header.hasOwnProperty('content-type'));
|
||||
assert(res.header.hasOwnProperty('content-length'));
|
||||
assert(res.header.hasOwnProperty('x-file-metadata'));
|
||||
assert.equal(
|
||||
res.header['content-disposition'],
|
||||
'attachment; filename=test_upload.txt'
|
||||
);
|
||||
assert.equal(res.header['content-type'], 'application/octet-stream');
|
||||
});
|
||||
return request(server)
|
||||
.get('/assets/download/' + fileId)
|
||||
.then(res => {
|
||||
assert(res.header.hasOwnProperty('content-disposition'));
|
||||
assert(res.header.hasOwnProperty('content-type'));
|
||||
assert(res.header.hasOwnProperty('content-length'));
|
||||
assert(res.header.hasOwnProperty('x-file-metadata'));
|
||||
assert.equal(
|
||||
res.header['content-disposition'],
|
||||
'attachment; filename=test_upload.txt'
|
||||
);
|
||||
assert.equal(res.header['content-type'], 'application/octet-stream');
|
||||
});
|
||||
});
|
||||
|
||||
it('The file is deleted after one download', function() {
|
||||
|
||||
Reference in New Issue
Block a user