π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add a check for an upcoming restriction
Manav Rathi25d6ebdb192d
diff --git a/infra/workers/cast-albums/src/index.ts b/infra/workers/cast-albums/src/index.tsindex f2cef97307..6aebfca459 100644--- a/infra/workers/cast-albums/src/index.ts+++ b/infra/workers/cast-albums/src/index.ts@@ -4,7 +4,7 @@ export default {async fetch(request: Request) {switch (request.method) {case "OPTIONS":- return handleOPTIONS();+ return handleOPTIONS(request);case "GET":return handleGET(request);default:@@ -13,7 +13,9 @@ export default {},} satisfies ExportedHandler;-const handleOPTIONS = () => {+const handleOPTIONS = (request: Request) => {+ const origin = request.headers.get("Origin");+ if (!isAllowedOrigin(origin)) console.warn("Unknown origin", origin);return new Response("", {headers: {"Access-Control-Allow-Origin": "*",@@ -24,6 +26,19 @@ const handleOPTIONS = () => {});};+const isAllowedOrigin = (origin: string | null) => {+ if (!origin) return false;+ try {+ const url = new URL(origin);+ return ["cast.ente.io", "cast.ente.sh", "localhost"].includes(+ url.hostname+ );+ } catch {+ // origin is likely an invalid URL+ return false;+ }+};+const handleGET = async (request: Request) => {const url = new URL(request.url);const castToken =