Add bots documentation
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// This package helps the backend determine which clients are bots or crawlers.
|
||||
// In Write.as, this is used to prevent certain things when viewing posts, like
|
||||
// incrementing the view count.
|
||||
package bots
|
||||
|
||||
var bots = map[string]bool{
|
||||
@@ -26,6 +29,8 @@ var bots = map[string]bool{
|
||||
"Twitterbot/1.0": true,
|
||||
}
|
||||
|
||||
// IsBot returns whether or not the provided User-Agent string is a known bot
|
||||
// or crawler.
|
||||
func IsBot(ua string) bool {
|
||||
if _, ok := bots[ua]; ok {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user