Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/web/app/install.sh/route.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { describe, expect, it } from "vitest";
import { GET } from "./route";

describe("GET /install.sh", () => {
it("serves the Linux installer script directly", async () => {
const response = await GET();
const body = await response.text();

expect(response.status).toBe(200);
expect(response.headers.get("content-type")).toContain("text/x-shellscript");
expect(body).toContain("#!/usr/bin/env bash");
expect(body).toContain("Usage: install.sh");
});
});
18 changes: 18 additions & 0 deletions apps/web/app/install.sh/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { readFile } from "node:fs/promises";

export const runtime = "nodejs";

export async function GET() {
const script = await readFile(

Check failure on line 6 in apps/web/app/install.sh/route.ts

View workflow job for this annotation

GitHub Actions / frontend

app/install.sh/route.test.ts > GET /install.sh > serves the Linux installer script directly

TypeError: The URL must be of scheme file ❯ GET app/install.sh/route.ts:6:24 ❯ app/install.sh/route.test.ts:6:28 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'ERR_INVALID_URL_SCHEME' }
new URL("../../../../scripts/install.sh", import.meta.url),
"utf8",
);

return new Response(script, {
headers: {
"Cache-Control": "public, max-age=300",
"Content-Disposition": 'inline; filename="install.sh"',
"Content-Type": "text/x-shellscript; charset=utf-8",
},
});
}
Loading