Skip to content

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

Merge remote-tracking branch 'origin/main' into web-thread-link

Purv Kabariaa0a74a1c2994
diff --cc src/lib/phone-pairing.ts
index 65e6c265f5,49011dcd70..a7e9abfa6d
--- a/src/lib/phone-pairing.ts
+++ b/src/lib/phone-pairing.ts
@@@ -116,16 -125,17 +125,23 @@@ export function takePhonePairingRequest
return `${url.pathname}${url.search}${url.hash}`;
}
+ /** True once, after a `pair=open` link: the phone page opens Pair a phone as it loads. */
+ export function takePairOnOpen(): boolean {
+ const asked = pairOnOpen;
+ pairOnOpen = false;
+ return asked;
+ }
+
-/** Where a page signed in by the app goes next: the phone pairing, or back to a path of this same server. */
+/** Where a page signed in by the app goes next: the phone pairing, back to a path of this same server, or a linked thread. */
export function pairedDestination(search: string): string {
const params = new URLSearchParams(search);
- if (params.get("desktop-settings") === "phone") return "/?desktop-settings=phone";
+ if (params.get("desktop-settings") === "phone") return params.get("pair") === "open" ? "/?desktop-settings=phone&pair=open" : "/?desktop-settings=phone";
const next = params.get("next");
- return next && /^\/(?!\/)/.test(next) && !next.startsWith("/pair") && !/[\\\s]/.test(next) ? next : "/";
+ if (next && /^\/(?!\/)/.test(next) && !next.startsWith("/pair") && !/[\\\s]/.test(next)) return next;
+ const thread = params.get("thread");
+ if (thread === null) return "/";
+ const keep = new URLSearchParams({ thread });
+ const bot = params.get("bot");
+ if (bot !== null) keep.set("bot", bot);
+ return `/?${keep}`;
}