Skip to content

Commit

Permalink
Fix: Clock reset issue (#410)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
tomiir and rocky-fleek authored Mar 29, 2022
1 parent 8580adf commit c81a5c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions source/shared/utils/time.js
Original file line number Diff line number Diff line change
@@ -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`);
Expand Down

0 comments on commit c81a5c5

Please sign in to comment.