π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Reset Cast receiver state before pairing
Manav Rathifab899b4987a
diff --git a/web/apps/cast/src/pages/index.tsx b/web/apps/cast/src/pages/index.tsxindex 5bf55e3a95..f57f83db91 100644--- a/web/apps/cast/src/pages/index.tsx+++ b/web/apps/cast/src/pages/index.tsx@@ -1,5 +1,9 @@import { PairingCode } from "@/components/PairingCode";-import { readCastData, storeCastData } from "@/services/cast-data";+import {+ clearCastData,+ readCastData,+ storeCastData,+} from "@/services/cast-data";import { getCastPayload, register } from "@/services/pair";import { Box, Stack, styled, Typography } from "@mui/material";import { EnteLogo } from "ente-base/components/EnteLogo";@@ -16,6 +20,8 @@ const Page: React.FC = () => {const router = useRouter();+ useEffect(() => clearCastData(), []);+useEffect(() => {if (!pairingCode) {void register().then((r) => {@@ -83,6 +89,8 @@ const Page: React.FC = () => {export default Page;const Container = styled(Stack)`+ /* Chrome 92 does not support svh. */+ height: 100vh;height: 100svh;justify-content: center;align-items: center;diff --git a/web/apps/cast/src/services/cast-data.ts b/web/apps/cast/src/services/cast-data.tsindex 700f1ca860..4ae1cca11e 100644--- a/web/apps/cast/src/services/cast-data.ts+++ b/web/apps/cast/src/services/cast-data.ts@@ -9,6 +9,11 @@ export interface CastData {castToken: string;}+export const clearCastData = () => {+ for (const key of ["collectionID", "collectionKey", "castToken"])+ localStorage.removeItem(key);+};+/*** Save the data received after pairing with a sender into local storage.*