From a8796dd94d543b4079c0d34d5891a10fc6791856 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sun, 26 Oct 2025 17:17:55 +0800 Subject: [PATCH] Update index.ts --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index b006394..cc3597e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,10 +75,10 @@ export const app = new Elysia() // Error handling: Return status code and message .onError(({ error, status }) => { if (error instanceof HttpError) { + console.error(`[-] HTTP ${error.status}: ${error.message}`) if (error.content instanceof String) return status(error.status, { msg: error.message }) else return status(error.status, error.content) } - // else return status(500, { error: "Internal Server Error" }) else throw error }) .get("/", ({ redirect }) => redirect("https://aza.moe/photo")) @@ -87,6 +87,8 @@ export const app = new Elysia() const { owner_key, photo, edited_photo } = body checkHeaderKey(headers) + console.log("[+] Received upload request") + // Generate an ID of 8 numbers const id = Math.random().toString().substring(2, 10) let metadata = await getMetadata() @@ -128,6 +130,8 @@ export const app = new Elysia() metadata.push(newEntry) await saveMetadata(metadata) + console.log(`[+] Upload complete for photo ${newEntry.id}`) + done(201, { success: true, id: newEntry.id }) }, { // --- Validation Schema ---