fix(critique): 2 régressions introduites par les fixes précédents
All checks were successful
CI / Lint, Unit Tests & Build (push) Successful in 6m13s
CI / Deploy production (on server) (push) Successful in 24s

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)
This commit is contained in:
Antigravity
2026-07-05 16:53:36 +00:00
parent a9e43d7594
commit a84c7e80d6
28 changed files with 306 additions and 17 deletions

View File

@@ -11,7 +11,7 @@ const MODE_MAP: Record<string, 'clarify' | 'shorten' | 'improveStyle' | 'fix_gra
}
export async function POST(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { text, mode = 'improve' } = await req.json().catch(() => ({}))

View File

@@ -5,7 +5,7 @@ import { getSystemConfig } from '@/lib/config'
import { reserveUsageOrThrow, QuotaExceededError } from '@/lib/entitlements'
export async function POST(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { content } = await req.json().catch(() => ({}))

View File

@@ -3,7 +3,7 @@ import { getMobileUserId } from '@/lib/mobile-auth'
import { getSystemConfig } from '@/lib/config'
export async function POST(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const formData = await req.formData().catch(() => null)

View File

@@ -3,7 +3,7 @@ import { getMobileUserId } from '@/lib/mobile-auth'
import { redis } from '@/lib/redis'
export async function POST(req: Request) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
const auth = req.headers.get('Authorization') ?? ''

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { getMobileUserId } from '@/lib/mobile-auth'
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const user = await prisma.user.findUnique({

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { getMobileUserId } from '@/lib/mobile-auth'
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
const now = new Date()

View File

@@ -6,7 +6,7 @@ import { stripHtmlToText } from '@/lib/flashcards/deck-utils'
import { reserveUsageOrThrow, QuotaExceededError } from '@/lib/entitlements'
export async function POST(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const body = await req.json().catch(() => ({}))

View File

@@ -4,7 +4,7 @@ import { getMobileUserId } from '@/lib/mobile-auth'
import { computeSm2Update } from '@/lib/flashcards/sm2'
export async function POST(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
const body = await req.json()

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { getMobileUserId } from '@/lib/mobile-auth'
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
const { searchParams } = new URL(req.url)

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { getMobileUserId } from '@/lib/mobile-auth'
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const notebooks = await prisma.notebook.findMany({

View File

@@ -6,7 +6,7 @@ export async function GET(
req: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { id } = await params
@@ -33,7 +33,7 @@ export async function PUT(
req: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { id } = await params
@@ -61,7 +61,7 @@ export async function DELETE(
req: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { id } = await params

View File

@@ -19,7 +19,7 @@ function getTodayContent(title: string): string {
}
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const todayKey = getTodayKey()

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { getMobileUserId } from '@/lib/mobile-auth'
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { searchParams } = new URL(req.url)
@@ -43,7 +43,7 @@ export async function GET(req: NextRequest) {
}
export async function POST(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { title, content, notebookId } = await req.json().catch(() => ({}))

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { getMobileUserId } from '@/lib/mobile-auth'
export async function GET(req: NextRequest) {
const userId = getMobileUserId(req)
const userId = await getMobileUserId(req)
if (!userId) return NextResponse.json({ error: 'Non autorisé' }, { status: 401 })
const { searchParams } = new URL(req.url)

View File

@@ -248,6 +248,9 @@ export class MemoryEchoService {
const note1 = notesWithEmbeddings[i]
const note2 = notesWithEmbeddings[j]
const baseThreshold = this.pairSimilarityThreshold(note1, note2, demoMode)
const adjustedThreshold = baseThreshold + (notePenalty.get(note1.id) || 0) + (notePenalty.get(note2.id) || 0)
// Calculate time difference
const daysApart = Math.abs(
Math.floor((note1.createdAt.getTime() - note2.createdAt.getTime()) / (1000 * 60 * 60 * 24))

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3046,5 +3046,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}

View File

@@ -3007,5 +3007,27 @@
"listView": "List",
"graphAriaLabel": "Semantic network: {clusters} clusters, {notes} notes, {bridges} bridge notes. Switch to List view for accessible navigation.",
"listAriaLabel": "Accessible cluster list with notes and bridge connections"
},
"searchModal": {
"search_ariaLabel": "Search",
"search_placeholder": "Search across all your notes…",
"search_caseSensitive": "Case sensitive",
"search_regexMode": "Regex mode",
"search_trashIncluded": "Trash included",
"search_openInEditor": "Open in editor",
"search_title": "Memento Search",
"search_favorites": "Favorites:",
"search_searching": "Searching…",
"search_noResults": "No results",
"search_typeToSearch": "Type to search",
"search_aiAnalysis": "Analyzing…",
"search_aiResponse": "AI Response",
"search_resultsSummary": "Results summary…",
"search_documentPreview": "Document preview",
"search_noMatch": "No note matches.",
"search_typeForResults": "Type to get instant results.",
"search_hintNavigate": "navigate",
"search_hintOpen": "open",
"search_hintClose": "close"
}
}