From ca87b1a5f220a6f3b8857cf00602abf867c9a7d9 Mon Sep 17 00:00:00 2001 From: whoswhip Date: Sun, 18 Jan 2026 22:00:54 -0500 Subject: [PATCH] feat: /raw/{id} endpoint --- .gitignore | 4 ---- .../src/routes/raw/[id]/+server.ts | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 SharpbinV3.Client/src/routes/raw/[id]/+server.ts diff --git a/.gitignore b/.gitignore index 8e0a7e6..8cdcd15 100644 --- a/.gitignore +++ b/.gitignore @@ -33,10 +33,6 @@ bld/ [Ll]og/ [Ll]ogs/ -p/ -privp/ -raw/ - # Visual Studio 2015/2017 cache/options directory .vs/ # Uncomment if you have tasks that create the project's static files in wwwroot diff --git a/SharpbinV3.Client/src/routes/raw/[id]/+server.ts b/SharpbinV3.Client/src/routes/raw/[id]/+server.ts new file mode 100644 index 0000000..bd4ec2b --- /dev/null +++ b/SharpbinV3.Client/src/routes/raw/[id]/+server.ts @@ -0,0 +1,19 @@ +import type { RequestHandler } from '@sveltejs/kit'; + +const apiUrl = process.env.VITE_API_URL || 'http://localhost:5050'; + +export const GET: RequestHandler = async ({ params }) => { + const { id } = params; + + const res = await fetch(`${apiUrl}/api/paste/${id}/raw`); + + if (res.status === 404) { + return new Response('Paste not found', { status: 404 }); + } + const content = await res.text(); + return new Response(content, { + headers: { + 'Content-Type': 'text/plain; charset=utf-8' + } + }); +};