From f28508b849f6ee76ef080eaab37a707799313429 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Mon, 8 Jun 2020 20:34:04 -0700 Subject: [PATCH 1/3] expose window.setClockParams --- js/expire.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/expire.js b/js/expire.js index ba200c41e..e76c64acf 100644 --- a/js/expire.js +++ b/js/expire.js @@ -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(); })(); From 5a54eaa79a3139e41fbdba317708d258965a35c3 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Mon, 8 Jun 2020 20:40:40 -0700 Subject: [PATCH 2/3] use window.setClockParams --- js/views/conversation_view.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index f6560102f..d9d2d9801 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -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 { + log.info('setClockParams not loaded yet'); + } if (clockSynced) { toastOptions.title = i18n('clockOutOfSync'); toastOptions.id = 'clockOutOfSync'; From 6fd0183d1144caa8ad957e37c660c25b814e0909 Mon Sep 17 00:00:00 2001 From: Ryan Tharp Date: Mon, 8 Jun 2020 20:50:49 -0700 Subject: [PATCH 3/3] lint/window.log --- js/views/conversation_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index d9d2d9801..fbef3eb08 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -1919,7 +1919,7 @@ // Check to see if user has updated their clock to current time clockSynced = await window.setClockParams(); } else { - log.info('setClockParams not loaded yet'); + window.log.info('setClockParams not loaded yet'); } if (clockSynced) { toastOptions.title = i18n('clockOutOfSync');