-
- {/* biome-ignore lint/suspicious/useAwait: "Server Actions must be async" */}
+ {/*
{async ([data]) => {
'use server';
@@ -32,7 +31,7 @@ export const Hero = async () => {
);
}}
-
+ */}
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index 116ae81..53e550c 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -6,7 +6,7 @@ import {
noseconeConfig,
noseconeMiddleware,
} from '@konobangu/security/middleware';
-import { NextResponse } from 'next/server';
+import { type NextRequest, NextResponse } from 'next/server';
export const config = {
// matcher tells Next.js which routes to run the middleware on. This runs the
@@ -16,26 +16,32 @@ export const config = {
const securityHeaders = noseconeMiddleware(noseconeConfig);
-export default authMiddleware(async (_auth, request) => {
- if (!env.ARCJET_KEY) {
- return securityHeaders();
- }
+export const middleware = async (request: NextRequest) => {
+ const beforeMiddleware = async (request: NextRequest) => {
+ if (!env.ARCJET_KEY) {
+ return securityHeaders();
+ }
- try {
- await secure(
- [
- // See https://docs.arcjet.com/bot-protection/identifying-bots
- 'CATEGORY:SEARCH_ENGINE', // Allow search engines
- 'CATEGORY:PREVIEW', // Allow preview links to show OG images
- 'CATEGORY:MONITOR', // Allow uptime monitoring services
- ],
- request
- );
+ try {
+ await secure(
+ [
+ // See https://docs.arcjet.com/bot-protection/identifying-bots
+ 'CATEGORY:SEARCH_ENGINE', // Allow search engines
+ 'CATEGORY:PREVIEW', // Allow preview links to show OG images
+ 'CATEGORY:MONITOR', // Allow uptime monitoring services
+ ],
+ request
+ );
- return securityHeaders();
- } catch (error) {
- const message = parseError(error);
+ return securityHeaders();
+ } catch (error) {
+ const message = parseError(error);
- return NextResponse.json({ error: message }, { status: 403 });
- }
-});
+ return NextResponse.json({ error: message }, { status: 403 });
+ }
+ };
+
+ const response = await beforeMiddleware(request);
+
+ return authMiddleware(response as any);
+};