Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Links: only an owner-only page's link waits for its one-time code; every other link opens at once
milind-sonicd34fd582603
diff --git a/src/lib/app-links.ts b/src/lib/app-links.tsindex c22a6ba7c7..b97105fee9 100644--- a/src/lib/app-links.ts+++ b/src/lib/app-links.ts@@ -44,7 +44,7 @@ export function platformLabel(platform?: string): string | null {export async function openExternalLink(url: string): Promise<void> {if (window.ogb?.openExternal) {- await window.ogb.openExternal(await ownerPageOnce(url));+ await window.ogb.openExternal(ownerPageId(url) ? await ownerPageOnce(url) : url);return;}window.open(url, "_blank", "noopener,noreferrer");@@ -59,11 +59,15 @@ export async function openEmailDraft(url: string): Promise<void> {/** An owner-only page's link, `/api/published-pages/<id>/`, opens only where the owner is signed in, and the system browser* the desktop app hands links to is not. It gets the same link with a one-time code instead, which lets that browser in* for this page alone; anything else, or a server that refuses, keeps the link as it was. */-async function ownerPageOnce(url: string): Promise<string> {+function ownerPageId(url: string): string | undefined {let link: URL;- try { link = new URL(url); } catch { return url; }- const pageId = /^\/api\/published-pages\/([a-z0-9]{20,63})\/$/.exec(link.pathname)?.[1];- if (!pageId || link.search || link.hash) return url;+ try { link = new URL(url); } catch { return undefined; }+ return link.search || link.hash ? undefined : /^\/api\/published-pages\/([a-z0-9]{20,63})\/$/.exec(link.pathname)?.[1];+}++async function ownerPageOnce(url: string): Promise<string> {+ const link = new URL(url);+ const pageId = ownerPageId(url);try {const { api } = await import("@/state/api");const once = new URL((await api<{ url: string }>(`/api/published-pages/${pageId}/open`, { method: "POST", body: "{}" })).url);