Skip to content

Commit 4d9660d

Browse files
committed
Forgot one file!
1 parent 1266c52 commit 4d9660d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/app/api/install/route.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ import { join } from "path";
44
const scriptPath = join(process.cwd(), "scripts", "install.sh");
55

66
export async function GET(request: Request) {
7-
const script = readFileSync(scriptPath, "utf-8");
7+
const url = new URL(request.url);
8+
const rawTag = url.searchParams.get("tag") ?? "latest";
9+
const tag = /^[a-zA-Z0-9._-]+$/.test(rawTag) ? rawTag : "latest";
10+
const source = url.searchParams.get("source") ?? "direct";
11+
12+
let script = readFileSync(scriptPath, "utf-8");
13+
script = script.replace(
14+
'IMAGE="paradedb/paradedb:latest"',
15+
`IMAGE="paradedb/paradedb:${tag}"`,
16+
);
817

918
// Fire GA4 Measurement Protocol event (fire-and-forget)
1019
const measurementId = process.env.GA4_MEASUREMENT_ID;
@@ -22,7 +31,8 @@ export async function GET(request: Request) {
2231
{
2332
name: "install_script_download",
2433
params: {
25-
source: "curlbash",
34+
source: source.slice(0, 50),
35+
image_tag: tag,
2636
user_agent: ua.slice(0, 100),
2737
},
2838
},

0 commit comments

Comments
 (0)