mirror of https://github.com/Xhofe/alist
feat:add pprof
parent
b6af9aa587
commit
732e9eb1c3
|
@ -1,14 +1,16 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"net/http/pprof"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Xhofe/alist/conf"
|
"github.com/Xhofe/alist/conf"
|
||||||
"github.com/Xhofe/alist/public"
|
"github.com/Xhofe/alist/public"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"io/fs"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitIndex() {
|
func InitIndex() {
|
||||||
|
@ -48,6 +50,8 @@ func Static(r *gin.Engine) {
|
||||||
c.Status(200)
|
c.Status(200)
|
||||||
if strings.HasPrefix(c.Request.URL.Path, "/@manage") {
|
if strings.HasPrefix(c.Request.URL.Path, "/@manage") {
|
||||||
_, _ = c.Writer.WriteString(conf.ManageHtml)
|
_, _ = c.Writer.WriteString(conf.ManageHtml)
|
||||||
|
} else if strings.HasPrefix(c.Request.URL.Path, "/debug/pprof") {
|
||||||
|
pprof.Index(c.Writer, c.Request)
|
||||||
} else {
|
} else {
|
||||||
_, _ = c.Writer.WriteString(conf.IndexHtml)
|
_, _ = c.Writer.WriteString(conf.IndexHtml)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue