fix deploy and logs

This commit is contained in:
pavel 2026-05-14 22:00:04 +02:00
commit af8bbf536f
5 changed files with 40 additions and 6 deletions

View file

@ -248,11 +248,12 @@ func (a *App) handleProjectLogs(w http.ResponseWriter, r *http.Request, user Use
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
lines := 200
lines := 100
const maxLogBytes = 64 * 1024
if raw := r.URL.Query().Get("lines"); raw != "" {
n, err := strconv.Atoi(raw)
if err != nil || n < 1 || n > 1000 {
http.Error(w, "lines must be 1-1000", http.StatusBadRequest)
if err != nil || n < 1 || n > 300 {
http.Error(w, "lines must be 1-300", http.StatusBadRequest)
return
}
lines = n
@ -262,5 +263,8 @@ func (a *App) handleProjectLogs(w http.ResponseWriter, r *http.Request, user Use
http.Error(w, err.Error(), http.StatusBadGateway)
return
}
if len(logs) > maxLogBytes {
logs = logs[:maxLogBytes] + "\n... (truncated)"
}
writeJSON(w, http.StatusOK, map[string]any{"lines": lines, "logs": logs})
}