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.

refactor: remove deprecated LobeHub API files and consolidate functionality into a single endpoint

nirholas129b483cf621
diff --git a/api/lobehub/[action].js b/api/lobehub/[action].js
new file mode 100644
index 000000000..dc0373af8
--- /dev/null
+++ b/api/lobehub/[action].js
@@ -0,0 +1,87 @@
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { sql } from '../_lib/db.js';
+import { cors, error, json, method, readJson, wrap } from '../_lib/http.js';
+import { clientIp, limits } from '../_lib/rate-limit.js';
+
+let pluginManifest;
+try {
+ pluginManifest = JSON.parse(
+ readFileSync(join(process.cwd(), 'public/lobehub/plugin.json'), 'utf8'),
+ );
+} catch (err) {
+ console.error('[lobehub/manifest] failed to load plugin.json', err);
+}
+
+let configManifest;
+try {
+ configManifest = JSON.parse(
+ readFileSync(join(process.cwd(), 'public/.well-known/lobehub-plugin.json'), 'utf8'),
+ );
+} catch (err) {
+ console.error('[lobehub/config] failed to load lobehub-plugin.json', err);
+}
+
+export default wrap(async (req, res) => {
+ const action = req.query?.action;
+
+ if (action === 'manifest') {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+ if (!pluginManifest) return error(res, 500, 'internal_error', 'manifest unavailable');
+ return json(res, 200, pluginManifest, { 'cache-control': 'public, max-age=300' });
+ }
+
+ if (action === 'config') {
+ res.setHeader('access-control-allow-origin', '*');
+ res.setHeader('access-control-allow-methods', 'GET,OPTIONS');
+ if (req.method === 'OPTIONS') {
+ res.statusCode = 204;
+ res.end();
+ return;
+ }
+ if (!method(req, res, ['GET'])) return;
+ if (!configManifest) return error(res, 500, 'internal_error', 'manifest unavailable');
+ return json(res, 200, configManifest, { 'cache-control': 'public, max-age=300' });
+ }
+
+ if (action === 'handshake') {
+ if (cors(req, res, { methods: 'POST,OPTIONS' })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const rl = await limits.widgetRead(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const body = await readJson(req);
+ const agentId = body?.agentId;
+ const hostOrigin = body?.hostOrigin || null;
+
+ if (!agentId || typeof agentId !== 'string') {
+ return error(res, 400, 'validation_error', 'agentId is required');
+ }
+
+ const [agent] = await sql`
+ SELECT id, name FROM agent_identities
+ WHERE id = ${agentId} AND deleted_at IS NULL
+ `;
+
+ if (!agent) return error(res, 404, 'not_found', 'agent not found');
+
+ const allowedHosts = ['chat.lobehub.com', 'lobechat.ai'];
+ if (hostOrigin) {
+ try {
+ allowedHosts.push(new URL(hostOrigin).hostname);
+ } catch {}
+ }
+
+ return json(res, 200, {
+ ok: true,
+ iframeUrl: `https://three.ws/lobehub/iframe/?agent=${encodeURIComponent(agent.id)}`,
+ embedPolicy: {
+ origins: { mode: 'allowlist', hosts: allowedHosts },
+ },
+ });
+ }
+
+ return error(res, 404, 'not_found', 'unknown lobehub action');
+});
diff --git a/api/lobehub/config.js b/api/lobehub/config.js
deleted file mode 100644
index be5d165f3..000000000
--- a/api/lobehub/config.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { readFileSync } from 'node:fs';
-import { join } from 'node:path';
-import { json, error, method, wrap } from '../_lib/http.js';
-
-let manifest;
-try {
- manifest = JSON.parse(
- readFileSync(join(process.cwd(), 'public/.well-known/lobehub-plugin.json'), 'utf8'),
- );
-} catch (err) {
- console.error('[lobehub/config] failed to load lobehub-plugin.json', err);
-}
-
-export default wrap(async (req, res) => {
- // CORS open so LobeHub marketplace fetcher can read this without credentials.
- res.setHeader('access-control-allow-origin', '*');
- res.setHeader('access-control-allow-methods', 'GET,OPTIONS');
- if (req.method === 'OPTIONS') {
- res.statusCode = 204;
- res.end();
- return;
- }
- if (!method(req, res, ['GET'])) return;
- if (!manifest) return error(res, 500, 'internal_error', 'manifest unavailable');
- return json(res, 200, manifest, { 'cache-control': 'public, max-age=300' });
-});
diff --git a/api/lobehub/handshake.js b/api/lobehub/handshake.js
deleted file mode 100644
index 05df978f9..000000000
--- a/api/lobehub/handshake.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import { sql } from '../_lib/db.js';
-import { json, error, method, readJson, wrap, cors } from '../_lib/http.js';
-import { limits, clientIp } from '../_lib/rate-limit.js';
-
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'POST,OPTIONS' })) return;
- if (!method(req, res, ['POST'])) return;
-
- // Use widgetRead as the closest public-read preset (600 req/min per IP).
- const rl = await limits.widgetRead(clientIp(req));
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const body = await readJson(req);
- const agentId = body?.agentId;
- const hostOrigin = body?.hostOrigin || null;
-
- if (!agentId || typeof agentId !== 'string') {
- return error(res, 400, 'validation_error', 'agentId is required');
- }
-
- const [agent] = await sql`
- SELECT id, name FROM agent_identities
- WHERE id = ${agentId} AND deleted_at IS NULL
- `;
-
- if (!agent) return error(res, 404, 'not_found', 'agent not found');
-
- // Build allowlist: known LobeHub hosts + caller's host if provided.
- const allowedHosts = ['chat.lobehub.com', 'lobechat.ai'];
- if (hostOrigin) {
- try {
- allowedHosts.push(new URL(hostOrigin).hostname);
- } catch {}
- }
-
- return json(res, 200, {
- ok: true,
- iframeUrl: `https://three.ws/lobehub/iframe/?agent=${encodeURIComponent(agent.id)}`,
- embedPolicy: {
- origins: { mode: 'allowlist', hosts: allowedHosts },
- },
- });
-});
diff --git a/api/lobehub/manifest.js b/api/lobehub/manifest.js
deleted file mode 100644
index ec059c85d..000000000
--- a/api/lobehub/manifest.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { readFileSync } from 'node:fs';
-import { join } from 'node:path';
-import { json, error, method, wrap, cors } from '../_lib/http.js';
-
-let manifest;
-try {
- manifest = JSON.parse(readFileSync(join(process.cwd(), 'public/lobehub/plugin.json'), 'utf8'));
-} catch (err) {
- console.error('[lobehub/manifest] failed to load plugin.json', err);
-}
-
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
- if (!manifest) return error(res, 500, 'internal_error', 'manifest unavailable');
- return json(res, 200, manifest, { 'cache-control': 'public, max-age=300' });
-});
diff --git a/app.html b/app.html
index 7c5c0460b..6df052592 100644
--- a/app.html
+++ b/app.html
@@ -58,10 +58,12 @@
<body>
<header>
<h1>
- <a href="/"><img src="/three.svg" class="header-logo" alt="" aria-hidden="true" />three.ws</a>
+ <a href="/" aria-label="three.ws home"
+ ><img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span>three.ws</a
+ >
</h1>
- <nav class="features-nav">
- <a href="/app" class="active">Viewer</a>
+ <nav class="features-nav" aria-label="Primary">
+ <a href="/app" id="nav-viewer-link">Viewer</a>
<a href="/create">Create</a>
<a href="/features">Features</a>
<a href="/discover">Discover</a>
diff --git a/footer.css b/footer.css
index 2478d9d1f..8f2255724 100644
--- a/footer.css
+++ b/footer.css
@@ -3,6 +3,7 @@
.h-footer-horizon {
position: relative;
+ flex-shrink: 0;
overflow: hidden;
min-height: 360px;
padding: 4rem 2rem 2rem;
diff --git a/index.html b/index.html
index df6657369..b8cc9a3dd 100644
--- a/index.html
+++ b/index.html
@@ -779,7 +779,6 @@
<a href="/my-agents" id="nav-my-agents" hidden>My Agents</a>
<a href="/dashboard" id="nav-user" hidden class="nav-user"></a>
<a href="/login" class="nav-sign-in" id="nav-sign-in">Sign in</a>
- <button id="btn-wallet-signin" style="cursor: pointer">Sign in with wallet</button>
</nav>
</header>
@@ -1627,11 +1626,5 @@
});
})();
</script>
- <script type="module">
- import { wireSigninButton } from '/src/wallet-auth.js';
- const btn = document.getElementById('btn-wallet-signin');
- if (btn) wireSigninButton(btn);
- </script>
-
</body>
</html>
diff --git a/style.css b/style.css
index c9d913d93..8d34348d7 100644
--- a/style.css
+++ b/style.css
@@ -186,6 +186,7 @@ body {
header {
display: flex;
+ flex-shrink: 0;
background: rgba(0, 0, 0, 0.8);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
@@ -1297,6 +1298,19 @@ body[data-viewer-mode='explore'] {
overflow-y: auto;
}
+/* Hide viewer-only action buttons in non-viewer modes — they're meaningless on
+ * /deploy and /explore where the viewer is hidden. */
+body[data-viewer-mode='deploy'] .save-to-account-btn,
+body[data-viewer-mode='deploy'] .make-widget-btn,
+body[data-viewer-mode='deploy'] .deploy-onchain-btn,
+body[data-viewer-mode='deploy'] .view-public-profile-btn,
+body[data-viewer-mode='explore'] .save-to-account-btn,
+body[data-viewer-mode='explore'] .make-widget-btn,
+body[data-viewer-mode='explore'] .deploy-onchain-btn,
+body[data-viewer-mode='explore'] .view-public-profile-btn {
+ display: none !important;
+}
+
body[data-viewer-mode='deploy'] {
background: #000;
color: #fff;