Bug #1 — Memory Echo cassé (runtime crash): - lib/ai/services/memory-echo.service.ts: lignes adjustedThreshold restaurées - Cause: sed console.log avait supprimé les lignes de définition - Effet: findConnections() crashait (ReferenceError) Bug #2 — Auth mobile totalement cassée (sécurité): - 14 routes app/api/mobile/*/: getMobileUserId(req) → await getMobileUserId(req) - Cause: verifyMobileToken devenu async mais callers non mis à jour - Effet: auth bypassée (Promise truthy au lieu de string) i18n: - searchModal.* + insightsView.* propagés dans 13 locales (EN fallback)
20 lines
591 B
TypeScript
20 lines
591 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import { getMobileUserId } from '@/lib/mobile-auth'
|
|
import { redis } from '@/lib/redis'
|
|
|
|
export async function POST(req: Request) {
|
|
const userId = await getMobileUserId(req)
|
|
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
|
|
|
const auth = req.headers.get('Authorization') ?? ''
|
|
const token = auth.startsWith('Bearer ') ? auth.slice(7) : ''
|
|
|
|
if (token) {
|
|
try {
|
|
await redis.setex(`mobile:revoked:${token}`, 90 * 24 * 60 * 60, '1')
|
|
} catch {}
|
|
}
|
|
|
|
return NextResponse.json({ success: true })
|
|
}
|