Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix lints

Manav Rathiface4bb55b37
diff --git a/web/apps/cast/src/components/FilledCircleCheck.tsx b/web/apps/cast/src/components/FilledCircleCheck.tsx
index ba2292922e..86d1b41a0a 100644
--- a/web/apps/cast/src/components/FilledCircleCheck.tsx
+++ b/web/apps/cast/src/components/FilledCircleCheck.tsx
@@ -1,4 +1,5 @@
import { styled } from "@mui/material";
+import React from "react";
export const FilledCircleCheck: React.FC = () => {
return (
diff --git a/web/apps/cast/src/components/PairingCode.tsx b/web/apps/cast/src/components/PairingCode.tsx
index fa1474bafc..89f91fab8a 100644
--- a/web/apps/cast/src/components/PairingCode.tsx
+++ b/web/apps/cast/src/components/PairingCode.tsx
@@ -1,4 +1,5 @@
import { styled } from "@mui/material";
+import React from "react";
const colors = [
"#87CEFA", // Light Blue
diff --git a/web/apps/cast/src/pages/index.tsx b/web/apps/cast/src/pages/index.tsx
index ed10d14ae2..f48a21b6ce 100644
--- a/web/apps/cast/src/pages/index.tsx
+++ b/web/apps/cast/src/pages/index.tsx
@@ -33,32 +33,32 @@ export default function Index() {
useEffect(() => {
if (!publicKeyB64 || !privateKeyB64 || !pairingCode) return;
- const interval = setInterval(pollTick, 2000);
- return () => clearInterval(interval);
- }, [publicKeyB64, privateKeyB64, pairingCode]);
-
- const pollTick = async () => {
- if (!publicKeyB64 || !privateKeyB64 || !pairingCode) return;
+ const pollTick = async () => {
+ const registration = { publicKeyB64, privateKeyB64, pairingCode };
+ try {
+ // TODO:
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const data = await getCastData(registration);
+ if (!data) {
+ // No one has connected yet.
+ return;
+ }
- const registration = { publicKeyB64, privateKeyB64, pairingCode };
- try {
- const data = await getCastData(registration);
- if (!data) {
- // No one has connected yet.
- return;
+ storeCastData(data);
+ await router.push("/slideshow");
+ } catch (e) {
+ // The pairing code becomes invalid after an hour, which will cause
+ // `getCastData` to fail. There might be other reasons this might
+ // fail too, but in all such cases, it is a reasonable idea to start
+ // again from the beginning.
+ log.warn("Failed to get cast data", e);
+ setPairingCode(undefined);
}
+ };
- storeCastData(data);
- await router.push("/slideshow");
- } catch (e) {
- // The pairing code becomes invalid after an hour, which will cause
- // `getCastData` to fail. There might be other reasons this might
- // fail too, but in all such cases, it is a reasonable idea to start
- // again from the beginning.
- log.warn("Failed to get cast data", e);
- setPairingCode(undefined);
- }
- };
+ const interval = setInterval(() => pollTick, 2000);
+ return () => clearInterval(interval);
+ }, [publicKeyB64, privateKeyB64, pairingCode, router]);
return (
<Container>
diff --git a/web/apps/cast/src/services/pair.ts b/web/apps/cast/src/services/pair.ts
index bc50f19b59..1c0124595b 100644
--- a/web/apps/cast/src/services/pair.ts
+++ b/web/apps/cast/src/services/pair.ts
@@ -82,10 +82,11 @@ export const register = async (): Promise<Registration> => {
// Register keypair with museum to get a pairing code.
let pairingCode: string | undefined;
- // eslint has fixed this spurious warning, but we're not on the latest
+ // TODO: eslint has fixed this spurious warning, but we're not on the latest
// version yet, so add a disable.
// https://github.com/eslint/eslint/pull/18286
/* eslint-disable no-constant-condition */
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
while (true) {
try {
pairingCode = await castGateway.registerDevice(publicKeyB64);
@@ -126,5 +127,7 @@ export const getCastData = async (registration: Registration) => {
privateKeyB64,
);
+ // TODO:
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse(atob(decryptedCastData));
};