Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge remote-tracking branch 'gh/main' into train/nov30-final

milind-sonic57ba6e7a0d6
diff --cc src/components/keys/KeysPage.tsx
index 7eac365233,f41d32a8f6..cf7c205969
--- a/src/components/keys/KeysPage.tsx
+++ b/src/components/keys/KeysPage.tsx
@@@ -5,10 -5,8 +5,9 @@@ import { type ConfigStatus } from "@/st
import { cn } from "@/lib/cn";
import { scrollParent, scrollWithin } from "@/lib/scroll-within";
import { t } from "@/lib/i18n";
- import { BoatOfferPanel } from "../BoatOffer";
import { LiveProviderSettings } from "../LiveProviderSettings";
import { VoiceEveryReplySetting } from "../VoiceEveryReplySetting";
+import { VoicePlaybackRateSetting } from "../VoicePlaybackRateSetting";
import { VoiceHearingSetting } from "../VoiceHearingSetting";
import { BuiltInCustomHeaders } from "../OpenAiCompatCustomHeaders";
import { BuiltInReplyWait, LmStudioServer, OtherOpenAiCompatServers } from "../OpenAiCompatServers";
diff --cc src/lib/app-links.ts
index b97105fee9,182b1d6c20..a1e7bbcff3
--- a/src/lib/app-links.ts
+++ b/src/lib/app-links.ts
@@@ -49,30 -49,3 +49,24 @@@ export async function openExternalLink(
}
window.open(url, "_blank", "noopener,noreferrer");
}
+
- /** A browser hands a mailto: link to its own mail app; the desktop app's window may not navigate to one, so main opens it. */
- export async function openEmailDraft(url: string): Promise<void> {
- if (window.ogb) return openExternalLink(url);
- window.location.href = url;
- }
-
+/** 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. */
+function ownerPageId(url: string): string | undefined {
+ let link: 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);
+ return once.origin === link.origin && once.pathname === link.pathname ? once.href : url;
+ } catch {
+ return url;
+ }
+}