fix(ci): bump Node to 22 for node:sqlite, move SonarQube off the deploy pipeline #1
@@ -380,6 +380,8 @@ npm run test # tous les tests passent
|
||||
|
||||
Husky lance ces vérifications automatiquement — un commit échoue si l'une d'elles échoue.
|
||||
|
||||
verifie que le code ne contient pas d'érreur sur le sonarqube de dev (http://localhost:9000) avec le token suivant : squ_bc83f67e11ee5a4fd3c86ad19281e0c159062846
|
||||
|
||||
### Format du message de commit
|
||||
|
||||
```
|
||||
|
||||
Generated
+7
-16
@@ -58,6 +58,9 @@
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^8.3.4",
|
||||
"vitest": "^5.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=24.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@adobe/css-tools": {
|
||||
@@ -7037,18 +7040,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/image-size": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.2.1.tgz",
|
||||
"integrity": "sha512-rH+46sQJ2dlwfjfhCyNx5thzrv+dtmBIhPHk0zgRUukHzZ/kRueTJXoYYsclBaKcSMBWuGbOFXtioLpzTb5euw==",
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/image-size/-/image-size-2.0.4.tgz",
|
||||
"integrity": "sha512-QRUkFFsRV/6fuESxb9Vkq+a0LkSrgKXuc2NEqfikiXxxN/G3tjWt5EVUlMaImRBZRZK/jRBEbYvpPYZL8t08Zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"queue": "6.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"image-size": "bin/image-size.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.x"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/immediate": {
|
||||
@@ -9651,15 +9651,6 @@
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/queue": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
|
||||
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"inherits": "~2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/quick-lru": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
"test:e2e": "npm run build && playwright test",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"overrides": {
|
||||
"pptxgenjs": {
|
||||
"image-size": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": [
|
||||
"node node_modules/eslint/bin/eslint.js --fix",
|
||||
|
||||
@@ -27,8 +27,12 @@ markdown. Tableau source :\n${JSON.stringify(texts)}`
|
||||
choices?: { message: { content?: string } }[]
|
||||
}
|
||||
const content: string = data.choices?.[0]?.message.content ?? '[]'
|
||||
const jsonMatch = content.match(/\[[\s\S]*\]/)
|
||||
const parsed: unknown = JSON.parse(jsonMatch ? jsonMatch[0] : content)
|
||||
// Extrait le tableau JSON borne par le premier "[" et le dernier "]" sans regex gourmande
|
||||
// (evite tout risque de backtracking superlineaire sur une reponse LLM de taille arbitraire).
|
||||
const start = content.indexOf('[')
|
||||
const end = content.lastIndexOf(']')
|
||||
const jsonSlice = start !== -1 && end > start ? content.slice(start, end + 1) : content
|
||||
const parsed: unknown = JSON.parse(jsonSlice)
|
||||
if (!Array.isArray(parsed)) throw new Error('Reponse de traduction invalide')
|
||||
return parsed.map((item) => String(item))
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { randomUUID } from 'crypto'
|
||||
import { BrowserWindow, ipcMain, type IpcMainEvent } from 'electron'
|
||||
import { join } from 'path'
|
||||
import { is } from '@electron-toolkit/utils'
|
||||
@@ -63,29 +64,25 @@ export async function openDrawingWindow(
|
||||
}
|
||||
|
||||
/**
|
||||
* Revele une forme dans la fenetre deja ouverte, avec un audio optionnel (narration pas-a-pas).
|
||||
* Attend l'accuse de reception du renderer (forme dessinee + audio termine) avant de se resoudre,
|
||||
* pour que draw_schema puisse enchainer les formes au rythme de la narration.
|
||||
* Attend un accuse de reception a usage unique du renderer (evenement `ackEvent` portant le meme
|
||||
* `requestId` que celui envoye), avec expiration et nettoyage si la fenetre se ferme entre-temps.
|
||||
* Factorise le boilerplate partage par revealShape() et playCaption().
|
||||
*/
|
||||
export function revealShape(
|
||||
shape: DrawShape,
|
||||
audio: ArrayBuffer | null,
|
||||
timeoutMs = 20000
|
||||
function waitForAck(
|
||||
window: BrowserWindow,
|
||||
ackEvent: string,
|
||||
timeoutMs: number,
|
||||
send: (requestId: string) => void
|
||||
): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
if (!win || win.isDestroyed()) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
const window = win
|
||||
const requestId = Math.random().toString(36).slice(2)
|
||||
const requestId = randomUUID()
|
||||
|
||||
let settled = false
|
||||
const finish = (): void => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
clearTimeout(timeout)
|
||||
ipcMain.removeListener('shape-reveal-done', handler)
|
||||
ipcMain.removeListener(ackEvent, handler)
|
||||
resolve()
|
||||
}
|
||||
|
||||
@@ -95,9 +92,26 @@ export function revealShape(
|
||||
if (id !== requestId) return
|
||||
finish()
|
||||
}
|
||||
ipcMain.on('shape-reveal-done', handler)
|
||||
ipcMain.on(ackEvent, handler)
|
||||
window.once('closed', finish)
|
||||
|
||||
send(requestId)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Revele une forme dans la fenetre deja ouverte, avec un audio optionnel (narration pas-a-pas).
|
||||
* Attend l'accuse de reception du renderer (forme dessinee + audio termine) avant de se resoudre,
|
||||
* pour que draw_schema puisse enchainer les formes au rythme de la narration.
|
||||
*/
|
||||
export function revealShape(
|
||||
shape: DrawShape,
|
||||
audio: ArrayBuffer | null,
|
||||
timeoutMs = 20000
|
||||
): Promise<void> {
|
||||
if (!win || win.isDestroyed()) return Promise.resolve()
|
||||
const window = win
|
||||
return waitForAck(window, 'shape-reveal-done', timeoutMs, (requestId) => {
|
||||
window.webContents.send('reveal-shape', { requestId, shape, audio })
|
||||
})
|
||||
}
|
||||
@@ -112,7 +126,7 @@ export async function renderMermaid(title: string, mermaidCode: string): Promise
|
||||
await ready
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestId = Math.random().toString(36).slice(2)
|
||||
const requestId = randomUUID()
|
||||
function handler(_event: IpcMainEvent, id: string, ok: boolean, error?: string): void {
|
||||
if (id !== requestId) return
|
||||
ipcMain.removeListener('mermaid-render-done', handler)
|
||||
@@ -126,29 +140,9 @@ export async function renderMermaid(title: string, mermaidCode: string): Promise
|
||||
|
||||
/** Joue une legende audio seule (sans forme associee), pour la narration sequencee de Mermaid. */
|
||||
export function playCaption(audio: ArrayBuffer, timeoutMs = 20000): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
if (!win || win.isDestroyed()) {
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
const window = win
|
||||
const requestId = Math.random().toString(36).slice(2)
|
||||
|
||||
let settled = false
|
||||
const finish = (): void => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
clearTimeout(timeout)
|
||||
ipcMain.removeListener('caption-done', handler)
|
||||
resolve()
|
||||
}
|
||||
const timeout = setTimeout(finish, timeoutMs)
|
||||
function handler(_event: IpcMainEvent, id: string): void {
|
||||
if (id !== requestId) return
|
||||
finish()
|
||||
}
|
||||
ipcMain.on('caption-done', handler)
|
||||
window.once('closed', finish)
|
||||
if (!win || win.isDestroyed()) return Promise.resolve()
|
||||
const window = win
|
||||
return waitForAck(window, 'caption-done', timeoutMs, (requestId) => {
|
||||
window.webContents.send('play-caption', { requestId, audio })
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { randomUUID } from 'crypto'
|
||||
import { BrowserWindow, ipcMain, type IpcMainEvent } from 'electron'
|
||||
import { join } from 'path'
|
||||
import { is } from '@electron-toolkit/utils'
|
||||
@@ -65,7 +66,7 @@ export function requestWrittenAnswers(
|
||||
window.show()
|
||||
window.moveTop()
|
||||
window.focus()
|
||||
const requestId = Math.random().toString(36).slice(2)
|
||||
const requestId = randomUUID()
|
||||
const items: ExerciseFormItem[] = questions.map((q, index) => ({
|
||||
id: String(index),
|
||||
question: q.question,
|
||||
|
||||
@@ -64,7 +64,7 @@ export function getRecentCaptures(count: number): string[] {
|
||||
if (!existsSync(dir)) return []
|
||||
return readdirSync(dir)
|
||||
.filter((f: string) => f.endsWith('.png'))
|
||||
.sort()
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.slice(-count)
|
||||
.map((f: string) => join(dir, f))
|
||||
}
|
||||
|
||||
@@ -18,8 +18,14 @@ const PROTECTED_PATHS = new Set(
|
||||
)
|
||||
)
|
||||
|
||||
function stripTrailingSlashes(value: string): string {
|
||||
let end = value.length
|
||||
while (end > 0 && (value[end - 1] === '\\' || value[end - 1] === '/')) end--
|
||||
return value.slice(0, end)
|
||||
}
|
||||
|
||||
function isProtected(path: string): boolean {
|
||||
const normalized = path.toLowerCase().replace(/[\\/]+$/, '')
|
||||
const normalized = stripTrailingSlashes(path.toLowerCase())
|
||||
if (PROTECTED_PATHS.has(normalized)) return true
|
||||
// Racine de disque (ex: "C:" ou "C:\\")
|
||||
if (/^[a-z]:\\?$/i.test(path)) return true
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { randomUUID } from 'crypto'
|
||||
import { ipcMain, type BrowserWindow, type IpcMainEvent } from 'electron'
|
||||
|
||||
let mainWindow: BrowserWindow | null = null
|
||||
@@ -22,7 +23,7 @@ export function requestCameraFrame(timeoutMs = 10000): Promise<string> {
|
||||
return
|
||||
}
|
||||
|
||||
const requestId = Math.random().toString(36).slice(2)
|
||||
const requestId = randomUUID()
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
ipcMain.removeListener('camera-frame-result', handler)
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Forge Avatar</title>
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
|
||||
style-src garde 'unsafe-inline' car React (style={{...}}) et les libs de rendu
|
||||
(mermaid, roughjs) ecrivent des styles via l'attribut style ; script-src, en
|
||||
revanche, reste strictement 'self' (ni 'unsafe-inline' ni 'unsafe-eval'), ce qui
|
||||
est la protection qui compte reellement contre l'injection de script. -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self' blob: data:; worker-src 'self' blob:; media-src 'self' blob:"
|
||||
|
||||
@@ -121,7 +121,10 @@ function App(): React.JSX.Element {
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
<div // NOSONAR : surface de deplacement de toute la fenetre (barre de titre custom), pas un
|
||||
// controle discret activable au clavier (aucun geste clavier n'equivaut a "glisser la
|
||||
// fenetre") ; ajouter tabIndex/onKeyDown romprait l'ordre de tabulation sans apporter de
|
||||
// vraie equivalence clavier.
|
||||
style={{ width: '100%', height: '100%', cursor: 'grab', position: 'relative' }}
|
||||
onMouseDown={handleMouseDown}
|
||||
onContextMenu={onContextMenu}
|
||||
|
||||
Reference in New Issue
Block a user