Publish the hub as pi-mobile-hub with CLI flags and LAN pairing auth, add mobile deep-link pairing and EAS build config, and expand gitignore for Expo/EAS artifacts. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
831 B
TypeScript
34 lines
831 B
TypeScript
export type ConnectDeepLinkParams = {
|
|
host: string;
|
|
port: string;
|
|
token: string;
|
|
name?: string;
|
|
};
|
|
|
|
export function parseConnectDeepLink(url: string): ConnectDeepLinkParams | null {
|
|
try {
|
|
const parsed = new URL(url);
|
|
if (parsed.protocol !== "pimobile:") {
|
|
return null;
|
|
}
|
|
|
|
const path = parsed.pathname.replace(/^\/+/, "");
|
|
if (path !== "connect" && parsed.host !== "connect") {
|
|
return null;
|
|
}
|
|
|
|
const host = parsed.searchParams.get("host")?.trim();
|
|
const port = parsed.searchParams.get("port")?.trim() || "8787";
|
|
const token = parsed.searchParams.get("token")?.trim();
|
|
const name = parsed.searchParams.get("name")?.trim();
|
|
|
|
if (!host || !token) {
|
|
return null;
|
|
}
|
|
|
|
return { host, port, token, name: name || undefined };
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|