Refactoring complet : contenu livre, config unique, routes, admin et light mode

- Source unique : supprime app/data/librodrome.config.yml, renomme site/ en bookplayer.config.yml
- Morceaux : renommés avec slugs lisibles, fichiers audio renommés, inversion ch2↔ch3 corrigée
- Chapitres : 11 fichiers .md réécrits avec le vrai contenu du livre (synthèse fidèle du PDF)
- Routes : /lire → /modele-eco, /ecouter → /en-musique, redirections 301
- Admin chapitres : champs structurés (titre, description, temps lecture), compteur mots
- Éditeur markdown : mode split, plein écran, support Tab, meilleur rendu aperçu
- Admin morceaux : drag & drop, ajout/suppression, gestion playlist
- Light mode : palettes printemps/été plus saturées et contrastées, teintes primary
- Raccourcis clavier player : espace, flèches gauche/droite
- Paroles : toggle supprimé, toujours visibles et scrollables
- Nouvelles pages : autonomie, evenement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-02-26 20:20:52 +01:00
parent 4fce862df6
commit 2f438d9d7a
70 changed files with 2125 additions and 1385 deletions

View File

@@ -0,0 +1,16 @@
import { unlink } from 'node:fs/promises'
import { join } from 'node:path'
export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, 'slug')
if (!slug || !/^[a-z0-9-]+$/.test(slug)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid slug' })
}
const filePath = join(process.cwd(), 'content', 'book', `${slug}.md`)
await unlink(filePath)
return { ok: true }
})

View File

@@ -0,0 +1,29 @@
import { writeFile } from 'node:fs/promises'
import { join } from 'node:path'
export default defineEventHandler(async (event) => {
const body = await readBody<{ slug: string; title: string; order: number }>(event)
if (!body?.slug || !body?.title) {
throw createError({ statusCode: 400, statusMessage: 'Missing slug or title' })
}
if (!/^[a-z0-9-]+$/.test(body.slug)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid slug format' })
}
const filePath = join(process.cwd(), 'content', 'book', `${body.slug}.md`)
const content = `---
title: "${body.title}"
description: ""
order: ${body.order}
readingTime: "5 min"
---
`
await writeFile(filePath, content, 'utf-8')
return { ok: true, slug: body.slug }
})

View File

@@ -0,0 +1,29 @@
import { readFile, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
export default defineEventHandler(async (event) => {
const body = await readBody<{ chapters: { slug: string; order: number }[] }>(event)
if (!body?.chapters || !Array.isArray(body.chapters)) {
throw createError({ statusCode: 400, statusMessage: 'Missing chapters array' })
}
const bookDir = join(process.cwd(), 'content', 'book')
await Promise.all(
body.chapters.map(async ({ slug, order }) => {
const filePath = join(bookDir, `${slug}.md`)
const raw = await readFile(filePath, 'utf-8')
// Replace order in frontmatter
const updated = raw.replace(
/^(---\n[\s\S]*?)order:\s*\d+/,
`$1order: ${order}`,
)
await writeFile(filePath, updated, 'utf-8')
}),
)
return { ok: true }
})

View File

@@ -1,5 +1,5 @@
export default defineEventHandler(async (event) => {
const body = await readBody(event)
await writeYaml('librodrome.config.yml', body)
await writeYaml('bookplayer.config.yml', body)
return { ok: true }
})

View File

@@ -1,3 +1,3 @@
export default defineEventHandler(async () => {
return await readYaml('librodrome.config.yml')
return await readYaml('bookplayer.config.yml')
})