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
feat: enhance PublishModal to accept session for improved user flow
nirholasdd37df7fb6be
diff --git a/src/app.js b/src/app.jsindex 884f86238..22798d7ad 100644--- a/src/app.js+++ b/src/app.js@@ -131,9 +131,7 @@ class App {if (resumeToken) {try {- const { restoreSession, clearStash } = await import(- './editor/edit-persistence.js'- );+ const { restoreSession, clearStash } = await import('./editor/edit-persistence.js');const stashed = await restoreSession(resumeToken);if (stashed) {if (stashed.source.url) {diff --git a/src/editor/index.js b/src/editor/index.jsindex c2c1f2bc2..492f9b1b4 100644--- a/src/editor/index.js+++ b/src/editor/index.js@@ -138,7 +138,7 @@ export class Editor {const { publishEditedGLB, AuthRequiredError } = publishMod;const { PublishModal } = modalMod;- modal = new PublishModal(document.body);+ modal = new PublishModal(document.body, { session: this.session });modal.onRetry(() => this._openPublishModal());modal.open();diff --git a/src/editor/publish-modal.js b/src/editor/publish-modal.jsindex 9cf57c4d4..2af28d240 100644--- a/src/editor/publish-modal.js+++ b/src/editor/publish-modal.js@@ -7,6 +7,8 @@* (snippets), or "error" / "auth-required".*/+import { stashSession } from './edit-persistence.js';+const STEPS = [{ key: 'export', label: 'Export' },{ key: 'upload', label: 'Upload' },@@ -17,8 +19,9 @@ const STEPS = [const STEP_ORDER = STEPS.map((s) => s.key);export class PublishModal {- constructor(containerEl) {+ constructor(containerEl, { session = null } = {}) {this.container = containerEl || document.body;+ this._session = session;this.overlay = null;this.modal = null;@@ -121,7 +124,6 @@ export class PublishModal {showAuthRequired() {if (!this.body) return;this._setTitle('Sign in to publish');- const next = encodeURIComponent(location.href);this.body.innerHTML = `<div class="publish-auth"><p class="publish-auth-msg">@@ -134,7 +136,10 @@ export class PublishModal {</div>`;this.body.querySelector('.publish-signin-btn').addEventListener('click', () => {- window.location.href = `/login?next=${next}`;+ this._signInAndReturn().catch((err) => {+ console.warn('[publish-modal] sign-in redirect failed', err);+ window.location.href = `/login?next=${encodeURIComponent(location.href)}`;+ });});this.body.querySelector('.publish-cancel-btn')@@ -147,6 +152,16 @@ export class PublishModal {}}+ async _signInAndReturn() {+ const nextURL = new URL(location.href);+ if (this._session) {+ const token = await stashSession(this._session);+ nextURL.searchParams.set('resume', token);+ nextURL.searchParams.set('publish', '1');+ }+ window.location.href = `/login?next=${encodeURIComponent(nextURL.toString())}`;+ }+showError(err) {if (!this.body) return;this._setTitle('Publish failed');