g1t/apps/web/app/routes/api-reference.tsx

63 lines3,064 bytesCodeBlame

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.

docs.g1t.sh, generated OpenAPI with an interactive reference, full footer1/**
2 * The interactive API reference: Scalar's explorer over g1t's OpenAPI
3 * document. It is a standalone page because the explorer brings its own
4 * layout.
5 */
6
7const CONFIGURATION = {
8 theme: "none",
9 darkMode: true,
10 hideDarkModeToggle: true,
11 hideClientButton: true,
12 defaultHttpClient: { targetKey: "shell", clientKey: "curl" },
13 metaData: { title: "API reference · g1t docs" },
14};
15
16// g1t's palette for the explorer.
17const STYLES = `
18 :root { --scalar-font: "Inter", system-ui, sans-serif; --scalar-font-code: "JetBrains Mono", ui-monospace, monospace; }
19 .dark-mode {
20 --scalar-background-1: #0e0d0a; --scalar-background-2: #16150f; --scalar-background-3: #1e1c15;
21 --scalar-border-color: #2a2820; --scalar-color-1: #f0eee6; --scalar-color-2: #a09c8f; --scalar-color-3: #6e6a5e;
22 --scalar-color-accent: #b6f24a; --scalar-background-accent: #b6f24a1f;
23 --scalar-button-1: #f0eee6; --scalar-button-1-color: #0e0d0a; --scalar-button-1-hover: #ffffff;
24 --scalar-color-green: #b6f24a; --scalar-color-blue: #7cc4ff; --scalar-color-red: #ff7a6b; --scalar-color-orange: #f2c14a;
25 --scalar-sidebar-background-1: #0e0d0a; --scalar-sidebar-color-1: #f0eee6; --scalar-sidebar-color-2: #a09c8f;
26 --scalar-sidebar-border-color: #2a2820; --scalar-sidebar-item-hover-background: #16150f;
27 --scalar-sidebar-item-active-background: #1e1c15; --scalar-sidebar-color-active: #b6f24a;
28 }
29 .g1t-bar { display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 16px; background: #16150f; border-bottom: 1px solid #2a2820; font: 14px "Inter", system-ui, sans-serif; }
30 .g1t-bar a { color: #a09c8f; text-decoration: none; }
31 .g1t-bar a:hover { color: #f0eee6; }
32 .g1t-bar .brand { font: 600 18px "JetBrains Mono", ui-monospace, monospace; color: #f0eee6; }
33 .g1t-bar .brand span { color: #b6f24a; }
34`;
35
36export function loader() {
37 const html = `<!doctype html>
38<html lang="en">
39<head>
40<meta charset="utf-8">
41<meta name="viewport" content="width=device-width, initial-scale=1">
42<title>API reference · g1t docs</title>
43<meta name="description" content="Every g1t API endpoint, with an explorer to call them from the page.">
44<link rel="icon" type="image/svg+xml" href="/favicon.svg">
45<link rel="canonical" href="https://docs.g1t.sh/api/reference">
46<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..700&family=JetBrains+Mono:wght@400;500;600&display=swap">
47<style>body { margin: 0; background: #0e0d0a; }${STYLES}</style>
48</head>
49<body>
50<header class="g1t-bar">
51 <a class="brand" href="https://g1t.sh/">g<span>1</span>t</a>
52 <a href="/docs">Docs</a>
53 <a href="/docs/api">API overview</a>
54 <a href="https://api.g1t.sh/openapi.json">OpenAPI</a>
55</header>
56<script id="api-reference" data-url="https://api.g1t.sh/openapi.json" data-configuration='${JSON.stringify(CONFIGURATION)}'></script>
57<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
58</body>
59</html>`;
60 return new Response(html, {
61 headers: { "content-type": "text/html; charset=utf-8" },
62 });
63}