From 752b30debe3a9b536076ef65812cdd23c664dbca Mon Sep 17 00:00:00 2001 From: Michael Yankelev Date: Fri, 17 Feb 2023 14:16:08 +0100 Subject: [PATCH 1/4] update service worker and dependencies --- packages/files-ui/package.json | 8 +- .../public/serviceworker/redirect.html | 528 +++++++++--------- packages/files-ui/public/serviceworker/sw.js | 9 +- .../src/Contexts/ThresholdKeyContext.tsx | 8 +- yarn.lock | 484 ++++++++-------- 5 files changed, 514 insertions(+), 523 deletions(-) diff --git a/packages/files-ui/package.json b/packages/files-ui/package.json index 6502e66724..21da359b49 100644 --- a/packages/files-ui/package.json +++ b/packages/files-ui/package.json @@ -15,10 +15,10 @@ "@sentry/react": "^5.28.0", "@stripe/react-stripe-js": "^1.4.1", "@stripe/stripe-js": "^1.18.0", - "@tkey/default": "7.0.0", - "@tkey/security-questions": "7.0.0", - "@tkey/web-storage": "7.0.0", - "@toruslabs/customauth": "11.0.0", + "@tkey/default": "7.2.0", + "@tkey/security-questions": "7.2.0", + "@tkey/web-storage": "7.2.0", + "@toruslabs/customauth": "11.4.2", "@types/filesystem": "^0.0.32", "@types/uuid": "^8.3.0", "axios": "0.26.1", diff --git a/packages/files-ui/public/serviceworker/redirect.html b/packages/files-ui/public/serviceworker/redirect.html index 3ed34e79f7..8597e21d5d 100644 --- a/packages/files-ui/public/serviceworker/redirect.html +++ b/packages/files-ui/public/serviceworker/redirect.html @@ -1,316 +1,290 @@ - - - - - Redirect - - + } + + - -
-
-
-
-
-
-

- You can close this window now -

+ +
+
+
+
+
- - + - - + } else { + // in preopen, awaiting redirect + try { + bc = new broadcastChannelLib.BroadcastChannel("preopen_channel_" + preopenInstanceId, broadcastChannelOptions); + bc.onmessage = function (ev) { + var { preopenInstanceId: oldId, payload, message } = ev.data; + if (oldId === preopenInstanceId && payload && payload.url) { + window.location.href = payload.url; + } else if (oldId === preopenInstanceId && message === "setup_complete") { + bc.postMessage({ + data: { + preopenInstanceId: preopenInstanceId, + message: "popup_loaded", + }, + }); + } + if (ev.error && ev.error !== "") { + console.error(ev.error); + bc.close(); + } + }; + } catch (err) { + console.error(err, "service worker error in preopen"); + bc && bc.close(); + window.close(); + showCloseText(); + } + } + + + + \ No newline at end of file diff --git a/packages/files-ui/public/serviceworker/sw.js b/packages/files-ui/public/serviceworker/sw.js index e49ffdfb2b..60795228e4 100644 --- a/packages/files-ui/public/serviceworker/sw.js +++ b/packages/files-ui/public/serviceworker/sw.js @@ -1,8 +1,3 @@ -// This service worker handles all OAuth redirects and calls, as well as parsing -// tokens returned, parsing said tokens and communication with the DirectAuth SDK. -// For more information see https://github.com/torusresearch/torus-direct-web-sdk/blob/master/README.md -// and https://docs.tor.us/direct-auth/integrating-directauth - /* eslint-disable */ function getScope() { return self.registration.scope; @@ -126,8 +121,8 @@ self.addEventListener("fetch", function (event) {

You can close this window now