From 72bde1f274e4d05288a9ff034dac95f3246ba1e1 Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Date: Sat, 1 Jun 2024 21:46:32 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20fix=20header=20(#850)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/screenshot-service/src/index.ts | 10 +++++----- apps/server/src/checker/index.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/screenshot-service/src/index.ts b/apps/screenshot-service/src/index.ts index 4d655ee02..2a0a16747 100644 --- a/apps/screenshot-service/src/index.ts +++ b/apps/screenshot-service/src/index.ts @@ -21,7 +21,7 @@ const S3 = new S3Client({ const app = new Hono(); app.get("/ping", (c) => - c.json({ ping: "pong", region: process.env.FLY_REGION }, 200), + c.json({ ping: "pong", region: process.env.FLY_REGION }, 200) ); app.post( @@ -32,10 +32,10 @@ app.post( url: z.string().url(), incidentId: z.number(), kind: z.enum(["incident", "recovery"]), - }), + }) ), async (c) => { - const auth = c.req.header("Authorization"); + const auth = c.req.header("api-key"); if (auth !== `Basic ${env.HEADER_TOKEN}`) { console.error("Unauthorized"); return c.text("Unauthorized", 401); @@ -60,7 +60,7 @@ app.post( Bucket: "incident-screenshot", Key: id, ContentType: "image/png", - }), + }) ); if (data.kind === "incident") { @@ -94,7 +94,7 @@ app.post( } return c.text("Screenshot saved"); - }, + } ); export default app; diff --git a/apps/server/src/checker/index.ts b/apps/server/src/checker/index.ts index 858b767b5..02a9e6fea 100644 --- a/apps/server/src/checker/index.ts +++ b/apps/server/src/checker/index.ts @@ -267,7 +267,7 @@ const triggerScreenshot = async ({ method: "POST", headers: { "Content-Type": "application/json", - Authorization: `Basic ${env.CRON_SECRET}`, + "api-key": `Basic ${env.CRON_SECRET}`, }, body: { url: data.url, -- 2.54.0