π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Wait for pairing code before initializing cast
Manav Rathi943f9ea9c156
diff --git a/web/apps/cast/src/pages/index.tsx b/web/apps/cast/src/pages/index.tsxindex bc0f6253db..98dabd97e8 100644--- a/web/apps/cast/src/pages/index.tsx+++ b/web/apps/cast/src/pages/index.tsx@@ -27,10 +27,12 @@ export default function Index() {};useEffect(() => {- castReceiverLoadingIfNeeded().then((cast) =>- advertiseCode(cast, () => pairingCode),- );- }, []);+ if (pairingCode) {+ castReceiverLoadingIfNeeded().then((cast) =>+ advertiseCode(cast, () => pairingCode),+ );+ }+ }, [pairingCode]);useEffect(() => {if (!publicKeyB64 || !privateKeyB64 || !pairingCode) return;@@ -54,8 +56,8 @@ export default function Index() {} catch (e) {log.error("Failed to get cast data", e);// Start again from the beginning.- setPairingCode(undefined);- init();+ // setPairingCode(undefined);+ // init();}};diff --git a/web/apps/cast/src/services/pair.ts b/web/apps/cast/src/services/pair.tsindex 66f9feddd1..987dfd5c91 100644--- a/web/apps/cast/src/services/pair.ts+++ b/web/apps/cast/src/services/pair.ts@@ -116,8 +116,9 @@ export const advertiseCode = (const namespace = "urn:x-cast:pair-request";const options = new cast.framework.CastReceiverOptions();+ options.skipPlayersLoad = true;// Do not automatically close the connection when the sender disconnects.- options.maxInactivity = 3600; /* 1 hour */+ // options.maxInactivity = 3600; /* 1 hour */// TODO:Is this required? The docs say "(The default type of a message bus// is JSON; if not provided here)."options.customNamespaces = Object.assign({});