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.

m

nirholas43a2db8ef7b4
diff --git a/api/auth/siwe/verify.js b/api/auth/siwe/verify.js
index f35b56434..b99599c1f 100644
--- a/api/auth/siwe/verify.js
+++ b/api/auth/siwe/verify.js
@@ -31,14 +31,19 @@ export default wrap(async (req, res) => {
// 2. Domain + URI must match this deployment. Prevents signature replay from
// a phishing site using a valid nonce issued here.
+ // VERCEL_URL is the deployment-specific hostname Vercel injects automatically
+ // (e.g. "3dagent-git-main-moomsi.vercel.app") — allows preview deployments.
const appOrigin = env.APP_ORIGIN;
const appHost = new URL(appOrigin).host;
- if (fields.domain !== appHost) {
+ const vercelHost = process.env.VERCEL_URL || null;
+ const allowedHosts = new Set([appHost, vercelHost].filter(Boolean));
+ if (!allowedHosts.has(fields.domain)) {
return error(res, 400, 'invalid_domain', `domain must be ${appHost}`);
}
try {
const u = new URL(fields.uri);
- if (u.origin !== appOrigin) return error(res, 400, 'invalid_uri', 'uri origin mismatch');
+ const allowedOrigins = new Set([appOrigin, vercelHost ? `https://${vercelHost}` : null].filter(Boolean));
+ if (!allowedOrigins.has(u.origin)) return error(res, 400, 'invalid_uri', 'uri origin mismatch');
} catch {
return error(res, 400, 'invalid_uri', 'uri not a valid URL');
}
diff --git a/public/dashboard/dashboard.js b/public/dashboard/dashboard.js
index 97433b165..104f97500 100644
--- a/public/dashboard/dashboard.js
+++ b/public/dashboard/dashboard.js
@@ -1,8 +1,6 @@
// Dashboard single-file app. Uses native DOM — no framework.
// Keeps bundle small and ensures anything rendering <model-viewer> works without bundler.
-import { AvatarCreator } from '../../src/avatar-creator.js';
-
export const state = { user: null };
export const api = {
diff --git a/src/app.js b/src/app.js
index 375c898a3..fb0120d97 100644
--- a/src/app.js
+++ b/src/app.js
@@ -408,9 +408,10 @@ class App {
else if (deploy) mode = 'deploy';
document.body.dataset.viewerMode = mode;
if (mode === 'main') {
- // Optimistic paint from the last-known auth hint; corrected by
- // _updateSignInLink once /api/auth/me resolves.
- document.body.dataset.authed = readAuthHint() ?? 'pending';
+ // Use 'false' hint immediately to skip auth-gate flash for known-logged-out users.
+ // Never use 'true' hint optimistically — a stale hint would show then snap-hide the
+ // sidebar once /api/auth/me confirms the session expired.
+ document.body.dataset.authed = readAuthHint() === 'false' ? 'false' : 'pending';
}
}