commit 56e1bbe84227810a614132f4270b9b76ba7d4e9d Author: Cédric Date: Mon Nov 23 08:37:40 2026 +0100 Stackwatch : suivi des mises à jour de stacks docker compose via SSH Base Up And Down (auth, thème, dialogues) + moteur fleet (script distant POSIX, analyse pull + comparaison d'images, mise à jour d'une stack), interface de suivi. Co-Authored-By: Claude Sonnet 5.5 diff --git a/.claude/launch.json b/.claude/launch.json new file mode 100644 index 0000000..0b09430 --- /dev/null +++ b/.claude/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.0.1", + "configurations": [ + { + "name": "stackwatch-demo", + "runtimeExecutable": "sh", + "runtimeArgs": ["dev/demo.sh", "8099"], + "port": 8099 + } + ] +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5757fc1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +**/node_modules +web/dist +data +demo +bin +.git +.claude diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5b3684b --- /dev/null +++ b/.env.example @@ -0,0 +1,23 @@ +STACKWATCH_PORT=8080 +# local, oidc, both ou none +AUTH_MODE=local +ADMIN_USER= +ADMIN_PASSWORD= +# closed, approval ou open +REGISTRATION=closed +OIDC_ISSUER= +OIDC_CLIENT_ID= +OIDC_CLIENT_SECRET= +OIDC_REDIRECT_URL= +OIDC_SCOPES=openid profile email groups +OIDC_GROUPS_CLAIM=groups +OIDC_LOGOUT=true +OIDC_NAME=SSO +OIDC_ALLOWED_GROUPS= +OIDC_ADMIN_GROUPS= +OIDC_ADMIN_EMAILS= +SESSION_SECRET= +PUBLIC_URL= +TITLE=Stackwatch +CHECK_INTERVAL=6h +MAX_PARALLEL=4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd9f81c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/data/ +/bin/ +/demo/.state/ +web/dist/* +!web/dist/.gitkeep +frontend/node_modules/ +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9302553 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# syntax=docker/dockerfile:1 + +# --- 1. Frontend : React + Vite -> /src/web/dist +FROM node:22-alpine AS frontend +WORKDIR /src/frontend +COPY frontend/package.json frontend/package-lock.json ./ +RUN --mount=type=cache,target=/root/.npm npm ci --no-audit --no-fund +COPY frontend/ ./ +RUN npm run build + +# --- 2. Backend : binaire Go statique embarquant le frontend +FROM golang:1.24-alpine AS backend +ARG VERSION=dev +WORKDIR /src +COPY go.mod ./ +COPY cmd ./cmd +COPY internal ./internal +COPY web/embed.go ./web/ +COPY --from=frontend /src/web/dist ./web/dist +RUN --mount=type=cache,target=/root/.cache/go-build \ + CGO_ENABLED=0 go test ./... && \ + CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o /out/server ./cmd/server + +# --- 3. Image finale : alpine + client ssh (les serveurs sont joints avec `ssh`), non-root (uid 65532) +FROM alpine:3.21 +RUN apk add --no-cache openssh-client-default && \ + adduser -D -u 65532 -h /data nonroot && mkdir -p /data && chown 65532:65532 /data +COPY --from=backend /out/server /server +ENV LISTEN_ADDR=:8080 DATA_DIR=/data HOME=/data +VOLUME ["/data"] +EXPOSE 8080 +USER nonroot:nonroot +HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["/server", "healthcheck"] +ENTRYPOINT ["/server"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0612a10 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 vLab-BZH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE.fr.md b/LICENSE.fr.md new file mode 100644 index 0000000..1d18e7c --- /dev/null +++ b/LICENSE.fr.md @@ -0,0 +1,26 @@ +# Licence MIT (traduction française) + +> Traduction fournie à titre informatif. Seule la version anglaise du fichier [`LICENSE`](LICENSE) fait foi. + +```text +Copyright (c) 2026 vLab-BZH + +L'autorisation est accordée, gracieusement, à toute personne obtenant une copie +de ce logiciel et des fichiers de documentation associés (le « Logiciel »), de +commercialiser le Logiciel sans restriction, notamment les droits d'utiliser, +de copier, de modifier, de fusionner, de publier, de distribuer, de +sous-licencier et/ou de vendre des copies du Logiciel, ainsi que d'autoriser +les personnes auxquelles le Logiciel est fourni à le faire, sous réserve des +conditions suivantes : + +La déclaration de copyright ci-dessus et la présente autorisation doivent être +incluses dans toutes copies ou parties substantielles du Logiciel. + +LE LOGICIEL EST FOURNI « TEL QUEL », SANS GARANTIE D'AUCUNE SORTE, EXPLICITE OU +IMPLICITE, NOTAMMENT SANS GARANTIE DE QUALITÉ MARCHANDE, D'ADÉQUATION À UN +USAGE PARTICULIER ET D'ABSENCE DE CONTREFAÇON. EN AUCUN CAS LES AUTEURS OU +TITULAIRES DU DROIT D'AUTEUR NE SERONT RESPONSABLES DE TOUT DOMMAGE, +RÉCLAMATION OU AUTRE RESPONSABILITÉ, QUE CE SOIT DANS LE CADRE D'UN CONTRAT, +D'UN DÉLIT OU AUTRE, EN PROVENANCE DE, CONSÉCUTIF À OU EN RELATION AVEC LE +LOGICIEL OU SON UTILISATION, OU AVEC D'AUTRES ÉLÉMENTS DU LOGICIEL. +``` diff --git a/README.md b/README.md new file mode 100644 index 0000000..760fc24 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# Stackwatch + +Suivi des mises à jour des stacks **docker compose** de plusieurs serveurs, joints en SSH. +Même interface et même authentification qu'[Up And Down](../upandown) (local, OIDC ou reverse proxy). + +## Principe + +- Une liste de **serveurs** (hôte, port). Chaque serveur a une ou plusieurs **connexions** : + un **utilisateur SSH** et des **racines** à parcourir (`/home`, ou `/home/alice` pour des + stacks qui n'ont que les droits d'alice), avec une profondeur (1 : `racine/`). +- Pour chaque stack trouvée (`compose.yaml`, `compose.yml`, `docker-compose.yaml|yml`) : + `docker compose pull` (les conteneurs ne sont pas touchés) puis comparaison de l'image en + cours et de l'image tirée, service par service. Même logique que `update-stacks.sh`. +- Statuts : **À jour**, **Mise à jour** (au moins une image plus récente), **Arrêtée**, **Erreur** + (fichier invalide, pull refusé...). Les répertoires cachés et `node_modules` sont ignorés. +- Bouton **Mettre à jour** (administrateurs, après confirmation) : `pull`, `down`, `up -d` de la stack. +- Analyse automatique toutes les `CHECK_INTERVAL` (6 h par défaut), ou à la demande + (par stack, connexion, serveur, ou **Tout vérifier**). + +## Connexion SSH + +Stackwatch utilise le client `ssh` du système avec une clé ed25519 dédiée, créée au premier +démarrage dans `DATA_DIR/ssh/` (ou `SSH_KEY_FILE`). La clé publique est affichée dans +l'interface (**Clé SSH**) : l'ajouter à `~/.ssh/authorized_keys` de chaque utilisateur déclaré. +Les clés d'hôte sont enregistrées à la première connexion (`known_hosts` dans `DATA_DIR/ssh/`) +puis vérifiées. Les utilisateurs doivent pouvoir utiliser docker (groupe `docker` ou rootless). +Le bouton **Tester la connexion** du dialogue serveur vérifie SSH, docker et docker compose v2. + +## Configuration + +Voir `docker-compose.yml` et `.env.example`. Variables propres à Stackwatch : +`CHECK_INTERVAL` (`6h`, minimum `5m`, `0` : désactivée), `MAX_PARALLEL` (connexions analysées +en parallèle, 4), `SSH_KEY_FILE`, `SSH_KNOWN_HOSTS`, `SSH_CONNECT_TIMEOUT` (10 s), `TITLE`. +Authentification : `AUTH_MODE`, `ADMIN_USER`, `ADMIN_PASSWORD`, `OIDC_*` comme Up And Down. +Les utilisateurs simples consultent et lancent des analyses ; les administrateurs gèrent les +serveurs et les mises à jour. + +## Données (`DATA_DIR`) + +`fleet/servers.json` (serveurs), `fleet/state.json` (derniers résultats), `ssh/` (clé et +known_hosts), comptes et secrets de session. + +## Build + +```bash +cd frontend && npm ci && npm run build # sortie dans web/dist (embarquée) +touch ../web/dist/.gitkeep +cd .. && go test ./... && go build -o bin/stackwatch ./cmd/server +# ou : docker compose build +``` + +## Démo locale + +`sh demo/demo.sh 8099` lance le binaire avec un faux `ssh` (exécution locale) et un faux +`docker` (stacks à jour, en retard, arrêtée, en erreur) : aucun serveur réel nécessaire. + +## API + +Voir l'en-tête de `internal/api/api.go`. `GET /api/summary` donne les compteurs +(stacks, mises à jour, erreurs) pour une supervision. diff --git a/cmd/server/main.go b/cmd/server/main.go new file mode 100644 index 0000000..c528f2d --- /dev/null +++ b/cmd/server/main.go @@ -0,0 +1,402 @@ +// Commande server : suivi des mises à jour de stacks docker compose (SSH) + frontend embarqué. +package main + +import ( + "context" + "errors" + "fmt" + "io/fs" + "log/slog" + "net" + "net/http" + "net/url" + "os" + "os/signal" + "path" + "path/filepath" + "strconv" + "strings" + "syscall" + "time" + + "github.com/vblogio/stackwatch/internal/api" + "github.com/vblogio/stackwatch/internal/auth" + "github.com/vblogio/stackwatch/internal/fleet" + "github.com/vblogio/stackwatch/web" +) + +// version est renseignée au build (-ldflags "-X main.version=..."). +var version = "dev" + +func env(key, def string) string { + if v := os.Getenv(key); v != "" { + return v + } + return def +} + +// envBool lit un booléen ; une valeur illisible est une erreur de configuration. +func envBool(key string, def bool) bool { + v := os.Getenv(key) + if v == "" { + return def + } + b, err := strconv.ParseBool(v) + if err != nil { + fatal(key + " invalide (true ou false)") + } + return b +} + +func envInt(key string, def int64) int64 { + v := os.Getenv(key) + if v == "" { + return def + } + n, err := strconv.ParseInt(v, 10, 64) + if err != nil || n < 0 { + fatal(key + " invalide (entier >= 0)") + } + return n +} + +func fatal(msg string, args ...any) { + slog.Error(msg, args...) + os.Exit(1) +} + +// secretEnv lit un secret dans NAME, ou dans le fichier NAME_FILE (secrets Docker). +func secretEnv(name string) string { + if v := os.Getenv(name); v != "" { + return v + } + if f := os.Getenv(name + "_FILE"); f != "" { + b, err := os.ReadFile(f) + if err != nil { + fatal(name+"_FILE illisible", "err", err) + } + return strings.TrimSpace(string(b)) + } + return "" +} + +func main() { + slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, nil))) + + addr := env("LISTEN_ADDR", ":8080") + // `server healthcheck` : sonde pour le conteneur. + if len(os.Args) > 1 && os.Args[1] == "healthcheck" { + os.Exit(healthcheck(addr)) + } + dataDir := env("DATA_DIR", "./data") + if err := os.MkdirAll(dataDir, 0o700); err != nil { + fatal("répertoire de données", "dir", dataDir, "err", err) + } + + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) + defer stop() + + // Clé SSH : SSH_KEY_FILE, ou une clé ed25519 créée dans DATA_DIR/ssh au premier démarrage. + keyFile, pub, err := fleet.EnsureKey(filepath.Join(dataDir, "ssh"), os.Getenv("SSH_KEY_FILE")) + if err != nil { + fatal("clé SSH", "err", err) + } + runner := fleet.SSH{KeyFile: keyFile, KnownHosts: env("SSH_KNOWN_HOSTS", filepath.Join(dataDir, "ssh", "known_hosts")), + Timeout: int(envInt("SSH_CONNECT_TIMEOUT", 10))} + manager, err := fleet.Open(ctx, filepath.Join(dataDir, "fleet"), runner, int(envInt("MAX_PARALLEL", 4))) + if err != nil { + fatal("serveurs", "err", err) + } + interval, err := time.ParseDuration(env("CHECK_INTERVAL", "6h")) + if err != nil || interval < 0 || (interval > 0 && interval < 5*time.Minute) { + fatal("CHECK_INTERVAL invalide (ex. 6h, minimum 5m, 0 : pas d'analyse automatique)") + } + manager.Interval = interval + go manager.Run(ctx) + + mode := strings.ToLower(env("AUTH_MODE", "local")) + handler := (&api.Handler{Fleet: manager, Mode: mode, Version: version, Title: env("TITLE", "Stackwatch"), + PublicKey: pub, Interval: interval}).Init() + mux := http.NewServeMux() + var root http.Handler = mux + + switch mode { + case "none": + // Aucune authentification intégrée (reverse proxy avec SSO, usage local). + slog.Warn("aucune authentification intégrée (AUTH_MODE=none) : à réserver à un reverse proxy qui authentifie") + case "local", "oidc", "both": + accounts, err := auth.OpenAccounts(dataDir) + if err != nil { + fatal("comptes", "err", err) + } + handler.Accounts = accounts + a, err := authentication(ctx, mode, dataDir, accounts, handler) + if err != nil { + fatal("authentification", "err", err) + } + a.Register(mux) + handler.Auth = a + root = a.Middleware(mux, public) + default: + fatal(fmt.Sprintf("AUTH_MODE %q inconnu (local, oidc, both ou none)", mode)) + } + + handler.Register(mux) + mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write([]byte("ok")) }) + mux.Handle("/", spa()) + + srv := &http.Server{ + Addr: addr, + Handler: logRequests(securityHeaders(sameOrigin(root))), + ReadHeaderTimeout: 10 * time.Second, + IdleTimeout: 120 * time.Second, + } + go func() { + slog.Info("démarrage", "addr", addr, "data", dataDir, "auth", mode, "version", version, "check_interval", interval.String()) + if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { + fatal("serveur", "err", err) + } + }() + <-ctx.Done() + shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + _ = srv.Shutdown(shutdownCtx) + slog.Info("arrêt") +} + +// authentication prépare l'authentification locale (comptes, inscription) et/ou OIDC. +func authentication(ctx context.Context, mode, dataDir string, accounts *auth.Accounts, h *api.Handler) (*auth.Auth, error) { + secret, err := auth.LoadSecret(os.Getenv("SESSION_SECRET"), dataDir) + if err != nil { + return nil, err + } + ttl, err := time.ParseDuration(env("SESSION_TTL", "24h")) + if err != nil || ttl < 5*time.Minute { + return nil, errors.New("SESSION_TTL invalide (ex. 24h, minimum 5m)") + } + registration := strings.ToLower(env("REGISTRATION", "closed")) + if registration != "closed" && registration != "approval" && registration != "open" { + return nil, errors.New("REGISTRATION invalide (closed, approval ou open)") + } + pub := publicURL() + secureCookies := strings.HasPrefix(pub, "https://") || strings.HasPrefix(os.Getenv("OIDC_REDIRECT_URL"), "https://") + sessions := auth.NewSessions(secret, ttl, secureCookies) + + a := auth.New(&auth.Auth{ + Accounts: accounts, + Sessions: sessions, + Local: mode == "local" || mode == "both", + Registration: func() string { return registration }, + OIDCName: env("OIDC_NAME", "SSO"), + }) + h.OIDCName = a.OIDCName + + if a.Local { + if user := os.Getenv("ADMIN_USER"); user != "" { + pass := secretEnv("ADMIN_PASSWORD") + if pass == "" { + return nil, errors.New("ADMIN_USER défini sans ADMIN_PASSWORD") + } + if err := accounts.EnsureAdmin(user, pass); err != nil { + return nil, fmt.Errorf("administrateur initial : %w", err) + } + } + if accounts.NeedsSetup() { + slog.Warn("aucun administrateur : le premier compte créé (inscription) le deviendra ; définir ADMIN_USER et ADMIN_PASSWORD pour l'imposer") + } + } + if mode == "local" { + return a, nil + } + + // OIDC + cfg, err := oidcConfig(secret, ttl) + if err != nil { + return nil, err + } + cfg.Sessions = sessions + policy := auth.OIDCPolicy{AdminGroups: fields(os.Getenv("OIDC_ADMIN_GROUPS")), AdminEmails: fields(os.Getenv("OIDC_ADMIN_EMAILS"))} + cfg.Provision = func(u auth.User, groups []string) (auth.User, error) { + return accounts.UpsertOIDC(u, groups, policy) + } + o, err := auth.NewOIDC(ctx, cfg) + if err != nil { + return nil, err + } + a.OIDC = o + slog.Info("authentification OIDC activée", "issuer", cfg.Issuer, "client_id", cfg.ClientID, + "groups", cfg.AllowedGroups, "admin_groups", policy.AdminGroups, "session_ttl", ttl.String()) + return a, nil +} + +// publicURL est l'origine publique du service : PUBLIC_URL, sinon celle de +// OIDC_REDIRECT_URL ; vide, elle est déduite de chaque requête. +func publicURL() string { + if v := os.Getenv("PUBLIC_URL"); v != "" { + return strings.TrimRight(v, "/") + } + if u, err := url.Parse(os.Getenv("OIDC_REDIRECT_URL")); err == nil && u.Scheme != "" && u.Host != "" { + return u.Scheme + "://" + u.Host + } + return "" +} + +// oidcConfig lit les variables OIDC_*. +func oidcConfig(secret []byte, ttl time.Duration) (auth.Config, error) { + cfg := auth.Config{ + Issuer: os.Getenv("OIDC_ISSUER"), + ClientID: os.Getenv("OIDC_CLIENT_ID"), + ClientSecret: secretEnv("OIDC_CLIENT_SECRET"), + RedirectURL: os.Getenv("OIDC_REDIRECT_URL"), + Scopes: fields(env("OIDC_SCOPES", "openid profile email groups")), + GroupsClaim: env("OIDC_GROUPS_CLAIM", "groups"), + SessionTTL: ttl, + Secret: secret, + } + cfg.AllowedGroups = fields(os.Getenv("OIDC_ALLOWED_GROUPS")) + var err error + if cfg.EndSession, err = strconv.ParseBool(env("OIDC_LOGOUT", "true")); err != nil { + return cfg, errors.New("OIDC_LOGOUT invalide (true ou false)") + } + return cfg, nil +} + +// fields découpe une liste séparée par des espaces ou des virgules. +func fields(s string) []string { + return strings.FieldsFunc(s, func(r rune) bool { return r == ' ' || r == ',' }) +} + +func healthcheck(addr string) int { + host, port, err := net.SplitHostPort(addr) + if err != nil { + return 1 + } + if host == "" || host == "0.0.0.0" || host == "::" { + host = "127.0.0.1" + } + c := http.Client{Timeout: 3 * time.Second} + res, err := c.Get("http://" + net.JoinHostPort(host, port) + "/healthz") + if err != nil { + return 1 + } + res.Body.Close() + if res.StatusCode != http.StatusOK { + return 1 + } + return 0 +} + +// spa sert le build Vite embarqué ; toute route inconnue renvoie index.html. +func spa() http.Handler { + dist, _ := fs.Sub(web.Dist, "dist") + files := http.FileServerFS(dist) + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + p := path.Clean(r.URL.Path) + if p != "/" { + if fi, err := fs.Stat(dist, p[1:]); err == nil && !fi.IsDir() { + // Les assets Vite sont nommés par empreinte : cache long. + if path.Dir(p) == "/assets" { + w.Header().Set("Cache-Control", "public, max-age=31536000, immutable") + } + files.ServeHTTP(w, r) + return + } + } + index, err := fs.ReadFile(dist, "index.html") + if err != nil { + http.Error(w, "frontend absent : lancer `npm run build` dans frontend/", http.StatusNotFound) + return + } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.Header().Set("Cache-Control", "no-cache") + _, _ = w.Write(index) + }) +} + +// public indique les chemins servis sans session : sonde, état de la connexion +// (/api/me : page de connexion) et fichiers statiques du build (code de +// l'application, sans aucune donnée). +func public(p string) bool { + switch { + case p == "/healthz", p == "/api/me": + return true + case strings.HasPrefix(p, "/api/"), p == "/", p == "/index.html": + return false + } + dist, _ := fs.Sub(web.Dist, "dist") + fi, err := fs.Stat(dist, strings.TrimPrefix(path.Clean(p), "/")) + return err == nil && !fi.IsDir() +} + +// sameOrigin refuse les requêtes qui modifient des données et viennent d'un +// autre site (CSRF) : l'en-tête Origin d'une requête de navigateur doit +// désigner l'hôte du service. Les requêtes sans Origin (curl, jetons d'API) +// ne sont pas concernées. +func sameOrigin(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet, http.MethodHead, http.MethodOptions: + default: + if r.Header.Get("Sec-Fetch-Site") == "cross-site" { + http.Error(w, "origine refusée", http.StatusForbidden) + return + } + if o := r.Header.Get("Origin"); o != "" && o != "null" { + host := r.Host + if h := r.Header.Get("X-Forwarded-Host"); h != "" { + host, _, _ = strings.Cut(h, ",") + host = strings.TrimSpace(host) + } + if u, err := url.Parse(o); err != nil || !strings.EqualFold(u.Host, host) { + http.Error(w, "origine refusée", http.StatusForbidden) + return + } + } + } + next.ServeHTTP(w, r) + }) +} + +func securityHeaders(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + h := w.Header() + h.Set("X-Content-Type-Options", "nosniff") + h.Set("Referrer-Policy", "same-origin") + h.Set("X-Frame-Options", "SAMEORIGIN") + h.Set("X-Robots-Tag", "noindex, nofollow") + next.ServeHTTP(w, r) + }) +} + +type statusWriter struct { + http.ResponseWriter + status int +} + +func (s *statusWriter) WriteHeader(code int) { + s.status = code + s.ResponseWriter.WriteHeader(code) +} + +// Unwrap permet à http.ResponseController (Flush, SetWriteDeadline) d'atteindre +// l'écrivain d'origine. +func (s *statusWriter) Unwrap() http.ResponseWriter { return s.ResponseWriter } + +func (s *statusWriter) Flush() { + if f, ok := s.ResponseWriter.(http.Flusher); ok { + f.Flush() + } +} + +func logRequests(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + sw := &statusWriter{ResponseWriter: w, status: http.StatusOK} + next.ServeHTTP(sw, r) + if r.URL.Path != "/healthz" { + p := r.URL.Path + slog.Info("http", "method", r.Method, "path", p, "status", sw.status, + "dur_ms", time.Since(start).Milliseconds()) + } + }) +} diff --git a/demo/demo.sh b/demo/demo.sh new file mode 100755 index 0000000..a57db90 --- /dev/null +++ b/demo/demo.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Démo locale sans serveur réel : un faux `ssh` exécute le script distant en local, +# un faux `docker` simule des stacks (à jour, en retard, arrêtée, en erreur...). +# Usage : demo/demo.sh [port] (binaire : bin/stackwatch, voir README) +set -e +cd "$(dirname "$0")/.." +PORT=${1:-8099} +DEMO=$PWD/demo/.state +mkdir -p "$DEMO/data" +if [ ! -d "$DEMO/home" ]; then + for d in nextcloud outdated traefik alice/blog stopped badpull broken; do + mkdir -p "$DEMO/home/$d"; echo "services: {}" > "$DEMO/home/$d/compose.yaml" + done +fi +export PATH="$PWD/demo/fake-bin:$PATH" AUTH_MODE=none DATA_DIR="$DEMO/data" LISTEN_ADDR=127.0.0.1:$PORT CHECK_INTERVAL=0 +# Serveur de démonstration pré-enregistré au premier lancement. +mkdir -p "$DEMO/data/fleet" +if [ ! -f "$DEMO/data/fleet/servers.json" ]; then + cat > "$DEMO/data/fleet/servers.json" <&2; exit 1; } + [ "$d" = broken ] && { echo "yaml: line 3: mapping values are not allowed" >&2; exit 1; } + exit 0 ;; + "compose ps") [ "$d" = stopped ] && exit 0; echo c1; [ "$d" = outdated ] && echo c2; exit 0 ;; + "compose pull") [ "$d" = badpull ] && { echo "pull access denied" >&2; exit 1; }; exit 0 ;; + "compose down"|"compose up") exit 0 ;; + "inspect -f") + case "$4" in + c1) echo "sha256:aaaaaaaaaaaaaaaaaaaa|nginx:latest|web" ;; + c2) echo "sha256:bbbbbbbbbbbbbbbbbbbb|redis:7|cache" ;; + esac; exit 0 ;; + "image inspect") + case "$5" in + nginx:latest) [ "$d" = outdated ] && echo sha256:aaaaaaaaaaaaaaaaaaaa || echo sha256:aaaaaaaaaaaaaaaaaaaa ;; + redis:7) echo sha256:cccccccccccccccccccc ;; + esac; exit 0 ;; +esac +exit 1 diff --git a/demo/fake-bin/ssh b/demo/fake-bin/ssh new file mode 100755 index 0000000..32992c1 --- /dev/null +++ b/demo/fake-bin/ssh @@ -0,0 +1,5 @@ +#!/bin/sh +# faux ssh : exécute la commande distante (dernier argument) en local +for a; do last=$a; done +sleep 0.6 +exec sh -c "$last" diff --git a/demo/publish.sh b/demo/publish.sh new file mode 100644 index 0000000..48c013b --- /dev/null +++ b/demo/publish.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Premier envoi vers Gitea (à lancer une fois depuis la racine du dépôt). +set -e +cd "$(dirname "$0")/.." +rm -rf .git +git init -q -b main +git add -A +git -c user.name="Cédric" -c user.email="claude@killy.net" commit -q -m "Stackwatch : suivi des mises à jour de stacks docker compose via SSH + +Base Up And Down (auth, thème, dialogues) + moteur fleet (script distant POSIX, +analyse pull + comparaison d'images, mise à jour d'une stack), interface de suivi. + +Co-Authored-By: Claude Sonnet 5.5 " +git remote add origin git@gitea.vlab.bzh:vLab-BZH/stackwatch.git +git push -u origin main +git log --oneline | head -3 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fd4a8aa --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,45 @@ +# Stackwatch +services: + stackwatch: + build: . + image: stackwatch:local + restart: unless-stopped + # ports: + # - "${STACKWATCH_PORT:-8080}:8080" + environment: + # Authentification : local (comptes), oidc, both ou none (reverse proxy qui authentifie). + AUTH_MODE: ${AUTH_MODE:-local} + ADMIN_USER: ${ADMIN_USER:-} + ADMIN_PASSWORD: ${ADMIN_PASSWORD:-} + # Inscription des comptes locaux : closed, approval ou open. + REGISTRATION: ${REGISTRATION:-closed} + OIDC_ISSUER: ${OIDC_ISSUER:-} + OIDC_CLIENT_ID: ${OIDC_CLIENT_ID:-} + OIDC_CLIENT_SECRET: ${OIDC_CLIENT_SECRET:-} + OIDC_REDIRECT_URL: ${OIDC_REDIRECT_URL:-} + OIDC_SCOPES: ${OIDC_SCOPES:-openid profile email groups} + OIDC_NAME: ${OIDC_NAME:-SSO} + OIDC_ALLOWED_GROUPS: ${OIDC_ALLOWED_GROUPS:-} + OIDC_GROUPS_CLAIM: ${OIDC_GROUPS_CLAIM:-groups} + OIDC_ADMIN_GROUPS: ${OIDC_ADMIN_GROUPS:-} + OIDC_ADMIN_EMAILS: ${OIDC_ADMIN_EMAILS:-} + OIDC_LOGOUT: ${OIDC_LOGOUT:-true} + SESSION_TTL: ${SESSION_TTL:-24h} + SESSION_SECRET: ${SESSION_SECRET:-} + PUBLIC_URL: ${PUBLIC_URL:-} + TITLE: ${TITLE:-Stackwatch} + # Analyse automatique (pull + comparaison des images) ; 0 : seulement à la demande. + CHECK_INTERVAL: ${CHECK_INTERVAL:-6h} + MAX_PARALLEL: ${MAX_PARALLEL:-4} + volumes: + # Serveurs, résultats, comptes et clé SSH : chown -R 65532:65532 ./data + - ./data:/data + read_only: true + cap_drop: [ALL] + security_opt: + - no-new-privileges:true + networks: + - traefik-net +networks: + traefik-net: + external: true diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..307351e --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,23 @@ + + + + + + + + + Stackwatch + + + +
+ + + diff --git a/frontend/package-lock.json b/frontend/package-lock.json new file mode 100644 index 0000000..90ea47c --- /dev/null +++ b/frontend/package-lock.json @@ -0,0 +1,1877 @@ +{ + "name": "stackwatch-frontend", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "stackwatch-frontend", + "version": "0.1.0", + "dependencies": { + "react": "^19.1.0", + "react-dom": "^19.1.0" + }, + "devDependencies": { + "@types/react": "^19.1.0", + "@types/react-dom": "^19.1.0", + "@vitejs/plugin-react": "^5.0.0", + "typescript": "^5.8.0", + "vite": "^7.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.13.tgz", + "integrity": "sha512-j1nvOQCZYSgp7HLmisnCXFTpVvFODiijQ9QHkORfGKWH6YDtskTEeCJS7eV545GZ9UBzrq0e2xsOd5QQ5PjIqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.13", + "@babel/helper-compilation-targets": "^7.29.13", + "@babel/helper-module-transforms": "^7.29.13", + "@babel/helpers": "^7.29.13", + "@babel/parser": "^7.29.13", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.13", + "@babel/types": "^7.29.11", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.14.tgz", + "integrity": "sha512-qSY56jgW5JnSXzuekLVil6zaOQxOCtOHidr65KkaMBw772IuAY28Qx4ZykAcDn8+FRF15qk80XzKwgSc/RYW6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.14", + "@babel/types": "^7.29.14", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.13.tgz", + "integrity": "sha512-8WxJ4/Vmes3ghacj8VOJy3NW8eyHiFY/4thU/LSBuBE470+igjR/j1ZTNn8fV5VdNrLx6iXUwig526UdOvfP0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.14.tgz", + "integrity": "sha512-2XDvQVd9JESaOgGc4jT2/jquTAO7ppA5noTZQqH+MmZ89yjCzScLwtCPbWtkPZylL+TLWR49IwWmk+QkRR4GsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.14" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.14.tgz", + "integrity": "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.14.tgz", + "integrity": "sha512-6E3Mi1r0B0umq6vmZa4/78q+64fqO2YY0THUdjDPKUCKhNb0yQy5NQIaPHCSD3ryTgiTss//P4JsWS80AsZ6LQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.14" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.14.tgz", + "integrity": "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.14" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.14.tgz", + "integrity": "sha512-RAdQJrBgmIH1FWvN0X+1hoDxzMzlP4cv/1Zi4dn4tG1H0cTb+rw7CzUxQJhp1f4ANd8j5vH3fy8BAWFGkBDEsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.14", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.14", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.14", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.14.tgz", + "integrity": "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.14", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz", + "integrity": "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.68.7.tgz", + "integrity": "sha512-ZL7MgOeMUiBum1bjzzyBotE3DuHVz+UUxcDVlLL7gpdhDM4RpjG4bZOIly7ensIcXw9jhWl7HTIIQ9KsgjykGQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.68.7.tgz", + "integrity": "sha512-cKZ2Hz/xt5DLY/vdUmMXEn3gnjLgwdeB/npHagbdTljLvBE6b/xKcPCcRWTiT0pHeVf8akl5Cb9K7ylRxbtHng==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-x64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-x64/-/rollup-android-x64-4.68.7.tgz", + "integrity": "sha512-P9vs1uCC2drepKKuiXrhY+r7ry/jtDCrBS8SUCYm2Rr7rVTR9eFH6XVAmD9TdfYFlDgRe5r1eH8tLQVuz+l/VA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.68.7.tgz", + "integrity": "sha512-Lgu2AV7jbOTNNhkQ/OurNm7Snqu1Ux/3y7k8q47fbpPa3q63aIzKKp1xFzax5KH4pcdUzbnX/riuFsxKflsF+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.68.7.tgz", + "integrity": "sha512-wKo6rOzla+/3rN8QBqTgcrsQMfyqwa3y14TvCTotLLib/ACWTxX1zWDTYze90s2RWtYiSfTlavHLmZv0Jsafrw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.68.7.tgz", + "integrity": "sha512-vAeCwbFyEu/vBt9O/uHCHJSvwtOpTSssnM/PoZgn8rmvAkS+9ixaUfJZ2IP3ltom+rvpuQQEIEqltPY7qhC9lQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.68.7.tgz", + "integrity": "sha512-HvjSxOKI+6Si4ytmaoCEpjwDMrH/1s0uWeTAhdE5oXY8/RMI92hCePI/psZuJtY5EHWoT7MfyvTz0HBDZb1ZwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.68.7.tgz", + "integrity": "sha512-nz/Eu1sag3w5gPiKLJhAbKa4D9hUUJpDc9XzKXxGNHZqwgT2AbuVS2e4k9CIoLQp5dPhSN9ntiEVuz2jTzu1Gg==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.68.7.tgz", + "integrity": "sha512-05CEv2G/kI261A1WQBZL8gx6xXULjPfVnTKAkfnV/0uqHeLo+dNEOeUzMaiK/HDGR0Z1Nn7KJjm/34bNbNcfTA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.68.7.tgz", + "integrity": "sha512-wrqk3EkxQt98lTdiYhjcaWmFHwvKiSgHFi7XmPTSF4X8+uGUTBOAc0CaynEvpUhBgkPRbwASrYoU/5uJPF+LFA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.68.7.tgz", + "integrity": "sha512-DnuEUWvzeSxHxzu5lvrN+I/UzrcQkR/fQ4Bibetdp73Rf7aP0XgFpalSDuHmVWsCLETE+Lrl3GVOqIvFP7rcjw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.68.7.tgz", + "integrity": "sha512-n0sr2s+rzVw8ntRucOxGhWeJ9lEl9KxCRzF3RmnZLE/tRnfKiloLuK8UqWrKFqVigEAh0IkRkPz5LVaV9/ZfvA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.68.7.tgz", + "integrity": "sha512-qDVJyMCbh7ekjt1kM9CZsyCFZvv5UW1QTIx3YfJ/gh8LkqpoPNpl9dCeYeOa+bsDOGTWZiMG2riXuoFSRISimQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.68.7.tgz", + "integrity": "sha512-GiIOHHIzgpMoR5DT1pA1b9qMk5i0Ngg2FRj4D6XFSBC8e/axHuIdB7K/OBozO2RtCVAMnH1rXcuJrGScg+bvzA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.68.7.tgz", + "integrity": "sha512-B132V2fwDl7UGLhvK6s3Ay7eNQ4dmDSDgsBm/Wwbz+Wgnunz0le4R2wzDp6TL5ExMu3MC1auJIrVtk2gOyxbyw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.68.7.tgz", + "integrity": "sha512-3NueHQilbssjxgJMx9hXBV+U5keb3CBzmW5WhoBG3iSLFcmz9U2FVoG4MUYpZoZ+KSNMQPN2AA79dTxlEF0VxQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.68.7.tgz", + "integrity": "sha512-8XRwbf76oAF1zZzg6OT8EY3swvCptZnLmiqMgO5+STyhTZ9s7rXa+tY8jESZW9IDyKACcVBGqa/RACDaLzRVjQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.68.7.tgz", + "integrity": "sha512-pvqqfjNdxVLvmovH681K5cPIL9DXj5n1RROaa0vb9JrtHddiScLrkHPRKj5flTKHF1M7xvRy0SS2yTRIc2TO0Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.68.7.tgz", + "integrity": "sha512-rsTjTf5HAm6F4sI6uUfJf2pc+7AWBKxgc2RveGvwB2OvVa1GezSSCDD1rtXPuFhcg3itPv7iHgcZsq/RwWvJ4Q==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.68.7.tgz", + "integrity": "sha512-VNLvsYMD5+zLCi5SohwDdL8PpicC9PnArLwyMJXXUcAduzrM3k9aZT9XiHw+mn5dOWr3UEyfyqJbOvxwJ2fCWQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.68.7.tgz", + "integrity": "sha512-7aOjdahkwiECWWOmjAemPd21yeQ18TW59DUiLWttzolMe5tDwHyBhlOfmxRUHOQnepTNkZ2Qwp1T6LxFZ5v7yQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.68.7.tgz", + "integrity": "sha512-BnNkTwE4FMCAoz3UYiJ6D6Y3pGozYIYZ2W+onH64uhiTI2iwD3KOaNSlkuHYfupZVemls3YTlvbPnuKwHsraiQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.68.7.tgz", + "integrity": "sha512-OH8tGWsJcRW6Vn0dmndyWJGdQa46bH2/2/PVfleBGUWuBd5/HVkIvw2UslgBwUZdtV78bJaoCNBmYI5+bcTJ4A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.68.7.tgz", + "integrity": "sha512-SpYx5X9+2JOF3hXe1cRaiFn562h4AMJhfgxkyHyiuh9dJ7PanPm7FTp8GJReSbS9N+TfjRiBbKacVk1g35kKxg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.68.7.tgz", + "integrity": "sha512-0ncKtQ55fqElV9Sk4cZ/4tiXVGlWxaH5PvDOlx1Sx8GuHIpSWgYrTcyrO51JnVFfy7LvAJiffkEg63ZHKwTMag==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.68.7.tgz", + "integrity": "sha512-XY9DYHO5UxxVR8G6AErXDlccQmDpvGTLgKHFpvkgsyjwG/PrQuInRjQQfpEzBRuT+bhBtwfS8yDe9sPhVcq/9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz", + "integrity": "sha512-YmKkfhOAi3wsB1PhJq5Scj3GXMn3WvtQ/JC0xoopuHoXSdmtdStOpFrYaT1kie2YgFBcIe64ROzMYRjCrYOdYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.29.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-rc.3", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.18.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.38", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.38.tgz", + "integrity": "sha512-rMgy5YW7x28SMfXHLlVZDBqlWzYZ0x2rVR/6FWrNBF0chjigARK1H6nM0hKA1Um3kPOlkQFVtjJs00d2N1ezuw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/browserslist": { + "version": "4.29.6", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.6.tgz", + "integrity": "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.37", + "caniuse-lite": "^1.0.30001826", + "electron-to-chromium": "^1.5.486", + "node-releases": "^2.0.64", + "update-browserslist-db": "^1.4.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001826", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001826.tgz", + "integrity": "sha512-wTB+9tIbLro/BCXwLuNV1meHE4L9dS6dArMDwgYfNBPMYScqClHyGunhkCSDtHhe/69Xl0sHlKgBVZ+fNsYtWA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.4.tgz", + "integrity": "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.491", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.491.tgz", + "integrity": "sha512-zMOQrvaTekJMwENqx1Rnyl3qieqGxIui5CRu9g6ktKzQ/T54fq0Qfr3V/SEhGrkStWI3eYMSzMN4rbyFwfQSzA==", + "dev": true, + "license": "ISC" + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.65", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.65.tgz", + "integrity": "sha512-PfvofsGQ+MiOQIPkX9fU8ELUWmy5zL74CdQaph/ismKszfFkfwXaw0cGiwbwym2hT9k5+mdyl8O5WQ1MD8EHmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", + "integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/react-refresh": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", + "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.68.7", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.68.7.tgz", + "integrity": "sha512-CxhzUIc+ocxPAWxHuff+PAluoW1otD6dHqqPK2h2Q38WA1VYk+3gizX6NEg5t2a8yNGQaiHM1R7V+qdwWuvp5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.10" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.68.7", + "@rollup/rollup-android-arm64": "4.68.7", + "@rollup/rollup-android-x64": "4.68.7", + "@rollup/rollup-darwin-arm64": "4.68.7", + "@rollup/rollup-darwin-x64": "4.68.7", + "@rollup/rollup-freebsd-arm64": "4.68.7", + "@rollup/rollup-freebsd-x64": "4.68.7", + "@rollup/rollup-linux-arm-gnueabihf": "4.68.7", + "@rollup/rollup-linux-arm-musleabihf": "4.68.7", + "@rollup/rollup-linux-arm64-gnu": "4.68.7", + "@rollup/rollup-linux-arm64-musl": "4.68.7", + "@rollup/rollup-linux-loong64-gnu": "4.68.7", + "@rollup/rollup-linux-loong64-musl": "4.68.7", + "@rollup/rollup-linux-ppc64-gnu": "4.68.7", + "@rollup/rollup-linux-ppc64-musl": "4.68.7", + "@rollup/rollup-linux-riscv64-gnu": "4.68.7", + "@rollup/rollup-linux-riscv64-musl": "4.68.7", + "@rollup/rollup-linux-s390x-gnu": "4.68.7", + "@rollup/rollup-linux-x64-gnu": "4.68.7", + "@rollup/rollup-linux-x64-musl": "4.68.7", + "@rollup/rollup-openbsd-x64": "4.68.7", + "@rollup/rollup-openharmony-arm64": "4.68.7", + "@rollup/rollup-win32-arm64-msvc": "4.68.7", + "@rollup/rollup-win32-ia32-msvc": "4.68.7", + "@rollup/rollup-win32-x64-gnu": "4.68.7", + "@rollup/rollup-win32-x64-msvc": "4.68.7", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.2.tgz", + "integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/source-map-js": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.3.tgz", + "integrity": "sha512-xj+WrAkyv5Qp+t7r9N5HvCBu7g1qOe6CKRNpq22X1GGcPEQADFU54v5qsPVs3/vrUFQ7XivFrcAVKA2stI0kWA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.4.0.tgz", + "integrity": "sha512-WPJuOnjI9FWDct4fB+ej4Mz8opLaw5CDcZ2t44tFZ0vIQVYWzBhWR3mkixuUj/A7+vY4V9+ApOZ2YYLwdgq46w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/vite": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.8.tgz", + "integrity": "sha512-3tTi78MAKhVk9h+YZVXMQ8POmneJuE97QUPAWtJghHzhH7BAyiqQOC2KZh1DWOsu/USB2cRXhznPByaabvYXfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..67233a9 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,22 @@ +{ + "name": "stackwatch-frontend", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc --noEmit && vite build", + "preview": "vite preview" + }, + "dependencies": { + "react": "^19.1.0", + "react-dom": "^19.1.0" + }, + "devDependencies": { + "@types/react": "^19.1.0", + "@types/react-dom": "^19.1.0", + "@vitejs/plugin-react": "^5.0.0", + "typescript": "^5.8.0", + "vite": "^7.0.0" + } +} diff --git a/frontend/src/ActionMenu.tsx b/frontend/src/ActionMenu.tsx new file mode 100644 index 0000000..d0f0662 --- /dev/null +++ b/frontend/src/ActionMenu.tsx @@ -0,0 +1,92 @@ +import { useEffect, useLayoutEffect, useRef, useState } from "react"; +import type { ReactNode } from "react"; +import { createPortal } from "react-dom"; + +interface Props { + /** Bouton « … » qui a ouvert le menu : le menu s'aligne sur lui. */ + anchor: HTMLElement; + onClose: () => void; + children: ReactNode; +} + +const MARGIN = 8; // écart minimal avec les bords de la fenêtre + +/** + * Menu déroulant des actions d'un élément, ouvert sous le bouton « … » et aligné + * sur son bord droit (au-dessus s'il manque de place en bas). Rendu dans + * pour ne pas être rogné par le défilement de la liste ; refermé par un clic + * ailleurs, Échap, un défilement, un redimensionnement ou le choix d'une action. + */ +export function ActionMenu({ anchor, onClose, children }: Props) { + const ref = useRef(null); + const [pos, setPos] = useState<{ top: number; left: number } | null>(null); + + useLayoutEffect(() => { + const menu = ref.current; + if (!menu) return; + const a = anchor.getBoundingClientRect(); + const { offsetWidth: w, offsetHeight: h } = menu; + let top = a.bottom + 4; + if (top + h > innerHeight - MARGIN) top = Math.max(MARGIN, a.top - 4 - h); + const left = Math.min(Math.max(MARGIN, a.right - w), innerWidth - w - MARGIN); + setPos({ top, left }); + }, [anchor]); + + // Focus sur la première action une fois le menu placé (masqué, il ne le prend pas). + useEffect(() => { + if (pos) ref.current?.querySelector("button, a")?.focus({ preventScroll: true }); + }, [pos]); + + useEffect(() => { + const inside = (t: EventTarget | null) => t instanceof Node && (ref.current?.contains(t) || anchor.contains(t)); + const onDown = (ev: PointerEvent) => { + if (!inside(ev.target)) onClose(); + }; + const onKey = (ev: KeyboardEvent) => { + if (ev.key === "Escape") { + // Ni désélection, ni fermeture du panneau flottant : seulement le menu. + ev.preventDefault(); + ev.stopPropagation(); + onClose(); + anchor.focus(); + } else if (ev.key === "ArrowDown" || ev.key === "ArrowUp") { + const items = [...(ref.current?.querySelectorAll("button, a") ?? [])]; + if (!items.length) return; + ev.preventDefault(); + const i = items.indexOf(document.activeElement as HTMLElement); + const next = ev.key === "ArrowDown" ? (i + 1) % items.length : (i - 1 + items.length) % items.length; + items[next].focus(); + } + }; + const onScroll = (ev: Event) => { + if (!(ev.target instanceof Node && ref.current?.contains(ev.target))) onClose(); + }; + document.addEventListener("pointerdown", onDown, true); + document.addEventListener("keydown", onKey, true); + document.addEventListener("scroll", onScroll, true); + window.addEventListener("resize", onClose); + return () => { + document.removeEventListener("pointerdown", onDown, true); + document.removeEventListener("keydown", onKey, true); + document.removeEventListener("scroll", onScroll, true); + window.removeEventListener("resize", onClose); + }; + }, [anchor, onClose]); + + return createPortal( +
{ + if ((ev.target as HTMLElement).closest("button, a")) setTimeout(onClose); + }} + > + {children} +
, + document.body, + ); +} diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx new file mode 100644 index 0000000..6a04ec1 --- /dev/null +++ b/frontend/src/App.tsx @@ -0,0 +1,293 @@ +import { useCallback, useEffect, useRef, useState } from "react"; +import { api, type Fleet, type Me } from "./api"; +import { ActionMenu } from "./ActionMenu"; +import { FleetView } from "./FleetView"; +import { KeyDialog, ServerDialog } from "./ServerDialog"; +import { Login } from "./Login"; +import { SettingsDialog } from "./SettingsDialog"; +import { initials } from "./format"; +import { LogoutIcon, MenuIcon, MoonIcon, PlusIcon, RefreshIcon, ServerIcon, SettingsIcon, ShieldIcon, StackIcon, SunIcon, UserIcon, UsersIcon, KeyIcon } from "./icons"; + +type Theme = "light" | "dark"; + +const initialTheme = (): Theme => (document.documentElement.dataset.theme === "dark" ? "dark" : "light"); + +const hashServer = () => decodeURIComponent(location.hash.replace(/^#\/?/, "")); + +export default function App() { + const [me, setMe] = useState(null); + const [loadError, setLoadError] = useState(null); + + const loadMe = useCallback( + () => + api + .me() + .then((m) => { + setMe(m); + setLoadError(null); + document.title = m.title || "Stackwatch"; + }) + .catch((e) => setLoadError(e instanceof Error ? e.message : String(e))), + [], + ); + + useEffect(() => { + loadMe(); + }, [loadMe]); + + // OIDC seul : pas de page de connexion locale, direction le fournisseur. + const redirecting = !!me && !me.user && me.oidc && !me.local; + useEffect(() => { + if (redirecting) location.replace(`/auth/login?next=${encodeURIComponent(location.pathname + location.search + location.hash)}`); + }, [redirecting]); + + if (loadError) { + return ( +
+
+

{loadError}

+ +
+
+ ); + } + if (!me || redirecting) return
Chargement…
; + if (!me.user) return ; + return ; +} + +function Shell({ me, reloadMe }: { me: Me; reloadMe: () => Promise }) { + const [theme, setTheme] = useState(initialTheme); + const [fleet, setFleet] = useState(null); + const [error, setError] = useState(null); + const [sel, setSel] = useState(hashServer()); + const [drawer, setDrawer] = useState(false); + const [settings, setSettings] = useState<"account" | "users" | null>(null); + const [userMenu, setUserMenu] = useState(null); + const [serverDialog, setServerDialog] = useState<{ id?: string } | null>(null); + const [keyDialog, setKeyDialog] = useState(false); + const title = me.title || "Stackwatch"; + const user = me.user!; + + useEffect(() => { + document.documentElement.dataset.theme = theme; + try { + localStorage.setItem("swTheme", theme); + } catch { + /* stockage indisponible */ + } + }, [theme]); + + const load = useCallback( + () => + api + .fleet() + .then((f) => { + setFleet(f); + setError(null); + return f; + }) + .catch((e) => { + setError(e instanceof Error ? e.message : String(e)); + return null; + }), + [], + ); + + // Rafraîchissement : rapide pendant une analyse, lent sinon. + const busy = !!fleet && fleet.summary.scanning > 0; + const loadRef = useRef(load); + loadRef.current = load; + useEffect(() => { + loadRef.current(); + const t = setInterval(() => loadRef.current(), busy ? 2000 : 30000); + return () => clearInterval(t); + }, [busy]); + + useEffect(() => { + const onHash = () => setSel(hashServer()); + window.addEventListener("hashchange", onHash); + return () => window.removeEventListener("hashchange", onHash); + }, []); + + const go = (id: string) => { + setSel(id); + setDrawer(false); + if (id) location.hash = `#/${encodeURIComponent(id)}`; + else history.pushState(null, "", location.pathname + location.search); + }; + + const run = async (fn: () => Promise) => { + setError(null); + try { + await fn(); + await load(); + } catch (e) { + setError(e instanceof Error ? e.message : String(e)); + } + }; + + const servers = fleet?.servers ?? []; + const current = servers.find((s) => s.id === sel); + const sum = fleet?.summary; + + const dot = (s: (typeof servers)[number]) => { + const scans = Object.values(s.scans); + if (!s.enabled) return "off"; + if (scans.some((x) => x.error)) return "err"; + if (scans.some((x) => x.stacks.some((st) => st.status === "error"))) return "err"; + if (scans.some((x) => x.stacks.some((st) => st.status === "updates"))) return "upd"; + if (scans.length === 0) return "off"; + return "ok"; + }; + const updatesOf = (s: (typeof servers)[number]) => Object.values(s.scans).reduce((n, x) => n + x.stacks.filter((st) => st.status === "updates").length, 0); + + return ( +
+
+ + (e.preventDefault(), go(""))} title={title}> + + {title} + +
+ + + +
+
+ +
+ {drawer &&
setDrawer(false)} />} + +
+
+ {error && ( +
setError(null)}> + {error} +
+ )} + setServerDialog({ id })} + onAdd={() => setServerDialog({})} + onKey={() => setKeyDialog(true)} + /> +
+
+ + {userMenu && ( + setUserMenu(null)}> +
+ {user.name} + {user.email || user.id} + {me.admin && me.mode !== "none" ? "Administrateur" : ""} +
+
+ {me.mode !== "none" && ( + + )} + {me.admin && me.mode !== "none" && ( + + )} + {me.admin && ( + + )} + {me.logout && ( + <> +
+ + + Se déconnecter + + + )} +
+ )} + + {settings && setSettings(null)} onChanged={reloadMe} />} + {keyDialog && fleet && setKeyDialog(false)} />} + {serverDialog && ( + s.id === serverDialog.id)} + publicKey={fleet?.publicKey ?? ""} + onClose={() => setServerDialog(null)} + onSaved={(id) => { + setServerDialog(null); + load(); + if (id) go(id); + }} + onDeleted={() => { + setServerDialog(null); + go(""); + load(); + }} + /> + )} +
+ ); +} + +export function fmtInterval(seconds: number) { + if (seconds % 86400 === 0) return `${seconds / 86400} j`; + if (seconds % 3600 === 0) return `${seconds / 3600} h`; + return `${Math.round(seconds / 60)} min`; +} diff --git a/frontend/src/Dialogs.tsx b/frontend/src/Dialogs.tsx new file mode 100644 index 0000000..d64a59d --- /dev/null +++ b/frontend/src/Dialogs.tsx @@ -0,0 +1,98 @@ +import { useEffect, useRef, useState } from "react"; +import type { ReactNode } from "react"; + +function useEscape(onClose: () => void) { + useEffect(() => { + const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose(); + window.addEventListener("keydown", onKey); + return () => window.removeEventListener("keydown", onKey); + }, [onClose]); +} + +interface PromptProps { + title: string; + label?: string; + initial?: string; + placeholder?: string; + submit?: string; + /** Sélectionne seulement le nom, sans l'extension (renommage d'un fichier). */ + stem?: boolean; + onSubmit: (value: string) => void; + onClose: () => void; +} + +/** Saisie d'un nom (nouveau dossier, renommage), à la place de prompt(). */ +export function PromptDialog({ title, label, initial = "", placeholder, submit = "Valider", stem, onSubmit, onClose }: PromptProps) { + const [value, setValue] = useState(initial); + const ref = useRef(null); + useEscape(onClose); + + useEffect(() => { + const el = ref.current; + if (!el) return; + el.focus(); + const dot = initial.lastIndexOf("."); + el.setSelectionRange(0, stem && dot > 0 ? dot : initial.length); + }, [initial, stem]); + + const trimmed = value.trim(); + return ( +
+
e.stopPropagation()} + onSubmit={(e) => { + e.preventDefault(); + if (trimmed) onSubmit(trimmed); + }} + > +

{title}

+ +
+ + + +
+
+
+ ); +} + +interface ConfirmProps { + title: string; + children: ReactNode; + confirm: string; + danger?: boolean; + onConfirm: () => void; + onClose: () => void; +} + +/** Confirmation d'une action destructrice, à la place de confirm(). */ +export function ConfirmDialog({ title, children, confirm, danger, onConfirm, onClose }: ConfirmProps) { + useEscape(onClose); + return ( +
+
e.stopPropagation()}> +

{title}

+
{children}
+
+ + + +
+
+
+ ); +} diff --git a/frontend/src/FleetView.tsx b/frontend/src/FleetView.tsx new file mode 100644 index 0000000..874c9d1 --- /dev/null +++ b/frontend/src/FleetView.tsx @@ -0,0 +1,356 @@ +import { useMemo, useState } from "react"; +import { api, type Me, type Fleet, type Scan, type Server, type Stack, type StackStatus, type Target } from "./api"; +import { ConfirmDialog } from "./Dialogs"; +import { fmtRelative, plural } from "./format"; +import { ArrowUpIcon, CheckIcon, ChevronDownIcon, ChevronRightIcon, ClockIcon, EditIcon, KeyIcon, PlusIcon, RefreshIcon, SearchIcon, ServerIcon, WarningIcon } from "./icons"; + +type Filter = "all" | "updates" | "problems"; + +interface Props { + me: Me; + fleet: Fleet | null; + /** Serveur affiché ; absent : tous. */ + current?: Server; + reload: () => Promise; + run: (fn: () => Promise) => Promise; + onEdit: (id: string) => void; + onAdd: () => void; + onKey: () => void; +} + +const statusLabel: Record = { + uptodate: "À jour", + updates: "Mise à jour", + stopped: "Arrêtée", + error: "Erreur", +}; + +export function FleetView({ me, fleet, current, run, onEdit, onAdd, onKey }: Props) { + const [filter, setFilter] = useState("all"); + const [search, setSearch] = useState(""); + const [applying, setApplying] = useState<{ server: Server; target: Target; stack: Stack } | null>(null); + + const servers = useMemo(() => (current ? [current] : (fleet?.servers ?? [])), [current, fleet]); + + if (!fleet) return
Chargement…
; + + if (!fleet.servers.length) { + return ( +
+ +

Aucun serveur

+

+ Ajoutez un serveur joignable en SSH : stackwatch y retrouve les stacks docker compose (dans /home par défaut) et vous dit lesquelles ont une nouvelle image. +

+ {me.admin ? ( +
+ + +
+ ) : ( +

Un administrateur doit d'abord en déclarer.

+ )} +
+ ); + } + + if (!current && location.hash.replace(/^#\/?/, "")) { + return

Serveur introuvable.

; + } + + // Compteurs du périmètre affiché. + const all = servers.flatMap((s) => Object.values(s.scans).flatMap((sc) => sc.stacks)); + const count = (st: StackStatus) => all.filter((x) => x.status === st).length; + const unreachable = servers.reduce((n, s) => n + Object.values(s.scans).filter((sc) => sc.error).length, 0); + const scanning = servers.some((s) => Object.values(s.scans).some((sc) => sc.running)); + const q = search.trim().toLowerCase(); + + const keep = (st: Stack) => { + if (filter === "updates" && st.status !== "updates") return false; + if (filter === "problems" && st.status !== "error") return false; + return !q || st.name.toLowerCase().includes(q) || st.dir.toLowerCase().includes(q) || (st.services ?? []).some((s) => s.image.toLowerCase().includes(q)); + }; + + return ( +
+
+
+

{current ? current.name : "Tous les serveurs"}

+ {current && ( + + {current.host} + {current.port !== 22 ? `:${current.port}` : ""} + {current.note ? ` · ${current.note}` : ""} + + )} +
+
+ {plural(all.length, "stack")} + {plural(count("updates"), "mise")} à jour à faire + {count("error") > 0 && {plural(count("error"), "erreur")}} + {unreachable > 0 && {plural(unreachable, "connexion")} en échec} + {count("stopped") > 0 && {plural(count("stopped"), "arrêtée")}} +
+
+ +
+
+ {( + [ + ["all", "Toutes"], + ["updates", "Mises à jour"], + ["problems", "Erreurs"], + ] as [Filter, string][] + ).map(([k, label]) => ( + + ))} +
+ + + {current && ( + <> + + {me.admin && ( + + )} + + )} +
+ +
+ {servers.map((s) => ( + onEdit(s.id)} + onCheck={(t) => run(() => api.check(s.id, t))} + onApply={(target, stack) => setApplying({ server: s, target, stack })} + /> + ))} +
+ + {applying && ( + setApplying(null)} + onConfirm={() => { + const a = applying; + setApplying(null); + run(() => api.applyStack(a.server.id, a.target.id, a.stack.dir)); + }} + > +

+ Sur {applying.server.name}, {applying.stack.dir} : téléchargement des images, arrêt (down) puis redémarrage (up -d) de toute la stack, sous l'utilisateur{" "} + {applying.target.user}. Les services sont interrompus quelques instants. +

+
+ )} +
+ ); +} + +interface BlockProps { + server: Server; + single: boolean; + me: Me; + keep: (s: Stack) => boolean; + filtering: boolean; + onEdit: () => void; + onCheck: (targetId?: string) => void; + onApply: (t: Target, s: Stack) => void; +} + +function ServerBlock({ server, single, me, keep, filtering, onEdit, onCheck, onApply }: BlockProps) { + const scans = Object.values(server.scans); + const running = scans.some((s) => s.running); + const last = scans.map((s) => s.finished).filter(Boolean).sort().pop(); + const updates = scans.reduce((n, s) => n + s.stacks.filter((x) => x.status === "updates").length, 0); + + return ( +
+ {!single && ( +
+ +

{server.name}

+ {server.host} + {!server.enabled && désactivé} + {updates > 0 && {plural(updates, "mise")} à jour} + + {last && ( + + {fmtRelative(last)} + + )} + + {me.admin && ( + + )} +
+ )} + {server.targets.map((t) => ( + onCheck(t.id)} onApply={(s) => onApply(t, s)} /> + ))} +
+ ); +} + +function TargetBlock({ server, target, scan, me, keep, filtering, onCheck, onApply }: { server: Server; target: Target; scan?: Scan; me: Me; keep: (s: Stack) => boolean; filtering: boolean; onCheck: () => void; onApply: (s: Stack) => void }) { + const [open, setOpen] = useState>({}); + const stacks = (scan?.stacks ?? []).filter(keep); + const hidden = (scan?.stacks.length ?? 0) - stacks.length; + + return ( +
+
+ + {target.user}@{server.host} + + {target.roots.join(" · ")}{target.depth > 1 ? ` (profondeur ${target.depth})` : ""} + + {scan?.running && ( + + {scan.task === "apply" ? "Mise à jour" : "Analyse"} + {scan.current ? ` : ${scan.current.split("/").pop()}` : "…"} + + )} + {!scan?.running && scan?.finished && ( + + vérifié {fmtRelative(scan.finished)} + + )} + {scan?.compose && ( + + compose {scan.compose} + + )} + +
+ + {scan?.error && ( +
+ {scan.error} + {scan.stacks.length > 0 && (dernier résultat conservé)} +
+ )} + {scan?.warnings?.map((w) => ( +
+ {w} +
+ ))} + + {!scan &&

Pas encore analysé.

} + {scan && !scan.error && !scan.running && scan.stacks.length === 0 &&

Aucune stack compose trouvée sous ces racines.

} + {scan && scan.stacks.length > 0 && stacks.length === 0 && filtering &&

Aucune stack ne correspond au filtre ({hidden} masquées).

} + + {stacks.length > 0 && ( +
    + {stacks.map((st) => { + const isOpen = !!open[st.dir]; + const [late, total] = [st.services?.filter((s) => s.state === "update").length ?? 0, st.services?.length ?? 0]; + return ( +
  • +
    setOpen({ ...open, [st.dir]: !isOpen })}> + + + {st.status === "uptodate" && } + {st.status === "updates" && } + {st.status === "error" && } + {statusLabel[st.status]} + + + {st.name} + {st.dir} + + + {st.status === "error" ? {st.error} : total > 0 ? (late > 0 ? `${late}/${plural(total, "image")} à mettre à jour` : plural(total, "image")) : ""} + + {me.admin && st.status === "updates" && ( + + )} +
    + {isOpen && ( +
    +
    + {st.file} +
    + {st.error &&
    {st.error}
    } + {total > 0 && ( + + + + + + + + + + + {st.services!.map((s) => ( + + + + + + + + ))} + +
    ServiceImageEn coursDisponible +
    {s.name} + {s.image} + + {s.running} + + {s.latest || "?"} + + {s.state === "ok" ? "à jour" : s.state === "update" ? "nouvelle image" : "inconnu"} +
    + )} + {st.applied && ( +
    + {st.applied.ok ? "Mise à jour effectuée" : "Mise à jour en échec"} le {new Date(st.applied.at).toLocaleString()} par {st.applied.by} : {st.applied.message} +
    + )} +
    + )} +
  • + ); + })} +
+ )} +
+ ); +} diff --git a/frontend/src/Login.tsx b/frontend/src/Login.tsx new file mode 100644 index 0000000..b76d94e --- /dev/null +++ b/frontend/src/Login.tsx @@ -0,0 +1,126 @@ +import { useState } from "react"; +import { api, ApiError, type Me } from "./api"; +import { StackIcon } from "./icons"; + +interface Props { + me: Me; + /** Connexion ou inscription réussie (session ouverte) : recharge l'application. */ + onLoggedIn: () => void; +} + +/** Page de connexion : compte local, inscription (selon le mode choisi par l'administrateur) et bouton OIDC. */ +export function Login({ me, onLoggedIn }: Props) { + const canRegister = me.local && (me.registration !== "closed" || !!me.setup); + const [mode, setMode] = useState<"login" | "register">(me.setup ? "register" : "login"); + const [f, setF] = useState({ username: "", name: "", email: "", password: "", confirm: "" }); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + const [info, setInfo] = useState(null); + const title = me.title || "Stackwatch"; + const next = encodeURIComponent(location.pathname + location.search + location.hash); + + const set = (k: keyof typeof f) => (e: React.ChangeEvent) => setF({ ...f, [k]: e.target.value }); + + const submit = async (e: React.FormEvent) => { + e.preventDefault(); + setError(null); + setInfo(null); + if (mode === "register" && f.password !== f.confirm) { + setError("Les deux mots de passe sont différents."); + return; + } + setBusy(true); + try { + if (mode === "login") { + await api.login(f.username, f.password); + onLoggedIn(); + } else { + const status = await api.register({ username: f.username, name: f.name, email: f.email, password: f.password }); + if (status === "pending") { + setInfo("Compte créé. Un administrateur doit le valider avant votre première connexion."); + setMode("login"); + setF({ ...f, password: "", confirm: "" }); + } else onLoggedIn(); + } + } catch (err) { + if (err instanceof ApiError && err.code === "pending") setInfo("Votre compte est en attente de validation par un administrateur."); + else setError(err instanceof Error ? err.message : String(err)); + } finally { + setBusy(false); + } + }; + + return ( +
+
+
+ +

{title}

+

Suivez les mises à jour de vos stacks docker compose.

+
+ + {me.setup && ( +
+ Première utilisation. Le compte créé ici devient l'administrateur. +
+ )} + {info &&
{info}
} + {error &&
{error}
} + + {me.local && ( +
+ {canRegister && !me.setup && ( +
+ + +
+ )} + + {mode === "register" && ( + <> + + + + )} + + {mode === "register" && ( + + )} + + {mode === "register" && me.registration === "approval" && !me.setup &&

Votre compte devra être validé par un administrateur.

} +
+ )} + + {me.oidc && ( + <> + {me.local &&
ou
} + + Se connecter avec {me.oidcName || "SSO"} + + + )} +
+
+ ); +} diff --git a/frontend/src/ServerDialog.tsx b/frontend/src/ServerDialog.tsx new file mode 100644 index 0000000..89246ea --- /dev/null +++ b/frontend/src/ServerDialog.tsx @@ -0,0 +1,284 @@ +import { useEffect, useState } from "react"; +import { api, type PingResult, type Server, type ServerInput } from "./api"; +import { ConfirmDialog } from "./Dialogs"; +import { CheckIcon, CloseIcon, CopyIcon, PlusIcon, TrashIcon, WarningIcon } from "./icons"; + +const msg = (e: unknown) => (e instanceof Error ? e.message : String(e)); + +function useEscape(onClose: () => void) { + useEffect(() => { + const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose(); + window.addEventListener("keydown", onKey); + return () => window.removeEventListener("keydown", onKey); + }, [onClose]); +} + +async function copy(text: string): Promise { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + return false; + } +} + +interface TargetForm { + id?: string; + user: string; + roots: string; + depth: number; +} + +const emptyTarget = (): TargetForm => ({ user: "", roots: "/home", depth: 1 }); + +const toInput = (f: { name: string; host: string; port: string; note: string; enabled: boolean }, targets: TargetForm[]): ServerInput => ({ + name: f.name, + host: f.host, + port: Number(f.port) || 22, + note: f.note, + enabled: f.enabled, + targets: targets.map((t) => ({ id: t.id, user: t.user.trim(), depth: t.depth, roots: t.roots.split(/[\n,]+/).map((r) => r.trim()).filter(Boolean) })), +}); + +/** Ajout ou modification d'un serveur : hôte SSH et connexions (utilisateur + racines à parcourir). */ +export function ServerDialog({ + server, + publicKey, + onClose, + onSaved, + onDeleted, +}: { + server?: Server; + publicKey: string; + onClose: () => void; + onSaved: (id?: string) => void; + onDeleted: () => void; +}) { + const [f, setF] = useState({ + name: server?.name ?? "", + host: server?.host ?? "", + port: String(server?.port ?? 22), + note: server?.note ?? "", + enabled: server?.enabled ?? true, + }); + const [targets, setTargets] = useState( + server ? server.targets.map((t) => ({ id: t.id, user: t.user, roots: t.roots.join("\n"), depth: t.depth })) : [emptyTarget()], + ); + const [busy, setBusy] = useState(false); + const [error, setError] = useState(null); + const [ping, setPing] = useState(null); + const [removing, setRemoving] = useState(false); + const [copied, setCopied] = useState(false); + useEscape(onClose); + + const set = (k: keyof typeof f) => (e: React.ChangeEvent) => setF({ ...f, [k]: k === "enabled" ? e.target.checked : e.target.value }); + const setT = (i: number, v: Partial) => setTargets(targets.map((t, j) => (j === i ? { ...t, ...v } : t))); + + const test = async () => { + setBusy(true); + setError(null); + setPing(null); + try { + setPing(await api.testServer("-", toInput(f, targets))); + } catch (e) { + setError(msg(e)); + } finally { + setBusy(false); + } + }; + + const save = async (e: React.FormEvent) => { + e.preventDefault(); + setBusy(true); + setError(null); + try { + const res = server ? await api.updateServer(server.id, toInput(f, targets)) : await api.addServer(toInput(f, targets)); + onSaved(res.id); + } catch (e) { + setError(msg(e)); + setBusy(false); + } + }; + + const remove = async () => { + setRemoving(false); + setBusy(true); + try { + await api.deleteServer(server!.id); + onDeleted(); + } catch (e) { + setError(msg(e)); + setBusy(false); + } + }; + + return ( +
+
e.stopPropagation()} onSubmit={save}> +
+

{server ? `Serveur ${server.name}` : "Ajouter un serveur"}

+ +
+ {error && ( +
setError(null)}> + {error} +
+ )} +
+
+ +
+ + +
+
+ + + +

Connexions

+

+ Une connexion = un utilisateur SSH et les répertoires où chercher des stacks (compose.yaml, docker-compose.yml…). Pour des stacks qui n'appartiennent qu'à un utilisateur, ajoutez une connexion sous cet utilisateur, avec son répertoire (ex. /home/alice) : + elles ne tournent alors qu'avec ses droits. L'utilisateur doit pouvoir utiliser docker. +

+ {targets.map((t, i) => ( +
+
+ + + {targets.length > 1 && ( + + )} +
+