Skip to content
24 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The phone app's scaffolding, in apps/mobile: Expo SDK 57 with Expo Router, Android first, with Chat, Code and Customize. It signs in with g1t's own OAuth 2.1 (PKCE, a client id that encodes "g1t for Android" and g1t://oauth/callback, so nothing is registered), keeps the server and credentials in the phone's keystore, refreshes the 30-day token a minute early and shares the single-use refresh between requests. A personal access token is the other way in, and a self-hosted g1t the other server.1import { routeFor, sitePathOf } from "@/lib/links";
2
3/**
4 * Where a link that opens the app goes. `g1t://` links name a site path,
5 * as on the desktop; the app shows the ones it has screens for and opens
6 * the rest on the site (app/open.tsx). Android App Links and iOS
7 * Universal Links for https://g1t.sh come through here too once the site
8 * publishes assetlinks.json and apple-app-site-association.
9 */
10export function redirectSystemPath({ path }: { path: string; initial: boolean }): string {
11 try {
12 const sitePath = sitePathOf(path) ?? sitePathOfWeb(path) ?? path;
13 const route = routeFor(sitePath);
14 return route ?? `/open?path=${encodeURIComponent(sitePath)}`;
15 } catch {
16 return "/";
17 }
18}
19
20function sitePathOfWeb(link: string): string | null {
21 if (!/^https?:\/\//i.test(link)) return null;
22 const url = new URL(link);
23 return url.pathname + url.search;
24}