const NewDirPermission = 0755
const NewFilePermission = 0644
var (
AlphaNumericAndSymbols = regexp.MustCompile(`^[0-9A-Za-z_\-]+$`)
FileNamePattern = regexp.MustCompile(`^[0-9A-Za-z_\-.]+$`)
FilePathPattern = regexp.MustCompile(`^[0-9A-Za-z_\-/.]+$`)
QuotePattern = regexp.MustCompile(`^>(.*)$`)
RefLinkPattern = regexp.MustCompile(`>>([0-9]+)`)
BoardLinkPattern = regexp.MustCompile(`>>>\/([0-9A-Za-z_-]+)?\/?`)
URLPattern = regexp.MustCompile(`(?i)(((f|ht)tp(s)?:\/\/)[-a-zA-Zа-яА-Я()0-9@%\!_+.,~#?&;:|\'\/=]+)`)
FixURLPattern1 = regexp.MustCompile(`(?i)\(\<a href\=\"(.*)\)"\ target\=\"\_blank\">(.*)\)\<\/a>`)
FixURLPattern2 = regexp.MustCompile(`(?i)\<a href\=\"(.*)\."\ target\=\"\_blank\">(.*)\.\<\/a>`)
FixURLPattern3 = regexp.MustCompile(`(?i)\<a href\=\"(.*)\,"\ target\=\"\_blank\">(.*)\,\<\/a>`)
)
func FormBool(r *http.Request, key string) bool
func FormInt(r *http.Request, key string) int
func FormInt64(r *http.Request, key string) int64
func FormMultiString(r *http.Request, key string) []string
func FormNegInt(r *http.Request, key string) int
func FormRange[T constraints.Integer](r *http.Request, key string, min T, max T) T
func FormString(r *http.Request, key string) string
func FormatDuration(d time.Duration) string
func FormatFileSize(size int64) string
func FormatRawTimestamp(timestamp int64) string
func FormatTimestamp(timestamp int64) template.HTML
func MIMEToExt(mimeType string) string
func ParseEmail(address string) string
func ParseFloat(v string) float64
func ParseInt(v string) int
func ParseInt64(v string) int64
func PathInt(r *http.Request, prefix string) int
func PathString(r *http.Request, prefix string) string
Config represents the server configuration.
type Config struct {
Locale string // Default locale. See locale directory for available languages.
Root string // Directory where board files are written to.
Serve string // Address:Port to listen for HTTP connections on.
Header string // Client IP address header.
SaltData string // Long random string of text used when one-way hashing data. Must not change once set.
SaltPass string // Long random string of text used when two-way hashing data. Must not change once set.
SaltTrip string // Long random string of text used when generating secure tripcodes. Must not change once set.
Address string // Address:Port to connect to the database.
Username string // Database username.
Password string // Database password.
DBName string // Database name.
DBURL string // Database connection URL.
MailAddress string // SMTP server Address:Port.
MailTLS bool // Whether TLS is used to connect to the server.
MailInsecure bool // Whether TLS certificate verification is skipped.
MailUsername string // SMTP server username.
MailPassword string // SMTP server password.
MailAuth string // SMTP server authentication mechanism. May be challenge / plain / none.
MailFrom string // "From" email address.
MailReplyTo string // "Reply-To" email address.
MailDomains string // Regular expression specifying allowed email address domains.
Mentions int // Duration (in minutes) mention notifications are batched together.
Notifications int // Duration (in minutes) non-mention notifications are batched together.
Template string // Custom template directory.
Identifiers bool // Whether staff may browse posts by IP hashes and boards may display identifier hashes.
Uploads []string // Supported upload file types.
Access map[string]string // Specifies which roles may perform each management or moderation action.
Import ImportConfig // Board import configuration.
ImportMode bool
ImportComplete bool
StartTime time.Time
// contains filtered or unexported fields
}
func (c *Config) UploadTypes() []*UploadType
ImportConfig represents a board import configuration.
type ImportConfig struct {
Address string // Address:Port to connect to the database.
Username string // Database username.
Password string // Database password.
DBName string // Database name.
Posts string // Posts table.
Keywords string // Keywords table.
}
func (c ImportConfig) Enabled() bool
type UploadType struct {
Ext string
MIME string
Thumb string
}