fixes #319 - unsupported redirect
This commit is contained in:
parent
7237800a91
commit
6ff251b24a
11
app/main.js
11
app/main.js
|
@ -21,20 +21,23 @@ app.use((state, emitter) => {
|
||||||
state.storage = storage;
|
state.storage = storage;
|
||||||
state.raven = Raven;
|
state.raven = Raven;
|
||||||
emitter.on('DOMContentLoaded', async () => {
|
emitter.on('DOMContentLoaded', async () => {
|
||||||
|
let reason = null;
|
||||||
if (
|
if (
|
||||||
/firefox/i.test(navigator.userAgent) &&
|
/firefox/i.test(navigator.userAgent) &&
|
||||||
parseInt(navigator.userAgent.match(/firefox\/*([^\n\r]*)\./i)[1], 10) <=
|
parseInt(navigator.userAgent.match(/firefox\/*([^\n\r]*)\./i)[1], 10) <=
|
||||||
49
|
49
|
||||||
) {
|
) {
|
||||||
return emitter.emit('replaceState', '/unsupported/outdated');
|
reason = 'outdated';
|
||||||
}
|
}
|
||||||
if (/edge\/\d+/i.test(navigator.userAgent)) {
|
if (/edge\/\d+/i.test(navigator.userAgent)) {
|
||||||
return emitter.emit('replaceState', '/unsupported/edge');
|
reason = 'edge';
|
||||||
}
|
}
|
||||||
const ok = await canHasSend(assets.get('cryptofill.js'));
|
const ok = await canHasSend(assets.get('cryptofill.js'));
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
const reason = /firefox/i.test(navigator.userAgent) ? 'outdated' : 'gcm';
|
reason = /firefox/i.test(navigator.userAgent) ? 'outdated' : 'gcm';
|
||||||
emitter.emit('replaceState', `/unsupported/${reason}`);
|
}
|
||||||
|
if (reason) {
|
||||||
|
setTimeout(() => emitter.emit('replaceState', `/unsupported/${reason}`));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue