checker

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LevelC
	LevelB
	LevelA
	LevelS
)
View Source
const (
	QuestionLinkTypeURL = 1
	QuestionLinkTypeID  = 2
)
View Source
const (
	PasswordCannotContainSpaces = "error.password.space_invalid"
)

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string) error

CheckPassword checks the password strength

func DecodeAndCheckImageFile

func DecodeAndCheckImageFile(localFilePath string, maxImageMegapixel int) bool

DecodeAndCheckImageFile currently answers support image type is `image/jpeg, image/jpg, image/png, image/gif, image/webp`

func EmailInAllowEmailDomain

func EmailInAllowEmailDomain(email string, allowEmailDomains []string) bool

func IsChinese

func IsChinese(str string) bool

func IsInvalidUsername

func IsInvalidUsername(username string) bool

func IsNotZeroString

func IsNotZeroString(s string) bool

IsNotZeroString check s is not empty string and is not "0"

func IsQuestionsIgnorePath

func IsQuestionsIgnorePath(questionID string) bool

IsQuestionsIgnorePath checks whether the questionID is in ignore path

func IsReservedUsername

func IsReservedUsername(username string) bool

IsReservedUsername checks whether the username is reserved

func IsURL

func IsURL(str string) bool

func IsUnAuthorizedExtension

func IsUnAuthorizedExtension(fileName string, allowedExtensions []string) bool

IsUnAuthorizedExtension check whether the file extension is not in the allowedExtensions WANING Only checks the file extension is not reliable, but `http.DetectContentType` and `mimetype` are not reliable for all file types.

func IsUsersIgnorePath

func IsUsersIgnorePath(username string) bool

IsUsersIgnorePath checks whether the username is in ignore path

Types

type PathIgnore

type PathIgnore struct {
	Users     []string `yaml:"users"`
	Questions []string `yaml:"questions"`
}
type QuestionLink struct {
	LinkType   int
	QuestionID string
	AnswerID   string
}
func GetQuestionLink(content string) []QuestionLink

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL