Documentation
¶
Index ¶
- Variables
- func DeleteCookie(writer http.ResponseWriter, request *http.Request, cookieName string) bool
- func InitMinifier()
- func IsRequestingJSON(request *http.Request) bool
- func MinifyTemplate[T templateRef](tmplRef T, data any, writer io.Writer, mediaType string) (err error)
- func MinifyWriter(writer io.Writer, data []byte, mediaType string) (int, error)
- func PreloadModule(l *lua.LState) int
- type RefererResult
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrSpambot = errors.New("request looks like spam")
)
Functions ¶
func DeleteCookie ¶
DeleteCookie deletes the given cookie if it exists. It returns true if it exists and false with no errors if it doesn't
func InitMinifier ¶
func InitMinifier()
InitMinifier sets up the HTML/JS/JSON minifier if enabled in gochan.json
func IsRequestingJSON ¶
func MinifyTemplate ¶
func MinifyTemplate[T templateRef](tmplRef T, data any, writer io.Writer, mediaType string) (err error)
MinifyTemplate minifies the given template ref (string or template.Template pointer) and data, and returns any errors
func MinifyWriter ¶
MinifyWriter minifies the given writer/data (if enabled) and returns the number of bytes written and any errors
func PreloadModule ¶
Types ¶
type RefererResult ¶
type RefererResult int
const ( // NoReferer is returned when the request has no referer NoReferer RefererResult = iota // InvalidReferer is returned when the referer not a valid URL InvalidReferer // InternalReferer is returned when the request came from the same site as the server InternalReferer // ExternalReferer is returned when the request came from another site. It may or may not be be spam, depending on the context ExternalReferer )
func CheckReferer ¶
func CheckReferer(request *http.Request) (RefererResult, error)
CheckReferer checks to make sure that the incoming request is from the same domain
Click to show internal directories.
Click to hide internal directories.