enabled accounts on Edge
This commit is contained in:
parent
c6cc5f4ac4
commit
cccc1a5383
@ -86,7 +86,7 @@ export default async function getCapabilities() {
|
|||||||
}
|
}
|
||||||
let account = typeof AUTH_CONFIG !== 'undefined';
|
let account = typeof AUTH_CONFIG !== 'undefined';
|
||||||
try {
|
try {
|
||||||
account = account && !!localStorage && browserName() !== 'edge';
|
account = account && !!localStorage;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
account = false;
|
account = false;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,19 @@ export default function(state, emitter) {
|
|||||||
render();
|
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) => {
|
emitter.on('authenticate', async (code, oauthState) => {
|
||||||
|
if (authLocked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
authLocked = true;
|
||||||
try {
|
try {
|
||||||
await state.user.finishLogin(code, oauthState);
|
await state.user.finishLogin(code, oauthState);
|
||||||
await state.user.syncFileList();
|
await state.user.syncFileList();
|
||||||
@ -116,6 +128,7 @@ export default function(state, emitter) {
|
|||||||
emitter.emit('replaceState', '/error');
|
emitter.emit('replaceState', '/error');
|
||||||
setTimeout(render);
|
setTimeout(render);
|
||||||
}
|
}
|
||||||
|
authLocked = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
emitter.on('upload', async () => {
|
emitter.on('upload', async () => {
|
||||||
|
@ -10,7 +10,7 @@ module.exports = function(app = choo()) {
|
|||||||
app.route('/legal', body(require('./ui/legal')));
|
app.route('/legal', body(require('./ui/legal')));
|
||||||
app.route('/error', body(require('./ui/error')));
|
app.route('/error', body(require('./ui/error')));
|
||||||
app.route('/blank', body(require('./ui/blank')));
|
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);
|
emit('authenticate', state.query.code, state.query.state);
|
||||||
});
|
});
|
||||||
app.route('*', body(require('./ui/notFound')));
|
app.route('*', body(require('./ui/notFound')));
|
||||||
|
@ -70,6 +70,7 @@ module.exports = function(app) {
|
|||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
app.use(bodyParser.text());
|
app.use(bodyParser.text());
|
||||||
app.get('/', language, pages.index);
|
app.get('/', language, pages.index);
|
||||||
|
app.get('/error', language, pages.blank);
|
||||||
app.get('/oauth', language, pages.blank);
|
app.get('/oauth', language, pages.blank);
|
||||||
app.get('/legal', language, pages.legal);
|
app.get('/legal', language, pages.legal);
|
||||||
app.get('/app.webmanifest', language, require('./webmanifest'));
|
app.get('/app.webmanifest', language, require('./webmanifest'));
|
||||||
|
Loading…
Reference in New Issue
Block a user