mirror of
https://github.com/go-gitea/gitea
synced 2025-08-02 23:58:35 +00:00
@@ -77,9 +77,9 @@ type webContextKeyType struct{}
|
||||
|
||||
var WebContextKey = webContextKeyType{}
|
||||
|
||||
func GetWebContext(req *http.Request) *Context {
|
||||
ctx, _ := req.Context().Value(WebContextKey).(*Context)
|
||||
return ctx
|
||||
func GetWebContext(ctx context.Context) *Context {
|
||||
webCtx, _ := ctx.Value(WebContextKey).(*Context)
|
||||
return webCtx
|
||||
}
|
||||
|
||||
// ValidateContext is a special context for form validation middleware. It may be different from other contexts.
|
||||
@@ -133,6 +133,7 @@ func NewWebContext(base *Base, render Render, session session.Store) *Context {
|
||||
}
|
||||
ctx.TemplateContext = NewTemplateContextForWeb(ctx)
|
||||
ctx.Flash = &middleware.Flash{DataStore: ctx, Values: url.Values{}}
|
||||
ctx.AppendContextValue(WebContextKey, ctx)
|
||||
return ctx
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user