| 1 | /** |
| 2 | * The g1t CLI's install scripts: g1t.sh/install for Linux and macOS |
| 3 | * (`curl -fsSL https://g1t.sh/install | sh`) and g1t.sh/install.ps1 for |
| 4 | * Windows (`irm https://g1t.sh/install.ps1 | iex`). Each downloads the newest |
| 5 | * release from g1t.sh/downloads/cli/ (scripts/cli-release.mjs), checks it |
| 6 | * against the release's SHA256SUMS, and installs it. `install` is a |
| 7 | * reserved name. |
| 8 | */ |
| 9 | import type { Route } from "./+types/install-script"; |
| 10 | import sh from "../content/install/install.sh?raw"; |
| 11 | import ps1 from "../content/install/install.ps1?raw"; |
| 12 | |
| 13 | export function loader({ request }: Route.LoaderArgs) { |
| 14 | const windows = new URL(request.url).pathname.endsWith(".ps1"); |
| 15 | return new Response(windows ? ps1 : sh, { |
| 16 | headers: { |
| 17 | "content-type": "text/plain; charset=utf-8", |
| 18 | "cache-control": "public, max-age=300", |
| 19 | "x-content-type-options": "nosniff", |
| 20 | }, |
| 21 | }); |
| 22 | } |