You've already forked nyx
mirror of
https://github.com/rls-moe/nyx
synced 2025-08-19 06:18:38 +00:00
Added Moderation Tools, Captcha & Trollthrottle
This commit is contained in:
@@ -13,6 +13,15 @@ func GetBaseCtx(r *http.Request) map[string]interface{} {
|
||||
"CSRFToken": nosurf.Token(r),
|
||||
}
|
||||
|
||||
if sess := GetSession(r); sess != nil {
|
||||
val["Session"] = sess
|
||||
}
|
||||
|
||||
err := r.URL.Query().Get("err")
|
||||
if err != "" {
|
||||
val["PreviousError"] = err
|
||||
}
|
||||
|
||||
return val
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,10 @@ import (
|
||||
func ConfigCtx(config *config.Config) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if !config.IsHostNameValid(r.Host) {
|
||||
return
|
||||
}
|
||||
|
||||
r = r.WithContext(context.WithValue(r.Context(), configKey, config))
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
|
Reference in New Issue
Block a user