Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
30 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 sidebar asks billing whether it is on, not for the account, so no page waits on the card processor1import type { RegistrationMode } from "@g1t/contracts";
2
3import { identity } from "./services.server";
4
5/** How long one isolate trusts the answer before asking identity again. */
6const TTL_MS = 60_000;
7
8let known: { mode: RegistrationMode; at: number } | null = null;
9
10/**
11 * Whether g1t.sh is invite-only, as identity's REGISTRATION_MODE says.
12 * Asked at most once a minute per isolate; when identity cannot answer,
13 * the site says invite-only, the same as identity does with no setting.
14 */
15export async function registrationMode(): Promise<RegistrationMode> {
16 const now = Date.now();
17 if (known && now - known.at < TTL_MS) return known.mode;
18 try {
19 const mode = await identity.registration();
20 known = { mode: mode === "open" ? "open" : "invite", at: now };
21 return known.mode;
22 } catch {
23 return "invite";
24 }
25}
26
27/** Who is asking, for identity's rate limits: the visitor's address. */
28export function clientKey(request: Request): string | null {
29 return request.headers.get("cf-connecting-ip") ?? request.headers.get("x-forwarded-for")?.split(",")[0]?.trim() ?? null;
30}

This file's history is long; its oldest lines are credited to the oldest commit read.