a new approach for the ui
This commit is contained in:
parent
cc85486414
commit
f0cfc19f8c
34 changed files with 2246 additions and 146 deletions
|
@ -9,7 +9,10 @@ async function getFxaConfig() {
|
|||
if (fxaConfig && Date.now() - lastConfigRefresh < 1000 * 60 * 5) {
|
||||
return fxaConfig;
|
||||
}
|
||||
const res = await fetch(`${config.fxa_url}/.well-known/openid-configuration`);
|
||||
const res = await fetch(
|
||||
`${config.fxa_url}/.well-known/openid-configuration`,
|
||||
{ timeout: 3000 }
|
||||
);
|
||||
fxaConfig = await res.json();
|
||||
lastConfigRefresh = Date.now();
|
||||
return fxaConfig;
|
||||
|
|
|
@ -31,9 +31,13 @@ if (config.analytics_id) {
|
|||
module.exports = async function(req, res) {
|
||||
let authConfig = '';
|
||||
if (config.fxa_client_id) {
|
||||
const fxaConfig = await getFxaConfig();
|
||||
fxaConfig.client_id = config.fxa_client_id;
|
||||
authConfig = `var AUTH_CONFIG = ${JSON.stringify(fxaConfig)};`;
|
||||
try {
|
||||
const fxaConfig = await getFxaConfig();
|
||||
fxaConfig.client_id = config.fxa_client_id;
|
||||
authConfig = `var AUTH_CONFIG = ${JSON.stringify(fxaConfig)};`;
|
||||
} catch (e) {
|
||||
// continue without accounts
|
||||
}
|
||||
}
|
||||
/* eslint-disable no-useless-escape */
|
||||
const jsconfig = `
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue