diff --git a/src/middleware.ts b/src/middleware.ts index c243db0547..d2a43fa291 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -1,23 +1,8 @@ import metrics from "../metrics"; -import {APIContext} from "astro"; -export async function onRequest({ request, clientAddress }: APIContext, next: () => any) { +export async function onRequest({ request }: any, next: () => any) { const path = new URL(request.url).pathname.slice(1); - - await fetch("https://plausible.io/api/event", { - method: "POST", - headers: { - "Content-Type": "application/json", - "User-Agent": request.headers.get("User-Agent")!, - "X-Forwarded-For": clientAddress, - }, - body: JSON.stringify({ - domain: "sprig.hackclub.com", - url: request.url, - name: "pageview" - }) - }) - + if (!path.includes("api")) return next(); const metricName = path.split("/").join("_");