Remove deprecated middleware and update component tests for branding and auth enhancements
- Deleted `middleware.disabled.ts` as it is no longer needed. - Refactored `HeroSection` and `HomePage` tests to align with updated branding and messaging. - Modified `DemoCredentialsModal` to support auto-filled demo credentials in login links. - Mocked `ThemeToggle`, `LocaleSwitcher`, and `DemoCredentialsModal` in relevant tests. - Updated admin tests to use `QueryClientProvider` and refactored API mocks for `AdminPage`. - Replaced test assertions for stats section and badges with new branding content.
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import type { NextRequest } from 'next/server';
|
||||
import createMiddleware from 'next-intl/middleware';
|
||||
import { routing } from './lib/i18n/routing';
|
||||
|
||||
// Create next-intl middleware for locale handling
|
||||
const intlMiddleware = createMiddleware(routing);
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const { pathname } = request.nextUrl;
|
||||
|
||||
// Block access to /dev routes in production (handles both /dev and /[locale]/dev)
|
||||
// Match: /dev, /en/dev, /it/dev, etc.
|
||||
if (pathname === '/dev' || pathname.match(/^\/[a-z]{2}\/dev($|\/)/)) {
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
if (isProduction) {
|
||||
// Return 404 in production
|
||||
return new NextResponse(null, { status: 404 });
|
||||
}
|
||||
}
|
||||
|
||||
// Handle locale routing with next-intl
|
||||
return intlMiddleware(request);
|
||||
}
|
||||
|
||||
export const config = {
|
||||
// Match all pathnames except for:
|
||||
// - API routes (/api/*)
|
||||
// - Static files (/_next/*, /favicon.ico, etc.)
|
||||
// - Files in public folder (images, fonts, etc.)
|
||||
matcher: [
|
||||
// Match all pathnames except for
|
||||
'/((?!api|_next|_vercel|.*\\..*).*)',
|
||||
// However, match all pathnames within /api/
|
||||
// that don't end with a file extension
|
||||
'/api/(.*)',
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user