commit
73180ae9b3
@ -2,6 +2,9 @@ const FileReceiver = require('./fileReceiver');
|
||||
const { notify } = require('./utils');
|
||||
const $ = require('jquery');
|
||||
|
||||
const Raven = window.Raven;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#download-progress').hide();
|
||||
$('#send-file').click(() => {
|
||||
@ -59,6 +62,10 @@ $(document).ready(function() {
|
||||
a.download = fname;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
})
|
||||
.catch(err => {
|
||||
Raven.captureException(err);
|
||||
return Promise.reject(err);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
const EventEmitter = require('events');
|
||||
const { strToIv } = require('./utils');
|
||||
|
||||
const Raven = window.Raven;
|
||||
|
||||
class FileReceiver extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
@ -61,7 +63,8 @@ class FileReceiver extends EventEmitter {
|
||||
true,
|
||||
['encrypt', 'decrypt']
|
||||
)
|
||||
]).then(([fdata, key]) => {
|
||||
])
|
||||
.then(([fdata, key]) => {
|
||||
const salt = this.salt;
|
||||
return Promise.all([
|
||||
window.crypto.subtle.decrypt(
|
||||
@ -76,6 +79,10 @@ class FileReceiver extends EventEmitter {
|
||||
resolve(fdata.fname);
|
||||
})
|
||||
]);
|
||||
})
|
||||
.catch(err => {
|
||||
Raven.captureException(err);
|
||||
return Promise.reject(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
const EventEmitter = require('events');
|
||||
const { ivToStr } = require('./utils');
|
||||
|
||||
const Raven = window.Raven;
|
||||
|
||||
class FileSender extends EventEmitter {
|
||||
constructor(file) {
|
||||
super();
|
||||
@ -64,6 +66,10 @@ class FileSender extends EventEmitter {
|
||||
window.crypto.subtle.exportKey('jwk', secretKey)
|
||||
]);
|
||||
})
|
||||
.catch(err => {
|
||||
Raven.captureException(err)
|
||||
return Promise.reject(err);
|
||||
})
|
||||
.then(([encrypted, keydata]) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const file = this.file;
|
||||
@ -99,6 +105,10 @@ class FileSender extends EventEmitter {
|
||||
xhr.open('post', '/upload/' + fileId, true);
|
||||
xhr.send(fd);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
Raven.captureException(err)
|
||||
return Promise.reject(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,5 @@
|
||||
window.Raven = require('raven-js');
|
||||
window.Raven.config(window.dsn).install();
|
||||
window.dsn = undefined;
|
||||
require('./upload');
|
||||
require('./download');
|
||||
|
@ -2,6 +2,8 @@ const FileSender = require('./fileSender');
|
||||
const { notify } = require('./utils');
|
||||
const $ = require('jquery');
|
||||
|
||||
const Raven = window.Raven;
|
||||
|
||||
$(document).ready(function() {
|
||||
// reset copy button
|
||||
const $copyBtn = $('#copy-btn');
|
||||
@ -112,6 +114,10 @@ $(document).ready(function() {
|
||||
).then(() => {
|
||||
$(e.target).parents('tr').remove();
|
||||
localStorage.removeItem(info.fileId);
|
||||
})
|
||||
.catch(err => {
|
||||
Raven.captureException(err);
|
||||
return Promise.reject(err);
|
||||
});
|
||||
});
|
||||
|
||||
@ -125,6 +131,10 @@ $(document).ready(function() {
|
||||
$('#file-list').hide();
|
||||
$('#upload-progress').hide();
|
||||
$('#share-link').show();
|
||||
})
|
||||
.catch(err => {
|
||||
Raven.captureException(err);
|
||||
return Promise.reject(err);
|
||||
});
|
||||
|
||||
function toggleShow() {
|
||||
|
1938
package-lock.json
generated
1938
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,7 @@
|
||||
"jquery": "^3.2.1",
|
||||
"mozlog": "^2.1.1",
|
||||
"node-fetch": "^1.7.1",
|
||||
"raven-js": "^3.16.0",
|
||||
"redis": "^2.7.1",
|
||||
"uglify-es": "3.0.19"
|
||||
},
|
||||
|
@ -27,6 +27,11 @@ const conf = convict({
|
||||
default: 'UA-101393094-1',
|
||||
env: 'GOOGLE_ANALYTICS_ID'
|
||||
},
|
||||
sentry_id: {
|
||||
format: String,
|
||||
default: 'https://cdf9a4f43a584f759586af8ceb2194f2@sentry.prod.mozaws.net/238',
|
||||
env: 'P2P_SENTRY_DSN'
|
||||
},
|
||||
env: {
|
||||
format: ['production', 'development', 'test'],
|
||||
default: 'development',
|
||||
|
@ -16,13 +16,10 @@ const log = mozlog('portal.server');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.engine(
|
||||
'handlebars',
|
||||
exphbs({
|
||||
app.engine('handlebars', exphbs({
|
||||
defaultLayout: 'main',
|
||||
partialsDir: 'views/partials/'
|
||||
})
|
||||
);
|
||||
}));
|
||||
app.set('view engine', 'handlebars');
|
||||
|
||||
app.use(helmet());
|
||||
@ -30,10 +27,12 @@ app.use(busboy());
|
||||
app.use(bodyParser.json());
|
||||
app.use(express.static(path.join(__dirname, '../public')));
|
||||
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.render('index', {
|
||||
shouldRenderAnalytics: notLocalHost,
|
||||
trackerId: conf.analytics_id
|
||||
trackerId: conf.analytics_id,
|
||||
dsn: conf.sentry_id
|
||||
});
|
||||
});
|
||||
|
||||
@ -54,7 +53,8 @@ app.get('/download/:id', (req, res) => {
|
||||
filename: filename,
|
||||
filesize: bytes(contentLength),
|
||||
shouldRenderAnalytics: notLocalHost,
|
||||
trackerId: conf.analytics_id
|
||||
trackerId: conf.analytics_id,
|
||||
dsn: conf.sentry_id
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
|
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Download your file</title>
|
||||
{{> sentry dsn=dsn}}
|
||||
<script src="/bundle.js"></script>
|
||||
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/main.css" />
|
||||
|
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Firefox Fileshare</title>
|
||||
{{> sentry dsn=dsn}}
|
||||
<script src="/bundle.js"></script>
|
||||
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/main.css" />
|
||||
|
3
views/partials/sentry.handlebars
Normal file
3
views/partials/sentry.handlebars
Normal file
@ -0,0 +1,3 @@
|
||||
<script>
|
||||
window.dsn = '{{{dsn}}}';
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user