2017-08-24 21:54:02 +00:00
|
|
|
|
const config = require('./config');
|
|
|
|
|
const layout = require('./layout');
|
2018-08-07 22:40:17 +00:00
|
|
|
|
const assets = require('../common/assets');
|
2018-11-20 14:50:59 +00:00
|
|
|
|
const getTranslator = require('./locale');
|
2018-11-20 20:07:47 +00:00
|
|
|
|
const { getFxaConfig } = require('./fxa');
|
2017-08-24 21:54:02 +00:00
|
|
|
|
|
2018-11-20 20:07:47 +00:00
|
|
|
|
module.exports = async function(req) {
|
2017-08-24 21:54:02 +00:00
|
|
|
|
const locale = req.language || 'en-US';
|
2018-11-20 20:07:47 +00:00
|
|
|
|
let authConfig = null;
|
|
|
|
|
if (config.fxa_client_id) {
|
|
|
|
|
try {
|
|
|
|
|
authConfig = await getFxaConfig();
|
|
|
|
|
authConfig.client_id = config.fxa_client_id;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// continue without accounts
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-08-24 21:54:02 +00:00
|
|
|
|
return {
|
2018-12-21 18:27:46 +00:00
|
|
|
|
archive: {
|
|
|
|
|
numFiles: 0
|
|
|
|
|
},
|
2017-08-24 21:54:02 +00:00
|
|
|
|
locale,
|
2018-09-19 16:01:19 +00:00
|
|
|
|
capabilities: { account: false },
|
2018-11-20 14:50:59 +00:00
|
|
|
|
translate: getTranslator(locale),
|
2017-08-24 21:54:02 +00:00
|
|
|
|
title: 'Firefox Send',
|
|
|
|
|
description:
|
|
|
|
|
'Encrypt and send files with a link that automatically expires to ensure your important documents don’t stay online forever.',
|
|
|
|
|
baseUrl: config.base_url,
|
|
|
|
|
ui: {},
|
|
|
|
|
storage: {
|
|
|
|
|
files: []
|
|
|
|
|
},
|
2017-09-14 19:15:08 +00:00
|
|
|
|
fileInfo: {},
|
2018-08-07 22:40:17 +00:00
|
|
|
|
cspNonce: req.cspNonce,
|
2018-09-14 15:00:33 +00:00
|
|
|
|
user: { avatar: assets.get('user.svg'), loggedIn: false },
|
2019-03-14 18:40:01 +00:00
|
|
|
|
route: req.route.path,
|
2018-11-20 20:07:47 +00:00
|
|
|
|
authConfig,
|
2017-08-24 21:54:02 +00:00
|
|
|
|
layout
|
|
|
|
|
};
|
|
|
|
|
};
|