Initial commit - QR Master application

This commit is contained in:
Timo Knuth
2025-10-13 20:19:18 +02:00
commit 5262f9e78f
96 changed files with 18902 additions and 0 deletions

52
src/middleware.ts Normal file
View File

@@ -0,0 +1,52 @@
import { withAuth } from 'next-auth/middleware';
import { NextResponse } from 'next/server';
export default withAuth(
function middleware(req) {
return NextResponse.next();
},
{
callbacks: {
authorized: ({ req, token }) => {
// Public routes that don't require authentication
const publicPaths = [
'/',
'/pricing',
'/faq',
'/blog',
'/login',
'/signup',
'/api/auth',
];
const path = req.nextUrl.pathname;
// Allow public paths
if (publicPaths.some(p => path.startsWith(p))) {
return true;
}
// Allow redirect routes
if (path.startsWith('/r/')) {
return true;
}
// Require authentication for all other routes
return !!token;
},
},
}
);
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* - public folder
*/
'/((?!_next/static|_next/image|favicon.ico|logo.svg|og-image.png).*)',
],
};