TTikotok V4

This commit is contained in:
2026-07-10 11:29:04 +02:00
parent 1a9548cf25
commit 5c48def4e1
60 changed files with 6097 additions and 1319 deletions

View File

@@ -1,33 +1,15 @@
import type { NextRequest } from 'next/server'
import { NextResponse } from 'next/server'
import { getLocaleForPath } from '@/lib/localeRoutes'
const APEX_HOST = 'greenlenspro.com'
const WWW_HOST = `www.${APEX_HOST}`
const ENGLISH_PATHS = new Set([
'/best-plant-identification-app',
'/plant-identifier-app',
'/plant-scanner',
'/flower-scanner',
'/houseplant-identifier',
'/succulent-identifier',
'/identify-plant-photo',
'/plant-disease-identifier',
'/plant-health-app',
'/plant-care-app',
])
function getLangForPath(pathname: string) {
if (pathname === '/es' || pathname.startsWith('/es/')) return 'es'
if (pathname === '/vs/google-lens') return 'de'
if (ENGLISH_PATHS.has(pathname) || pathname.startsWith('/vs/')) return 'en'
return 'de'
}
export function proxy(request: NextRequest) {
const host = request.headers.get('host')
const forwardedProto = request.headers.get('x-forwarded-proto')
const requestHeaders = new Headers(request.headers)
requestHeaders.set('x-greenlens-lang', getLangForPath(request.nextUrl.pathname))
requestHeaders.set('x-greenlens-lang', getLocaleForPath(request.nextUrl.pathname))
if (!host || (host !== APEX_HOST && host !== WWW_HOST)) {
return NextResponse.next({ request: { headers: requestHeaders } })