Serveur : canal d'Excalidraw suivi (latest/next) dans les paramètres

- Lecture des dist-tags npm (latest, next) en une requête ; /api/update
  expose tags{latest,next} (latest conservé pour compatibilité).
- Paramètre channel (latest par défaut) dans DATA_DIR/.settings.json,
  modifiable par PUT /api/settings {"channel":...} ; titre et canal sont
  mis à jour indépendamment, sous verrou.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019EuvvuTv7AUc8ksDHv8VKx
This commit is contained in:
claude BotandClaude Opus 5.5 committed 2026-10-07 16:00:43 +02:00
1 parent 573a2527e5
commit 7da52b6755
6 files changed
+153 -46

No files matched your search

+22 -1
View File
@@ -21,7 +21,7 @@ func encodePNG(t *testing.T, img image.Image) []byte {
func TestTitle(t *testing.T) {
s := newStore(t)
if st, err := s.ReadSettings(); err != nil || st != (Settings{}) {
if st, err := s.ReadSettings(); err != nil || st != (Settings{Channel: DefaultChannel}) {
t.Fatalf("défauts : %+v, %v", st, err)
}
st, err := s.WriteTitle(" Schémas vLab ")
@@ -42,6 +42,27 @@ func TestTitle(t *testing.T) {
}
}
func TestChannel(t *testing.T) {
s := newStore(t)
if _, err := s.WriteTitle("Titre"); err != nil {
t.Fatal(err)
}
st, err := s.WriteChannel("next")
if err != nil || st.Channel != "next" || st.Title != "Titre" {
t.Fatalf("canal : %+v, %v", st, err)
}
// Changer le titre conserve le canal, et inversement.
if st, _ := s.WriteTitle("Autre"); st.Channel != "next" {
t.Fatalf("canal perdu : %+v", st)
}
if _, err := s.WriteChannel("rc"); !errors.Is(err, ErrInvalidPath) {
t.Fatalf("canal invalide accepté : %v", err)
}
if st, _ := s.ReadSettings(); st.Channel != "next" || st.Title != "Autre" {
t.Fatalf("relu : %+v", st)
}
}
func TestLogo(t *testing.T) {
s := newStore(t)
if _, err := s.ReadLogo(); !errors.Is(err, ErrNotFound) {