enabled accounts on Edge
This commit is contained in:
parent
c6cc5f4ac4
commit
cccc1a5383
4 changed files with 16 additions and 2 deletions
|
@ -86,7 +86,7 @@ export default async function getCapabilities() {
|
|||
}
|
||||
let account = typeof AUTH_CONFIG !== 'undefined';
|
||||
try {
|
||||
account = account && !!localStorage && browserName() !== 'edge';
|
||||
account = account && !!localStorage;
|
||||
} catch (e) {
|
||||
account = false;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,19 @@ export default function(state, emitter) {
|
|||
render();
|
||||
});
|
||||
|
||||
/*
|
||||
FIXME choo on Edge double-triggers loaded routes
|
||||
causing 'authenticate' to fire twice which leads to
|
||||
an error. Until that's fixed we have authLocked to
|
||||
prevent the second event from causing the error.
|
||||
Once choo doesn't double-trigger we can remove authLocked.
|
||||
*/
|
||||
let authLocked = false;
|
||||
emitter.on('authenticate', async (code, oauthState) => {
|
||||
if (authLocked) {
|
||||
return;
|
||||
}
|
||||
authLocked = true;
|
||||
try {
|
||||
await state.user.finishLogin(code, oauthState);
|
||||
await state.user.syncFileList();
|
||||
|
@ -116,6 +128,7 @@ export default function(state, emitter) {
|
|||
emitter.emit('replaceState', '/error');
|
||||
setTimeout(render);
|
||||
}
|
||||
authLocked = false;
|
||||
});
|
||||
|
||||
emitter.on('upload', async () => {
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = function(app = choo()) {
|
|||
app.route('/legal', body(require('./ui/legal')));
|
||||
app.route('/error', body(require('./ui/error')));
|
||||
app.route('/blank', body(require('./ui/blank')));
|
||||
app.route('/oauth', async function(state, emit) {
|
||||
app.route('/oauth', function(state, emit) {
|
||||
emit('authenticate', state.query.code, state.query.state);
|
||||
});
|
||||
app.route('*', body(require('./ui/notFound')));
|
||||
|
|
|
@ -70,6 +70,7 @@ module.exports = function(app) {
|
|||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.text());
|
||||
app.get('/', language, pages.index);
|
||||
app.get('/error', language, pages.blank);
|
||||
app.get('/oauth', language, pages.blank);
|
||||
app.get('/legal', language, pages.legal);
|
||||
app.get('/app.webmanifest', language, require('./webmanifest'));
|
||||
|
|
Loading…
Reference in a new issue