From c81a5c59930209a39a10df65eb9db5f340ac0192 Mon Sep 17 00:00:00 2001 From: tomiir Date: Tue, 29 Mar 2022 12:32:57 -0300 Subject: [PATCH] Fix: Clock reset issue (#410) * Fixed manifest for CORS errors. Added cache flush to time request to prevent cached responses causing issues. Reduced diff to 2minutes * Removed weird comment Co-authored-by: rocky-fleek --- source/manifest.json | 5 +++-- source/shared/utils/time.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/manifest.json b/source/manifest.json index 1ddefc2e..517b49f1 100644 --- a/source/manifest.json +++ b/source/manifest.json @@ -15,8 +15,9 @@ "storage", "tabs", "notifications", - "https://kyasshu.fleek.co/", - "https://www.timeapi.io/api/Time/current/zone?timeZone=Africa/Abidjan" + "https://kyasshu.fleek.co/*", + "https://www.timeapi.io/api/Time/current/zone?timeZone=Etc/UTC", + "https://mainnet.plugwallet.ooo/*" ], "content_security_policy": "script-src 'self' 'wasm-eval'; object-src 'self'", "__chrome|firefox__author": "FleekHQ", diff --git a/source/shared/utils/time.js b/source/shared/utils/time.js index 2ce3a551..e6546e39 100644 --- a/source/shared/utils/time.js +++ b/source/shared/utils/time.js @@ -1,7 +1,7 @@ -const UTC_TIME_API = 'https://www.timeapi.io/api/Time/current/zone?timeZone=Africa/Abidjan'; -const MAX_MS_DIFFERENCE = 300000; +const UTC_TIME_API = 'https://www.timeapi.io/api/Time/current/zone?timeZone=Etc/UTC'; +const MAX_MS_DIFFERENCE = 120000; -export const isClockInSync = () => fetch(UTC_TIME_API) +export const isClockInSync = () => fetch(UTC_TIME_API, { cache: 'no-store' }) .then((res) => res.json()) .then((data) => { const apiTime = Date.parse(`${data.dateTime}Z`);