mirror of
https://github.com/gogs/gogs.git
synced 2025-12-22 08:09:59 +01:00
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.
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user