From dc3acb68818828f9c44992bb9aeabb5531374788 Mon Sep 17 00:00:00 2001 From: Nico Bleiler Date: Mon, 30 Oct 2023 02:00:38 +0100 Subject: [PATCH] Used client address for terminal emulation --- src/routes/[[birb]]/+server.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes/[[birb]]/+server.ts b/src/routes/[[birb]]/+server.ts index e8af4bc..f5eacca 100644 --- a/src/routes/[[birb]]/+server.ts +++ b/src/routes/[[birb]]/+server.ts @@ -78,7 +78,8 @@ export function GET(event: RequestEvent) { console.log("ClientAddress", event.getClientAddress()); const encoder = new TextEncoder(); const readable = new ReadableStream({ - async start(controller) { + async start(controller) { + const client: string = event.getClientAddress(); const path: string = (event.url.pathname == "/") ? "" : event.url.pathname; let birb: string = event.params.birb ? event.params.birb : ""; birb = validateBirb(birb); @@ -90,10 +91,10 @@ export function GET(event: RequestEvent) { let color: string = getRandomColor(); let birbIndex: number = 0; const options = getOptions(event.url.searchParams); - + controller.enqueue(encoder.encode(clearTerminal)); await delay(5); - controller.enqueue(encoder.encode(`[root@localhost ~] $ `)); + controller.enqueue(encoder.encode(`[root@${client} ~] $ `)); await delay(1000); for (const letter of introText) { controller.enqueue(encoder.encode(colors["white"](letter)));