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(discover): route third-party hero art through the image proxy so a dead or ORB-blocked host shows a placeholder instead of a console error

nirholas2937fef1e7ab
diff --git a/public/discover/detail.js b/public/discover/detail.js
index 47aa88702..a8662eb1b 100644
--- a/public/discover/detail.js
+++ b/public/discover/detail.js
@@ -14,6 +14,25 @@ function parseRoute() {
return null;
}
+// Agent art is whatever URL the registering party published: an IPFS URI, a
+// gateway that may be rate-limiting, or a host that answers 404 with JSON (which
+// the browser blocks as an opaque response). Cross-origin and decentralized art
+// goes through the same-origin image proxy, which races live IPFS gateways and
+// answers 204 when nothing renderable exists.
+function heroImageURL(src) {
+ if (typeof src !== 'string' || !src) return '';
+ if (/^(ipfs|ar):\/\//i.test(src)) return `/api/img?${new URLSearchParams({ url: src, w: '640', fallback: 'none' })}`;
+ let url;
+ try {
+ url = new URL(src, location.href);
+ } catch {
+ return '';
+ }
+ if (url.origin === location.origin) return url.href;
+ if (url.protocol !== 'https:' && url.protocol !== 'http:') return '';
+ return `/api/img?${new URLSearchParams({ url: url.href, w: '640', fallback: 'none' })}`;
+}
+
async function fetchItem(route) {
// SSR handler may have pre-loaded the item to avoid a round-trip
if (window.__DETAIL_ITEM__) return window.__DETAIL_ITEM__;
@@ -77,16 +96,23 @@ function render(item) {
// Hero media
const media = $('hero-media');
- if (item.image) {
+ const placeholder = () => {
+ const ph = document.createElement('div');
+ ph.className = 'detail-hero-ph';
+ ph.textContent = item.has3d ? '🎭' : '🤖';
+ return ph;
+ };
+ const heroSrc = heroImageURL(item.image);
+ if (heroSrc) {
const img = document.createElement('img');
- img.src = item.image;
img.alt = item.name;
+ // A dead or non-image source (204 from the proxy) swaps in the placeholder
+ // instead of leaving a broken-image icon in the hero.
+ img.addEventListener('error', () => img.replaceWith(placeholder()), { once: true });
+ img.src = heroSrc;
media.appendChild(img);
} else {
- const ph = document.createElement('div');
- ph.className = 'detail-hero-ph';
- ph.textContent = item.has3d ? '🎭' : '🤖';
- media.appendChild(ph);
+ media.appendChild(placeholder());
}
const badges = $('badges');