mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Use toolbox
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package dev
|
||||
|
||||
import (
|
||||
"net/http/pprof"
|
||||
|
||||
"github.com/Unknwon/macaron"
|
||||
)
|
||||
|
||||
func RegisterDebugRoutes(r *macaron.Macaron) {
|
||||
r.Any("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
r.Any("/debug/pprof/profile", pprof.Profile)
|
||||
r.Any("/debug/pprof/symbol", pprof.Symbol)
|
||||
r.Any("/debug/pprof/*", pprof.Index)
|
||||
}
|
@@ -119,12 +119,19 @@ func Profile(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "Profile"
|
||||
ctx.Data["PageIsUserProfile"] = true
|
||||
|
||||
u, err := models.GetUserByName(ctx.Params(":username"))
|
||||
uname := ctx.Params(":username")
|
||||
// Special handle for FireFox requests favicon.ico.
|
||||
if uname == "favicon.ico" {
|
||||
ctx.Redirect("/img/favicon.png")
|
||||
return
|
||||
}
|
||||
|
||||
u, err := models.GetUserByName(uname)
|
||||
if err != nil {
|
||||
if err == models.ErrUserNotExist {
|
||||
ctx.Handle(404, "user.Profile(GetUserByName)", err)
|
||||
ctx.Handle(404, "GetUserByName", err)
|
||||
} else {
|
||||
ctx.Handle(500, "user.Profile(GetUserByName)", err)
|
||||
ctx.Handle(500, "GetUserByName", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -146,13 +153,13 @@ func Profile(ctx *middleware.Context) {
|
||||
case "activity":
|
||||
ctx.Data["Feeds"], err = models.GetFeeds(u.Id, 0, true)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "user.Profile(GetFeeds)", err)
|
||||
ctx.Handle(500, "GetFeeds", err)
|
||||
return
|
||||
}
|
||||
default:
|
||||
ctx.Data["Repos"], err = models.GetRepositories(u.Id, ctx.IsSigned && ctx.User.Id == u.Id)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "user.Profile(GetRepositories)", err)
|
||||
ctx.Handle(500, "GetRepositories", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user