Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(irl-placements): read the visitor location only when permission is already granted

nirholasb39346e01493
diff --git a/src/dashboard-next/pages/irl-placements.js b/src/dashboard-next/pages/irl-placements.js
index b167c4eba..dc143c626 100644
--- a/src/dashboard-next/pages/irl-placements.js
+++ b/src/dashboard-next/pages/irl-placements.js
@@ -453,11 +453,28 @@ const STYLE = `
</style>`;
let userPos = null;
-navigator.geolocation?.getCurrentPosition(
- (p) => { userPos = { lat: p.coords.latitude, lng: p.coords.longitude }; },
- () => {},
- { timeout: 5000 },
-);
+
+// The "N km away" line on a placement card is a passive nicety, so reading the
+// browser's location must never be the thing that pops a permission prompt the
+// moment the page opens: the explicit "use my location" buttons further down are
+// where a visitor asks for that. So read silently only when permission is
+// already granted. Where the Permissions API is unavailable there is no way to
+// ask without prompting, so stay quiet and let the buttons do it.
+async function readAlreadyGrantedPosition() {
+ if (!navigator.geolocation || !navigator.permissions?.query) return;
+ try {
+ const status = await navigator.permissions.query({ name: 'geolocation' });
+ if (status.state !== 'granted') return;
+ } catch {
+ return; // engine does not expose geolocation permission state
+ }
+ navigator.geolocation.getCurrentPosition(
+ (p) => { userPos = { lat: p.coords.latitude, lng: p.coords.longitude }; },
+ () => {},
+ { timeout: 5000 },
+ );
+}
+readAlreadyGrantedPosition();
function metaLine(pin, geo) {
const loc = geo || `${Number(pin.lat).toFixed(5)}°, ${Number(pin.lng).toFixed(5)}°`;
diff --git a/vercel.json b/vercel.json
index a0f765eb7..1e95b9665 100644
--- a/vercel.json
+++ b/vercel.json
@@ -216,6 +216,13 @@
},
"continue": true
},
+ {
+ "src": "/dashboard/irl-placements/?$",
+ "headers": {
+ "permissions-policy": "accelerometer=(), autoplay=(self), camera=(), display-capture=(), encrypted-media=(self), geolocation=(self), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(self), serial=(), usb=(), xr-spatial-tracking=(self)"
+ },
+ "continue": true
+ },
{
"src": "/(login|register|forgot-password|reset-password|account|settings|wallet|pay|paywall|vanity-wallet|eth-vanity|evm-wallet|dashboard|dashboard-next|dashboard-classic)(/.*)?$",
"headers": {