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: update login redirect logic to use sessionStorage for improved user experience

nirholas486d7edfdccf
diff --git a/api/explore.js b/api/explore.js
index fd9d60594..3dcb8315e 100644
--- a/api/explore.js
+++ b/api/explore.js
@@ -140,30 +140,9 @@ export default wrap(async (req, res) => {
avatarItems.push(...matching);
}
- // Merge by date desc, but guarantee avatars surface on page 1 so the
- // onchain firehose doesn't drown them. Reserve up to a third of the page
- // for avatars when both sources are present and this is the first page.
- const onchainSorted = [...onchainItems].sort(
+ const merged = [...onchainItems, ...avatarItems].sort(
(a, b) => new Date(b.sortDate).getTime() - new Date(a.sortDate).getTime(),
);
- const avatarSorted = [...avatarItems].sort(
- (a, b) => new Date(b.sortDate).getTime() - new Date(a.sortDate).getTime(),
- );
-
- let merged;
- if (!cursorDate && onchainSorted.length && avatarSorted.length) {
- const avatarQuota = Math.min(avatarSorted.length, Math.max(1, Math.ceil(limit / 3)));
- const avatarHead = avatarSorted.slice(0, avatarQuota);
- const avatarTail = avatarSorted.slice(avatarQuota);
- const rest = [...onchainSorted, ...avatarTail].sort(
- (a, b) => new Date(b.sortDate).getTime() - new Date(a.sortDate).getTime(),
- );
- merged = [...avatarHead, ...rest];
- } else {
- merged = [...onchainSorted, ...avatarSorted].sort(
- (a, b) => new Date(b.sortDate).getTime() - new Date(a.sortDate).getTime(),
- );
- }
const hasMore = merged.length > limit;
const items = merged.slice(0, limit);
diff --git a/public/wallet-login.js b/public/wallet-login.js
index 258c3a43b..06c67baf6 100644
--- a/public/wallet-login.js
+++ b/public/wallet-login.js
@@ -5,7 +5,8 @@ import { createConnectWalletButton } from '/wallet/connect-button.js';
import { createSolanaWalletButton } from '/wallet/connect-button-solana.js';
const params = new URLSearchParams(location.search);
-const next = params.get('next') || '/dashboard/';
+const next = params.get('next') || sessionStorage.getItem('login_redirect') || '/dashboard/';
+sessionStorage.removeItem('login_redirect');
function setErr(m) {
const el = document.getElementById('err');