fix deploy and logs
This commit is contained in:
parent
79b3c8d693
commit
af8bbf536f
5 changed files with 40 additions and 6 deletions
|
|
@ -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})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue