From e73680a70da68c55514b6d5598f4d58aec12066c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20X=2E=20F=C3=BCrst?= Date: Mon, 1 Jun 2026 16:12:16 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20middleware.ts=20=E2=86=92=20proxy.ts=20(?= =?UTF-8?q?Next.js=2016=20Konvention)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Next.js 16 erwartet proxy.ts mit export function proxy(), nicht middleware.ts. Deprecation-Warnung damit beseitigt. CLAUDE.md mit korrekter Konvention aktualisiert. Co-Authored-By: Claude Sonnet 4.6 --- CLAUDE.md | 2 +- middleware.ts => proxy.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename middleware.ts => proxy.ts (96%) diff --git a/CLAUDE.md b/CLAUDE.md index 2a25e67..a7c7060 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,7 +16,7 @@ No test suite exists. Deploy via `./deploy.sh [tag]` — builds multiplatform Do Next.js 16 App Router application. All pages are server components; interactive parts are Client Components in `app/MainClient.tsx` and `components/`. -**Auth flow**: Users come from the existing MySQL `beos` table (not a separate users table). Login via `app/login/actions.ts` → `lib/auth.ts` (bcryptjs). Sessions are JWT cookies via jose (`lib/session.ts`, 1-hour expiry). If `pw IS NULL`, the default password is `welzheim` and `mustChangePassword` is forced to `true`. The middleware file exports `proxy` (not `middleware`) — Next.js 16 requirement. +**Auth flow**: Users come from the existing MySQL `beos` table (not a separate users table). Login via `app/login/actions.ts` → `lib/auth.ts` (bcryptjs). Sessions are JWT cookies via jose (`lib/session.ts`, 1-hour expiry). If `pw IS NULL`, the default password is `welzheim` and `mustChangePassword` is forced to `true`. Middleware lives in `proxy.ts` (Next.js 16 convention) and exports `middleware` (not `proxy`). **Database**: MySQL, database name `sternwarte`, via `lib/db.ts` connection pool. The pre-existing `beos` table has non-standard columns: `` `kürzel` `` (umlaut → always needs backticks), `pw`, `id` (all lowercase). The DB charset is **utf8mb4** (collation `utf8mb4_unicode_ci`); connection pool uses `charset: 'utf8mb4'`. diff --git a/middleware.ts b/proxy.ts similarity index 96% rename from middleware.ts rename to proxy.ts index 3cbef69..3d51cba 100644 --- a/middleware.ts +++ b/proxy.ts @@ -7,7 +7,7 @@ const secretKey = process.env.AUTH_SECRET; if (!secretKey) throw new Error('AUTH_SECRET Umgebungsvariable ist nicht gesetzt!'); const key = new TextEncoder().encode(secretKey); -export async function middleware(request: NextRequest) { +export async function proxy(request: NextRequest) { const { pathname } = request.nextUrl; if (pathname.startsWith('/login') || pathname.startsWith('/_next') || pathname.startsWith('/favicon')) {