Messages : types, réponses, sauts de ligne, data volume
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- HomeMessages : type pill (Réaction/Question/Suggestion/Retour) + sélecteur dans le formulaire (sans Réaction)
- HomeMessages : white-space: pre-line sur les messages
- Page /messages : type pill + white-space: pre-line (idem home)
- Admin : badge type coloré + sélecteur d'édition + formulaire réponse
- API : type et reply dans PUT ; readDataYaml/writeDataYaml (data/ volume Docker)
- main.css : overrides light mode text-white/55, /75, /90

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-03-19 05:56:11 +01:00
parent c52fa6007d
commit b9e6b4a96c
10 changed files with 314 additions and 48 deletions

View File

@@ -1,8 +1,10 @@
import { readFile, writeFile } from 'node:fs/promises'
import { readFile, writeFile, mkdir } from 'node:fs/promises'
import { existsSync } from 'node:fs'
import { join } from 'node:path'
import yaml from 'yaml'
const dataDir = join(process.cwd(), 'site')
const runtimeDataDir = join(process.cwd(), 'data')
const cache = new Map<string, { data: unknown; mtime: number }>()
@@ -35,3 +37,19 @@ export function invalidateCache(relativePath?: string): void {
cache.clear()
}
}
// Runtime data — stored in data/ (Docker volume, never overwritten by deploys)
export async function readDataYaml<T = unknown>(relativePath: string, defaultValue: T): Promise<T> {
const filePath = join(runtimeDataDir, relativePath)
if (!existsSync(filePath)) return defaultValue
const raw = await readFile(filePath, 'utf-8')
return yaml.parse(raw) as T
}
export async function writeDataYaml(relativePath: string, data: unknown): Promise<void> {
await mkdir(runtimeDataDir, { recursive: true })
const filePath = join(runtimeDataDir, relativePath)
const raw = yaml.stringify(data, { lineWidth: 120 })
await writeFile(filePath, raw, 'utf-8')
}