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

+11 -3
View File
@@ -11,7 +11,7 @@
// DELETE /api/entry?path=x[&recursive=true] mise à la corbeille
// GET /api/thumb?path=x / PUT (image/png) miniature d'un schéma
// GET /api/library / PUT /api/library bibliothèque Excalidraw
// GET /api/settings / PUT {"title":"..."} personnalisation (titre, logo)
// GET /api/settings / PUT {"title","channel"} paramètres (titre, logo, canal)
// GET /api/logo / PUT (image/png) / DELETE logo 64x64
// GET /api/update dernière version d'Excalidraw sur npm
package api
@@ -303,8 +303,10 @@ func (h *Handler) readSettings(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, st)
}
// settingsReq : seuls les champs présents sont modifiés.
type settingsReq struct {
Title string `json:"title"`
Title *string `json:"title"`
Channel *string `json:"channel"`
}
func (h *Handler) writeSettings(w http.ResponseWriter, r *http.Request) {
@@ -312,7 +314,13 @@ func (h *Handler) writeSettings(w http.ResponseWriter, r *http.Request) {
if !h.decode(w, r, &req) {
return
}
st, err := h.Store.WriteTitle(req.Title)
st, err := h.Store.ReadSettings()
if err == nil && req.Title != nil {
st, err = h.Store.WriteTitle(*req.Title)
}
if err == nil && req.Channel != nil {
st, err = h.Store.WriteChannel(*req.Channel)
}
if err != nil {
fail(w, err)
return