313b5ff7fd
Ambient:
- Replace oscillator drone/melody with singing bowl synthesis
- Each bowl: instant attack + exponential decay (7–12s) = real physical sound
- Two detuned copies per strike for natural shimmer beat
- A-minor pentatonic (A3 C4 D4 E4 G4 A4 C5 E5), weighted toward warm lows
- 30% chance of soft harmonic fifth companion tone per strike
- Random gaps 3–8s between strikes so it breathes naturally
- Two long hall reverb tails (2.4s / 4.8s) for warmth and space
- Graceful 2.5s fade-out on stop
Next.js 16 compatibility (breaking changes from v14→v16):
- Dynamic route params now Promise<{...}> → await params in all handlers
- cookies() now returns Promise → isAdmin() made async, await cookies()
- Files: [...path], memories/[id], media/[id], auth, upload all updated
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { createHash } from 'crypto'
|
|
import { cookies } from 'next/headers'
|
|
|
|
function getExpectedToken() {
|
|
return createHash('sha256')
|
|
.update(process.env.ADMIN_PASSWORD || 'change-me')
|
|
.digest('hex')
|
|
}
|
|
|
|
export async function GET() {
|
|
const cookieStore = await cookies()
|
|
const token = cookieStore.get('admin_auth')?.value
|
|
return NextResponse.json({ authed: token === getExpectedToken() })
|
|
}
|
|
|
|
export async function POST(req: NextRequest) {
|
|
const { password } = await req.json()
|
|
|
|
if (password !== (process.env.ADMIN_PASSWORD || 'change-me')) {
|
|
return NextResponse.json({ error: 'Falsches Passwort' }, { status: 401 })
|
|
}
|
|
|
|
const response = NextResponse.json({ success: true })
|
|
response.cookies.set('admin_auth', getExpectedToken(), {
|
|
httpOnly: true,
|
|
secure: process.env.NODE_ENV === 'production',
|
|
sameSite: 'lax',
|
|
maxAge: 60 * 60 * 24 * 30,
|
|
path: '/',
|
|
})
|
|
return response
|
|
}
|
|
|
|
export async function DELETE() {
|
|
const response = NextResponse.json({ success: true })
|
|
response.cookies.delete('admin_auth')
|
|
return response
|
|
}
|