π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add Stadia Maps proxy Cloudflare Worker
anandbaburajan51c762793349
diff --git a/infra/workers/stadia-maps-proxy/package.json b/infra/workers/stadia-maps-proxy/package.jsonnew file mode 100644index 0000000000..269f2d85c6--- /dev/null+++ b/infra/workers/stadia-maps-proxy/package.json@@ -0,0 +1,5 @@+{+ "name": "stadia-maps-proxy",+ "version": "0.0.0",+ "private": true+}\ No newline at end of filediff --git a/infra/workers/stadia-maps-proxy/src/index.ts b/infra/workers/stadia-maps-proxy/src/index.tsnew file mode 100644index 0000000000..9a73bee5d3--- /dev/null+++ b/infra/workers/stadia-maps-proxy/src/index.ts@@ -0,0 +1,45 @@+/** Proxy requests for Stadia Maps tiles and geocoding. */++export default {+ async fetch(request, env, ctx) {+ const url = new URL(request.url);++ // Handle tiles requests+ const tileMatch = url.pathname.match(/^\/tiles\/([^\/]+)\/(\d+)\/(\d+)\/(\d+)(@2x)?\.(\w+)$/);+ if (tileMatch) {+ const [, style, z, x, y, retina, format] = tileMatch;+ const stadiaUrl = `https://tiles.stadiamaps.com/tiles/${style}/${z}/${x}/${y}${retina || ''}.${format}?api_key=${env.STADIA_API_KEY}`;++ const response = await fetch(stadiaUrl);++ return new Response(response.body, {+ status: response.status,+ headers: {+ ...Object.fromEntries(response.headers),+ 'Access-Control-Allow-Origin': '*',+ 'Cache-Control': 'public, max-age=86400',+ }+ });+ }++ // Handle geocoding requests+ const geocodingMatch = url.pathname.match(/^\/geocoding\/(.+)$/);+ if (geocodingMatch) {+ const path = geocodingMatch[1];+ const stadiaUrl = `https://api.stadiamaps.com/geocoding/${path}?${url.searchParams.toString()}&api_key=${env.STADIA_API_KEY}`;++ const response = await fetch(stadiaUrl);+ const data = await response.text();++ return new Response(data, {+ status: response.status,+ headers: {+ 'Access-Control-Allow-Origin': '*',+ 'Content-Type': 'application/json',+ }+ });+ }++ return new Response('Not found', { status: 404 });+ }+};\ No newline at end of filediff --git a/infra/workers/stadia-maps-proxy/tsconfig.json b/infra/workers/stadia-maps-proxy/tsconfig.jsonnew file mode 100644index 0000000000..858da1aa7e--- /dev/null+++ b/infra/workers/stadia-maps-proxy/tsconfig.json@@ -0,0 +1 @@+{ "extends": "../tsconfig.base.json", "include": ["src"] }\ No newline at end of filediff --git a/infra/workers/stadia-maps-proxy/wrangler.toml b/infra/workers/stadia-maps-proxy/wrangler.tomlnew file mode 100644index 0000000000..4f455b3167--- /dev/null+++ b/infra/workers/stadia-maps-proxy/wrangler.toml@@ -0,0 +1,15 @@+name = "stadia-maps-proxy"+main = "src/index.ts"+compatibility_date = "2025-06-03"++routes = [+ { pattern = "stadia-maps-proxy.ente.io", custom_domain = true }+]++tail_consumers = [+ { service = "tail" }+]++[vars]+# Added as a secret via the Cloudflare dashboard+# STADIA_API_KEY = ""\ No newline at end of file