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(knock): let a signed-out visitor read the public door instead of a stuck inbox

nirholasc3434d9d246e
diff --git a/pages/knock.html b/pages/knock.html
index 97fa677cb..e85a718a5 100644
--- a/pages/knock.html
+++ b/pages/knock.html
@@ -19,7 +19,7 @@
<meta property="og:title" content="Knock · three.ws">
<meta property="og:description" content="Put a price on reaching you. Anyone, human or agent, can pay it to get one message through, and your 3D companion delivers it in person.">
<meta property="og:url" content="https://three.ws/knock">
- <meta property="og:image" content="https://three.ws/api/page-og?s=main&amp;t=Knock&amp;d=Put+a+price+on+reaching+you.+Anyone%2C+human+or+agent%2C+can+pay+it+to+get+one+message+through%2C+and+your+3D+companion+delivers+it+in+person&amp;p=%2Fknock">
+ <meta property="og:image" content="https://three.ws/api/page-og?s=main&amp;t=Knock&amp;d=Put+a+price+on+reaching+you.+Anyone%2C+a+person+or+an+agent%2C+can+pay+it+to+get+exactly+one+message+through%2C+and+your+3D+companion+walks+on+screen+and+delivers+it&amp;p=%2Fknock">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Knock - three.ws">
@@ -27,7 +27,7 @@
<meta name="twitter:site" content="@trythreews">
<meta name="twitter:title" content="Knock · three.ws">
<meta name="twitter:description" content="Put a price on reaching you. Your 3D companion delivers what gets through, in person.">
- <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&amp;t=Knock&amp;d=Put+a+price+on+reaching+you.+Anyone%2C+human+or+agent%2C+can+pay+it+to+get+one+message+through&amp;p=%2Fknock">
+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&amp;t=Knock&amp;d=Put+a+price+on+reaching+you.+Anyone%2C+a+person+or+an+agent%2C+can+pay+it+to+get+exactly+one+message+through%2C+and+your+3D+companion+walks+on+screen+and+delivers+it&amp;p=%2Fknock">
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
<meta property="og:locale" content="en_US">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebApplication","name":"three.ws Knock","applicationCategory":"CommunicationApplication","operatingSystem":"Web","description":"A priced, machine-payable door to a person. Pay someone's price to get one message through; their 3D companion delivers it in person.","url":"https://three.ws/knock","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}</script>
@@ -232,7 +232,7 @@
</div>
</section>
- <section aria-labelledby="inbox-h">
+ <section id="inbox-section" aria-labelledby="inbox-h">
<div class="sec-head">
<h2 id="inbox-h">Who knocked</h2>
<p>Every message that made it through, and what it was worth. Replying writes back to the receipt link the sender already holds.</p>
@@ -251,7 +251,7 @@
</div>
</section>
- <section aria-labelledby="blocks-h">
+ <section id="blocks-section" aria-labelledby="blocks-h">
<div class="sec-head">
<h2 id="blocks-h">Blocked</h2>
<p>Blocked senders get the same answer a shut door gives, so they cannot tell it was them.</p>
diff --git a/src/knock/api.js b/src/knock/api.js
index d9da43419..8d22d38d3 100644
--- a/src/knock/api.js
+++ b/src/knock/api.js
@@ -29,10 +29,17 @@ async function unwrap(res) {
return data;
}
-async function authed(path, { method = 'GET', body = null } = {}) {
+// `allowAnonymous` matters more here than it looks. /knock is a public page
+// with a private half: a signed-out visitor must see the directory, not be
+// bounced to /login by apiFetch's session guard the moment the owner-side read
+// comes back 401. Reads therefore tolerate anonymity and surface the 401 to the
+// caller, which renders the sign-in card. Writes keep the redirect, because
+// saving a door while signed out really does mean "go sign in".
+async function authed(path, { method = 'GET', body = null, allowAnonymous = false } = {}) {
return unwrap(
await apiFetch(path, {
method,
+ allowAnonymous,
...(body ? { headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) } : {}),
}),
);
@@ -55,13 +62,13 @@ export const knockApi = {
receipt: (url) => open(url.replace(/^https?:\/\/[^/]+/, '')),
// Owner
- settings: () => authed('/api/knock/settings'),
+ settings: () => authed('/api/knock/settings', { allowAnonymous: true }),
saveSettings: (patch) => authed('/api/knock/settings', { method: 'PATCH', body: patch }),
inbox: ({ limit = 30, before = null, status = null } = {}) => {
const params = new URLSearchParams({ limit: String(limit) });
if (before) params.set('before', before);
if (status) params.set('status', status);
- return authed(`/api/knock/inbox?${params.toString()}`);
+ return authed(`/api/knock/inbox?${params.toString()}`, { allowAnonymous: true });
},
actOn: (id, patch) => authed(`/api/knock/inbox/${encodeURIComponent(id)}`, { method: 'PATCH', body: patch }),
};
diff --git a/src/knock/page.js b/src/knock/page.js
index 5cabbd36e..8a78f7a2a 100644
--- a/src/knock/page.js
+++ b/src/knock/page.js
@@ -20,7 +20,7 @@ document.addEventListener('DOMContentLoaded', () => {
'door-max', 'door-cap', 'door-listed', 'save', 'save-note', 'settings-error',
'share-url', 'copy-share', 'share-block', 'endpoint-url', 'copy-endpoint',
'stat-pending', 'stat-total', 'stat-earned', 'inbox', 'inbox-empty', 'inbox-loading',
- 'load-more', 'blocks', 'blocks-empty', 'no-handle',
+ 'load-more', 'blocks', 'blocks-empty', 'no-handle', 'inbox-section', 'blocks-section',
]) {
els[id] = document.getElementById(id);
}
@@ -97,7 +97,13 @@ async function loadOwner() {
} catch (err) {
els['owner-loading'].hidden = true;
if (err.status === 401) {
+ // Signed out. The directory below stays public; the owner-only
+ // sections are hidden outright rather than left spinning on a
+ // request that will never be allowed to complete.
els['signed-out'].hidden = false;
+ els['inbox-loading'].hidden = true;
+ els['inbox-section'].hidden = true;
+ els['blocks-section'].hidden = true;
return;
}
els.owner.hidden = false;