feat: Initialize new admin application with a landing page, cookie consent, and theme switching functionality.

This commit is contained in:
Timo Knuth
2026-03-02 23:33:11 +01:00
parent 873c5e53af
commit 59f3efaaed
7 changed files with 289 additions and 16 deletions

View File

@@ -63,7 +63,9 @@ export function middleware(request: NextRequest) {
// Paths that should not be rewritten into the slug folder
// because they are shared across the entire app
const SHARED_PATHS = ['/login', '/api', '/superadmin', '/registrierung', '/impressum', '/datenschutz', '/passwort-aendern']
const isSharedPath = SHARED_PATHS.some((p) => pathname.startsWith(p)) || pathname.startsWith('/_next')
const isSharedPath = SHARED_PATHS.some((p) => pathname.startsWith(p)) ||
pathname.startsWith('/_next') ||
/\.(png|jpg|jpeg|gif|svg|webp|ico|txt|xml)$/i.test(pathname)
if (!isSharedPath && !pathname.startsWith(`/${slug}`)) {
const rewriteUrl = request.nextUrl.clone()
@@ -80,7 +82,8 @@ export function middleware(request: NextRequest) {
// Check if it's a known non-reserved path but could be an organization slug
// We don't want to redirect /login, /api, etc.
const SHARED_PATHS = ['login', 'api', 'superadmin', 'dashboard', 'registrierung', 'impressum', 'datenschutz', '_next', 'uploads', 'favicon.ico', 'passwort-aendern']
if (potentialSlug && !SHARED_PATHS.includes(potentialSlug)) {
const isStaticAsset = /\.(png|jpg|jpeg|gif|svg|webp|ico|txt|xml)$/i.test(potentialSlug)
if (potentialSlug && !SHARED_PATHS.includes(potentialSlug) && !isStaticAsset) {
// This looks like a tenant path being accessed from the root domain.
// Redirect to subdomain.
const baseHost = hostname.split('.').slice(-2).join('.') // Simplistic, assumes domain.tld or localhost