π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Also handle arbitrary validation errors
Manav Rathi6cf942ec9e65
diff --git a/web/packages/new/photos/components/DevSettings.tsx b/web/packages/new/photos/components/DevSettings.tsxindex a5f0ab6d85..878cc084af 100644--- a/web/packages/new/photos/components/DevSettings.tsx+++ b/web/packages/new/photos/components/DevSettings.tsx@@ -1,3 +1,4 @@+import log from "@/next/log";import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";import {Dialog,@@ -166,12 +167,16 @@ const updateAPIOrigin = async (origin: string) => {const url = `${origin}/ping`;const res = await fetch(url);if (!res.ok) throw new Error(`Failed to fetch ${url}: HTTP ${res.status}`);- const json = PingResponse.parse(await res.json());- if (json.message != "pong") throw new Error("Invalid response");+ try {+ PingResponse.parse(await res.json());+ } catch (e) {+ log.error("Invalid response", e);+ throw new Error("Invalid response");+ }localStorage.setItem("apiOrigin", origin);};const PingResponse = z.object({- message: z.string().nullish(),+ message: z.enum(["pong"]),});