disable capabilities.account when no FXA_CLIENT_ID is set
This commit is contained in:
parent
e3087f008c
commit
93e82cf953
@ -1,3 +1,4 @@
|
|||||||
|
/* global AUTH_CONFIG */
|
||||||
import { browserName } from './utils';
|
import { browserName } from './utils';
|
||||||
|
|
||||||
async function checkCrypto() {
|
async function checkCrypto() {
|
||||||
@ -64,9 +65,9 @@ export default async function capabilities() {
|
|||||||
const crypto = await checkCrypto();
|
const crypto = await checkCrypto();
|
||||||
const nativeStreams = checkStreams();
|
const nativeStreams = checkStreams();
|
||||||
const polyStreams = nativeStreams ? false : polyfillStreams();
|
const polyStreams = nativeStreams ? false : polyfillStreams();
|
||||||
let account = false;
|
let account = typeof AUTH_CONFIG !== 'undefined';
|
||||||
try {
|
try {
|
||||||
account = !!localStorage;
|
account = account && !!localStorage;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// nevermind
|
// nevermind
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ const conf = convict({
|
|||||||
},
|
},
|
||||||
fxa_client_id: {
|
fxa_client_id: {
|
||||||
format: String,
|
format: String,
|
||||||
default: 'b50ec33d3c9beb6d', // localhost
|
default: '', // disabled
|
||||||
env: 'FXA_CLIENT_ID'
|
env: 'FXA_CLIENT_ID'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -29,8 +29,12 @@ if (config.analytics_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = async function(req, res) {
|
module.exports = async function(req, res) {
|
||||||
const fxaConfig = await getFxaConfig();
|
let authConfig = '';
|
||||||
fxaConfig.client_id = config.fxa_client_id;
|
if (config.fxa_client_id) {
|
||||||
|
const fxaConfig = await getFxaConfig();
|
||||||
|
fxaConfig.client_id = config.fxa_client_id;
|
||||||
|
authConfig = `var AUTH_CONFIG = ${JSON.stringify(fxaConfig)};`;
|
||||||
|
}
|
||||||
/* eslint-disable no-useless-escape */
|
/* eslint-disable no-useless-escape */
|
||||||
const jsconfig = `
|
const jsconfig = `
|
||||||
var isIE = /trident\\\/7\.|msie/i.test(navigator.userAgent);
|
var isIE = /trident\\\/7\.|msie/i.test(navigator.userAgent);
|
||||||
@ -53,7 +57,7 @@ module.exports = async function(req, res) {
|
|||||||
var DEFAULTS = {
|
var DEFAULTS = {
|
||||||
EXPIRE_SECONDS: ${config.default_expire_seconds}
|
EXPIRE_SECONDS: ${config.default_expire_seconds}
|
||||||
};
|
};
|
||||||
var AUTH_CONFIG = ${JSON.stringify(fxaConfig)};
|
${authConfig};
|
||||||
${ga}
|
${ga}
|
||||||
${sentry}
|
${sentry}
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user