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:
1 parent
573a2527e5
commit
7da52b6755
6 files changed
+153
-46
No files matched your search
@@ -10,11 +10,11 @@ import (
|
||||
|
||||
func TestCheck(t *testing.T) {
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/@excalidraw/excalidraw/latest" {
|
||||
if r.URL.Path != "/-/package/@excalidraw/excalidraw/dist-tags" {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
_, _ = w.Write([]byte(`{"name":"@excalidraw/excalidraw","version":"0.19.0"}`))
|
||||
_, _ = w.Write([]byte(`{"latest":"0.19.0","next":"0.19.0-abc1234","rc":"0.19.0-rc.1"}`))
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
@@ -23,9 +23,13 @@ func TestCheck(t *testing.T) {
|
||||
t.Fatalf("avant vérification : %+v", s)
|
||||
}
|
||||
c.check(context.Background())
|
||||
if s := c.Status(); s.Latest != "0.19.0" || s.CheckedAt == nil {
|
||||
s := c.Status()
|
||||
if s.Latest != "0.19.0" || s.Tags["next"] != "0.19.0-abc1234" || s.CheckedAt == nil {
|
||||
t.Fatalf("après vérification : %+v", s)
|
||||
}
|
||||
if _, ok := s.Tags["rc"]; ok {
|
||||
t.Fatalf("canal non proposé exposé : %+v", s.Tags)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckKeepsLastValueOnError(t *testing.T) {
|
||||
@@ -35,7 +39,7 @@ func TestCheckKeepsLastValueOnError(t *testing.T) {
|
||||
http.Error(w, "panne", http.StatusBadGateway)
|
||||
return
|
||||
}
|
||||
_, _ = w.Write([]byte(`{"version":"0.18.2"}`))
|
||||
_, _ = w.Write([]byte(`{"latest":"0.18.2"}`))
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
|
||||
Reference in new issue
Block a user