25 lines
473 B
Go
25 lines
473 B
Go
package shared
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"git.mstar.dev/mstar/goutils/sliceutils"
|
|
)
|
|
|
|
var forbiddenUsernames = []string{
|
|
"server.actor",
|
|
"feed",
|
|
}
|
|
|
|
// Reports whether a given user name is valid (for non-internal systems)
|
|
//
|
|
// TODO: Include compat check for Mastodon?
|
|
func ValidateUsername(username string) bool {
|
|
if strings.HasSuffix(username, FeedUsernameSuffix) {
|
|
return false
|
|
}
|
|
if sliceutils.Contains(forbiddenUsernames, username) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|