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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix: normalize PUBLIC_APP_ORIGIN so wallet sign-in survives misconfig
nirholas009cb82ba1b6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 628a735b1..f7c4acc5d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Every IRL moment now has a designed, honest state** — IRL asks for the three most sensitive permissions a web app can — camera, motion, and location — and we made every moment around them feel deliberate instead of uncertain. While your phone is still finding your GPS fix, the top bar shows a clear "Finding your location…" shimmer so the wait never looks like an empty, nobody-here screen. If discovery ever has to slow down to catch its breath, you get a calm "catching up…" note that quietly recovers on its own — never a scary error. The live-presence indicator stays honest too: when it drops, nearby discovery keeps working and nothing implies otherwise. Every control is now reachable by keyboard with a visible focus ring, screen readers announce each state change once, and all of it respects reduced-motion settings. (`/irl`) `[improvement]`- **Every page now shares with its own social card** — Share any three.ws page on X, Discord, Slack, iMessage, or LinkedIn and the link now previews with a branded card built for that exact page — its title, its one-line description, and a colour that matches the section it belongs to — instead of one generic image for the whole site. The cards render as real PNGs so they show up everywhere (not just the apps that handle SVG), and they're generated on the fly from the same page catalog that feeds the sitemap, so the preview always matches what's actually on the page. We also tightened the behind-the-scenes SEO on every page: cleaner canonical links, richer structured data with breadcrumbs, and crawler hints that let search engines show large image previews. `[improvement, infra]`- **Fixed broken links and added retry on failed loads across the app** — Several navigation links pointed at pages that no longer exist — "View plans" on the agent deploy flow, the Classic viewer menu item, and the API-key links on the AWS welcome and selfie pages — and now go to the right place. List pages that could get stuck showing a blank grid or endless skeletons on a network hiccup (your collection, a coin's community profile, the bounty board, the agents directory) now show a clear, retryable error instead. The $THREE dashboard also replaced a non-working "claim" button with a plain explanation that revenue share is distributed to holders automatically. `[fix, improvement]`+- **Fixed wallet sign-in returning an error** — Signing in with a Solana or Ethereum wallet was failing for everyone — the request that starts the sign-in handshake was erroring out before you could approve anything in your wallet. A misread site address on the server was the cause; it now self-corrects, and wallet sign-in works again. `[fix]`- **Flappin UFO — a $THREE arcade demo is live** — A playable demo just landed at /play/ufo — a Flappy Bird-style space game where you pilot a UFO through asteroid fields. Connect your Solana wallet, copy your address as your in-game name, and submit your score to the global leaderboard, which refreshes live every 15 seconds and highlights your entry. Consider it a taste: these arcade demos are warm-ups while we build something far bigger for $THREE. (`/play/ufo`) `[feature]`- **Freeze your agent wallet in one tap — plus hardened custody security** — Your agent's wallet now has a freeze switch. Open the wallet's Limits & Safety panel and tap Freeze to instantly pause every kind of automatic spending — trades, snipes and payments all stop at once — while you stay free to withdraw your funds out at any time; a freeze locks down the agent without ever trapping your money. Withdrawals also got safer: before you confirm, you'll see a clear reminder that crypto transfers are final, and if you've set a withdraw allowlist the screen now tells you whether the address you're sending to is on it. Under the hood we tightened wallet security across the board — every money-moving request is now protected against cross-site request forgery, the keys that sign for your wallet are encrypted at rest with a dedicated key separated from the login system, and a class of launch keys that were previously stored in plain text are now encrypted too. `[feature, security]`- **Fund any agent wallet by scanning a QR or copying the address — with live confirmation** — The agent wallet's Deposit tab is now a complete, public funding panel: a crisp QR code (generated on-device, no third-party service) that your phone wallet can scan, a one-tap copyable Solana address, an optional preset amount, and a Solana deep-link that opens Phantom, Solflare or Backpack on mobile. The panel watches the agent's real on-chain balance and confirms the moment your SOL lands — "◎0.5 SOL received" — instead of leaving you guessing. Anyone can fund an agent, not just its owner, and the new "Fund agent wallet" button on the create-agent success screen leads new users straight into it. `[feature]`@@ -53,6 +54,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Token Oracle follow / unfollow is working again** — Subscribing an agent to a token's oracle alerts — and unsubscribing — was silently failing for everyone; only the status check worked. Both now go through correctly, so you can opt an agent into (and out of) score-based alerts as intended. `[fix]`- **Unity & Unreal avatar loading documented with code that actually works** — The developer hub's Unity and Unreal cards used to show sample code for an SDK that doesn't exist yet. They now show the real, working way to load a three.ws avatar today — your avatar's GLB endpoint loaded at runtime with glTFast (Unity) or glTFRuntime (Unreal), both standard glTF importers — alongside an honest note that a native package is still on the roadmap. (`/dashboard/developers`) `[docs, improvement]`- **Vanity wallets for every agent — opt-in, owned per user** — Every agent and avatar has its own custodial Solana wallet, and you own it per creation: make an avatar and its agent wallet is yours; if someone forks or saves that avatar, they get a brand-new wallet they alone control — yours is never shared or copied. A new Vanity tab in the agent wallet hub lets you grind a custom address (your own prefix and/or suffix) on demand. If the wallet already holds funds, they're automatically and safely swept to the new address before the switch completes, so funds are never stranded. The wallet now appears everywhere an agent or avatar shows up — profiles, avatar pages, your Agents and Avatars dashboards, the Characters feed and Trending — each with one-tap copy, an explorer link, and a vanity badge. (`/vanity-wallet`) `[feature]`+- **Walk the whole page — the site is now a platformer** — The corner walking companion can now step out of its spot. Click it and the character detaches and drops onto the page itself: headings, cards, buttons and images become solid ground you can walk and jump across with the arrow keys or WASD (on-screen buttons on phones). Stand on any link and it lights up like a trapdoor — pause on it, or press down, and the character dives through and you fall into the next page, landing back in from the top when it loads. It loads nothing extra until you click in, so normal browsing pays no cost. Jump straight in from any page with ?walk=play. `[feature]`## 2026-06-18diff --git a/api/_lib/env.js b/api/_lib/env.jsindex 0c79ba6ad..f1ac6b752 100644--- a/api/_lib/env.js+++ b/api/_lib/env.js@@ -16,6 +16,28 @@ function trimSlash(s) {return s ? s.replace(/\/$/, '') : s;}+// Canonical fallback origin — used when PUBLIC_APP_ORIGIN is unset, empty, or+// not a parseable absolute URL.+const DEFAULT_APP_ORIGIN = 'https://three.ws';++// Coerce PUBLIC_APP_ORIGIN into a valid absolute origin. A bare host (e.g.+// PUBLIC_APP_ORIGIN=three.ws — a real Vercel misconfiguration that 500'd every+// SIWS/SIWE nonce request and emitted schemeless OIDC discovery URLs) gets an+// https:// scheme prepended, and the result is validated through the URL+// parser. Anything still unparseable falls back to the canonical origin rather+// than letting `new URL(env.APP_ORIGIN)` throw ERR_INVALID_URL deep inside a+// handler. Returns a normalized origin with no trailing slash or path.+function normalizeAppOrigin(raw) {+ let v = (raw ?? '').trim();+ if (!v) return DEFAULT_APP_ORIGIN;+ if (!/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(v)) v = `https://${v}`;+ try {+ return trimSlash(new URL(v).origin);+ } catch {+ return DEFAULT_APP_ORIGIN;+ }+}+// Platform owner wallets with standing admin access, independent of env config.// Public addresses, safe to commit. Unioned with ADMIN_ADDRESSES (see below).const BUILT_IN_ADMIN_ADDRESSES = ['9MjzHaTB6Jko4YKo9mDzJSaGnktzhbebgsnqPpYWnXC7'];@@ -31,7 +53,7 @@ function pem(name) {export const env = {get APP_ORIGIN() {- return trimSlash(opt('PUBLIC_APP_ORIGIN', 'https://three.ws/'));+ return normalizeAppOrigin(opt('PUBLIC_APP_ORIGIN'));},// Runtime environment signals. NODE_ENV is set to 'production' by Vercel'sdiff --git a/data/changelog.json b/data/changelog.jsonindex 97969ffa6..9884ec076 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,22 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-19",+ "title": "Fixed wallet sign-in returning an error",+ "summary": "Signing in with a Solana or Ethereum wallet was failing for everyone — the request that starts the sign-in handshake was erroring out before you could approve anything in your wallet. A misread site address on the server was the cause; it now self-corrects, and wallet sign-in works again.",+ "tags": [+ "fix"+ ]+ },+ {+ "date": "2026-06-19",+ "title": "Walk the whole page — the site is now a platformer",+ "summary": "The corner walking companion can now step out of its spot. Click it and the character detaches and drops onto the page itself: headings, cards, buttons and images become solid ground you can walk and jump across with the arrow keys or WASD (on-screen buttons on phones). Stand on any link and it lights up like a trapdoor — pause on it, or press down, and the character dives through and you fall into the next page, landing back in from the top when it loads. It loads nothing extra until you click in, so normal browsing pays no cost. Jump straight in from any page with ?walk=play.",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-19","title": "Pole Club music opens up as you walk inside",diff --git a/public/changelog.json b/public/changelog.jsonindex afe95260d..8b8720167 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-19T15:25:52.116Z",+ "generated_at": "2026-06-19T16:46:11.556Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -169,6 +169,16 @@"improvement"]},+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Fixed wallet sign-in returning an error",+ "summary": "Signing in with a Solana or Ethereum wallet was failing for everyone — the request that starts the sign-in handshake was erroring out before you could approve anything in your wallet. A misread site address on the server was the cause; it now self-corrects, and wallet sign-in works again.",+ "link": null,+ "tags": [+ "fix"+ ]+ },{"date": "2026-06-19","type": "update",@@ -488,6 +498,16 @@"feature"]},+ {+ "date": "2026-06-19",+ "type": "update",+ "title": "Walk the whole page — the site is now a platformer",+ "summary": "The corner walking companion can now step out of its spot. Click it and the character detaches and drops onto the page itself: headings, cards, buttons and images become solid ground you can walk and jump across with the arrow keys or WASD (on-screen buttons on phones). Stand on any link and it lights up like a trapdoor — pause on it, or press down, and the character dives through and you fall into the next page, landing back in from the top when it loads. It loads nothing extra until you click in, so normal browsing pays no cost. Jump straight in from any page with ?walk=play.",+ "link": null,+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-18","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 7cb9d066e..f2aaf8978 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -134,6 +134,14 @@<category>fix</category><description>Several navigation links pointed at pages that no longer exist — "View plans" on the agent deploy flow, the Classic viewer menu item, and the API-key links on the AWS welcome and selfie pages — and now go to the right place. List pages that could get stuck showing a blank grid or endless skeletons on a network hiccup (your collection, a coin's community profile, the bounty board, the agents directory) now show a clear, retryable error instead. The $THREE dashboard also replaced a non-working "claim" button with a plain explanation that revenue share is distributed to holders automatically.</description></item>+ <item>+ <title>Fixed wallet sign-in returning an error</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-19:Fixed wallet sign-in returning an error</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Signing in with a Solana or Ethereum wallet was failing for everyone — the request that starts the sign-in handshake was erroring out before you could approve anything in your wallet. A misread site address on the server was the cause; it now self-corrects, and wallet sign-in works again.</description>+ </item><item><title>Flappin UFO — a $THREE arcade demo is live</title><link>https://three.ws/play/ufo</link>@@ -382,6 +390,14 @@<category>feature</category><description>Every agent and avatar has its own custodial Solana wallet, and you own it per creation: make an avatar and its agent wallet is yours; if someone forks or saves that avatar, they get a brand-new wallet they alone control — yours is never shared or copied. A new Vanity tab in the agent wallet hub lets you grind a custom address (your own prefix and/or suffix) on demand. If the wallet already holds funds, they're automatically and safely swept to the new address before the switch completes, so funds are never stranded. The wallet now appears everywhere an agent or avatar shows up — profiles, avatar pages, your Agents and Avatars dashboards, the Characters feed and Trending — each with one-tap copy, an explorer link, and a vanity badge.</description></item>+ <item>+ <title>Walk the whole page — the site is now a platformer</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-19:Walk the whole page — the site is now a platformer</guid>+ <pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The corner walking companion can now step out of its spot. Click it and the character detaches and drops onto the page itself: headings, cards, buttons and images become solid ground you can walk and jump across with the arrow keys or WASD (on-screen buttons on phones). Stand on any link and it lights up like a trapdoor — pause on it, or press down, and the character dives through and you fall into the next page, landing back in from the top when it loads. It loads nothing extra until you click in, so normal browsing pays no cost. Jump straight in from any page with ?walk=play.</description>+ </item><item><title>Agent economy demos now show honest run status</title><link>https://three.ws/live</link>diff --git a/public/features.json b/public/features.jsonindex 481c5140c..49a96ad67 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-19T15:25:52.098Z",+ "generated_at": "2026-06-19T16:46:11.541Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/api/env-app-origin.test.js b/tests/api/env-app-origin.test.jsnew file mode 100644index 000000000..e2cc876f3--- /dev/null+++ b/tests/api/env-app-origin.test.js@@ -0,0 +1,56 @@+// Regression guard for env.APP_ORIGIN normalization.+//+// Production once had PUBLIC_APP_ORIGIN set to a bare host ("three.ws", no+// scheme). The old getter returned it verbatim, so every handler that ran+// `new URL(env.APP_ORIGIN)` — SIWS/SIWE nonce, OIDC discovery, did:web — threw+// ERR_INVALID_URL and 500'd. env.APP_ORIGIN must always resolve to a valid+// absolute origin no matter how the env var is (mis)configured.++import { describe, it, expect, afterEach } from 'vitest';+import { env } from '../../api/_lib/env.js';++const original = process.env.PUBLIC_APP_ORIGIN;++afterEach(() => {+ if (original === undefined) delete process.env.PUBLIC_APP_ORIGIN;+ else process.env.PUBLIC_APP_ORIGIN = original;+});++function set(v) {+ if (v === undefined) delete process.env.PUBLIC_APP_ORIGIN;+ else process.env.PUBLIC_APP_ORIGIN = v;+}++describe('env.APP_ORIGIN', () => {+ it('always returns a parseable absolute origin', () => {+ for (const v of ['three.ws', '', undefined, 'https://three.ws/', 'https://three.ws', 'app.test:8080']) {+ set(v);+ expect(() => new URL(env.APP_ORIGIN)).not.toThrow();+ }+ });++ it('prepends https:// to a bare host (the production misconfiguration)', () => {+ set('three.ws');+ expect(env.APP_ORIGIN).toBe('https://three.ws');+ expect(new URL(env.APP_ORIGIN).host).toBe('three.ws');+ });++ it('falls back to the canonical origin when unset or empty', () => {+ set(undefined);+ expect(env.APP_ORIGIN).toBe('https://three.ws');+ set('');+ expect(env.APP_ORIGIN).toBe('https://three.ws');+ });++ it('strips a trailing slash and any path, keeping the origin', () => {+ set('https://three.ws/');+ expect(env.APP_ORIGIN).toBe('https://three.ws');+ set('https://three.ws/app/');+ expect(env.APP_ORIGIN).toBe('https://three.ws');+ });++ it('preserves a valid non-default origin (preview deploys)', () => {+ set('https://my-deploy-abc.vercel.app');+ expect(env.APP_ORIGIN).toBe('https://my-deploy-abc.vercel.app');+ });+});