aboutsummaryrefslogtreecommitdiff
path: root/internal/route/home.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-04-05 06:36:08 +0800
committerGitHub <noreply@github.com>2020-04-05 06:36:08 +0800
commit07818d5fa5aef7dd7dca1d556f59c7a146a9b00c (patch)
tree14c89609a04f269123413f676a8cbe68c197de07 /internal/route/home.go
parentbae1d6ccd81cd427382a2456e7c3646bdac9cf46 (diff)
route: no session for routes without UI (#6066)
Not all routes need session, register session and CSRF middleware as global is a waste of resource, and creating a lot one-time off yet never used session records.
Diffstat (limited to 'internal/route/home.go')
-rw-r--r--internal/route/home.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/route/home.go b/internal/route/home.go
index 86a659d0..7338c9e8 100644
--- a/internal/route/home.go
+++ b/internal/route/home.go
@@ -5,7 +5,12 @@
package route
import (
+ "fmt"
+ "net/http"
+
+ "github.com/go-macaron/i18n"
"github.com/unknwon/paginater"
+ "gopkg.in/macaron.v1"
"gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/context"
@@ -157,7 +162,7 @@ func ExploreOrganizations(c *context.Context) {
})
}
-func NotFound(c *context.Context) {
- c.Data["Title"] = "Page Not Found"
- c.NotFound()
+func NotFound(c *macaron.Context, l i18n.Locale) {
+ c.Data["Title"] = l.Tr("status.page_not_found")
+ c.HTML(http.StatusNotFound, fmt.Sprintf("status/%d", http.StatusNotFound))
}