From 732e9eb1c3061f91d130ed0a4005d7bd6a9046d4 Mon Sep 17 00:00:00 2001 From: foxxorcat Date: Tue, 10 May 2022 21:40:43 +0800 Subject: [PATCH] feat:add pprof --- server/static.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/static.go b/server/static.go index c91ea10a..c60b98d4 100644 --- a/server/static.go +++ b/server/static.go @@ -1,14 +1,16 @@ package server import ( + "io/fs" + "io/ioutil" + "net/http" + "net/http/pprof" + "strings" + "github.com/Xhofe/alist/conf" "github.com/Xhofe/alist/public" "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" - "io/fs" - "io/ioutil" - "net/http" - "strings" ) func InitIndex() { @@ -48,6 +50,8 @@ func Static(r *gin.Engine) { 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") { + pprof.Index(c.Writer, c.Request) } else { _, _ = c.Writer.WriteString(conf.IndexHtml) }