const NewDirPermission = 0755
const NewFilePermission = 0640
var (
AlphaNumericAndSymbols = 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 FormatFileSize(size int64) string
func FormatRawTimestamp(timestamp int64) string
func FormatTimestamp(timestamp int64) template.HTML
func MIMEToExt(mimeType 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.
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.
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
}