Merge pull request #1168 from loki-project/neuroscr-fix-clock

expose window.setClockParams
pull/1170/head
Ryan Tharp 5 years ago committed by GitHub
commit cd81c132ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -124,7 +124,7 @@
};
// require for PoW to work
const setClockParams = async () => {
window.setClockParams = async () => {
// Set server-client time difference
const maxTimeDifferential = 30 + 15; // + 15 for onion requests
const timeDifferential = await getTimeDifferential();
@ -133,5 +133,5 @@
window.clientClockSynced = Math.abs(timeDifferential) < maxTimeDifferential;
return window.clientClockSynced;
};
setClockParams();
window.setClockParams();
})();

@ -1914,8 +1914,13 @@
toastOptions.id = 'expiredWarning';
}
if (!window.clientClockSynced) {
// Check to see if user has updated their clock to current time
const clockSynced = await window.LokiPublicChatAPI.setClockParams();
let clockSynced = false;
if (window.setClockParams) {
// Check to see if user has updated their clock to current time
clockSynced = await window.setClockParams();
} else {
window.log.info('setClockParams not loaded yet');
}
if (clockSynced) {
toastOptions.title = i18n('clockOutOfSync');
toastOptions.id = 'clockOutOfSync';

Loading…
Cancel
Save