chore: enable all pprof handle on debug

This commit is contained in:
Andy Hsu
2023-09-07 14:56:50 +08:00
parent d5b68a91d2
commit cd2f8077fa
3 changed files with 16 additions and 7 deletions

View File

@ -5,10 +5,8 @@ import (
"fmt"
"io/fs"
"net/http"
"net/http/pprof"
"strings"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/setting"
"github.com/alist-org/alist/v3/pkg/utils"
@ -85,8 +83,6 @@ func Static(r *gin.RouterGroup, noRoute func(handlers ...gin.HandlerFunc)) {
c.Status(200)
if strings.HasPrefix(c.Request.URL.Path, "/@manage") {
_, _ = c.Writer.WriteString(conf.ManageHtml)
} else if strings.HasPrefix(c.Request.URL.Path, "/debug/pprof") && flags.Debug {
pprof.Index(c.Writer, c.Request)
} else {
_, _ = c.Writer.WriteString(conf.IndexHtml)
}