model

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package model provides Sriracha data types.

Index

Constants

View Source
const (
	DefaultBoardThreads     = 10
	DefaultBoardReplies     = 3
	DefaultBoardMaxName     = 75
	DefaultBoardMaxEmail    = 75
	DefaultBoardMaxSubject  = 75
	DefaultBoardMaxMessage  = 8000
	DefaultBoardWordBreak   = 200
	DefaultBoardDefaultName = "Anonymous"
	DefaultBoardTruncate    = 15
	DefaultBoardMaxSize     = 2097152
	DefaultBoardThumbWidth  = 250
	DefaultBoardThumbHeight = 250
	DefaultBoardFiles       = 1
	DefaultBoardInstances   = 1
	DefaultBoardGallery     = true
)

Variables

This section is empty.

Functions

func FormatBoardApproval

func FormatBoardApproval(a BoardApproval) string

func FormatBoardHide

func FormatBoardHide(a BoardHide) string

func FormatBoardIdentifiers

func FormatBoardIdentifiers(i BoardIdentifiers) string

func FormatBoardLock

func FormatBoardLock(l BoardLock) string

func FormatBoardType

func FormatBoardType(t BoardType) string
func FormatRefLink(boardPath string, threadID int, postID int) []byte

func FormatRole

func FormatRole(role AccountRole) string

func Get added in v1.2.4

func Get(board *Board, account *Account, str string, vars ...interface{}) string

Types

type Account

type Account struct {
	ID         int
	Username   string
	Password   string
	Role       AccountRole
	LastActive int64
	Session    string
	Style      string
	Locale     string
}

func (*Account) LastActiveDate

func (a *Account) LastActiveDate() string

func (*Account) Validate

func (a *Account) Validate() error

type AccountRole

type AccountRole int
const (
	RoleSuperAdmin AccountRole = 1
	RoleAdmin      AccountRole = 2
	RoleMod        AccountRole = 3
	RoleDisabled   AccountRole = 99
)

Account roles.

type Ban

type Ban struct {
	ID        int
	IP        string
	Timestamp int64
	Expire    int64
	Reason    string
}

func (*Ban) ExpireDate

func (b *Ban) ExpireDate() string

func (*Ban) Info

func (b *Ban) Info() string

func (*Ban) TypeLabel

func (b *Ban) TypeLabel() string

func (*Ban) Validate

func (b *Ban) Validate() error
type Banner struct {
	ID        int
	Name      string
	Width     int
	Height    int
	Overboard bool
	News      bool
	Pages     bool
	Boards    []*Board `diff:"-"`
}

func (*Banner) HasBoard added in v1.3.7

func (b *Banner) HasBoard(id int) bool

func (*Banner) Validate added in v1.3.7

func (b *Banner) Validate() error

type Board

type Board struct {
	ID            int
	Dir           string
	Name          string
	Description   string
	Type          BoardType
	Hide          BoardHide
	Lock          BoardLock
	Approval      BoardApproval
	Reports       bool
	Style         string
	Locale        string
	Delay         int
	MinName       int
	MaxName       int
	MinEmail      int
	MaxEmail      int
	MinSubject    int
	MaxSubject    int
	MinMessage    int
	MaxMessage    int
	MinSizeThread int64
	MaxSizeThread int64
	MinSizeReply  int64
	MaxSizeReply  int64
	ThumbWidth    int
	ThumbHeight   int
	DefaultName   string
	WordBreak     int
	Truncate      int
	Threads       int
	Replies       int
	MaxThreads    int
	MaxReplies    int
	Oekaki        bool
	Backlinks     bool
	Files         int
	Instances     int
	Identifiers   BoardIdentifiers
	Gallery       bool

	// Calculated fields.
	Uploads []string
	Embeds  []string
	Rules   []string
	Unique  int `diff:"-"`
}

func NewBoard

func NewBoard() *Board

func (*Board) HasEmbed

func (b *Board) HasEmbed(name string) bool

func (*Board) HasUpload

func (b *Board) HasUpload(mimeType string) bool

func (*Board) MaxSizeLabel

func (b *Board) MaxSizeLabel(thread bool) string

func (*Board) Path

func (b *Board) Path() string

func (*Board) UploadTypesLabel

func (b *Board) UploadTypesLabel(uploadTypes []*UploadType) string

func (*Board) Validate

func (b *Board) Validate() error

type BoardApproval

type BoardApproval int
const (
	ApprovalNone BoardApproval = 0
	ApprovalFile BoardApproval = 1
	ApprovalAll  BoardApproval = 2
)

type BoardHide

type BoardHide int
const (
	HideNowhere    BoardHide = 0
	HideIndex      BoardHide = 1
	HideOverboard  BoardHide = 2
	HideEverywhere BoardHide = 3
)

type BoardIdentifiers

type BoardIdentifiers int
const (
	IdentifiersDisable BoardIdentifiers = 0
	IdentifiersBoard   BoardIdentifiers = 1
	IdentifiersGlobal  BoardIdentifiers = 2
)

type BoardLock

type BoardLock int
const (
	LockNone   BoardLock = 0
	LockThread BoardLock = 1
	LockPost   BoardLock = 2
	LockStaff  BoardLock = 3
)

Board lock types.

type BoardType

type BoardType int
const (
	TypeImageboard BoardType = 0
	TypeForum      BoardType = 1
)

Board types.

type CAPTCHA

type CAPTCHA struct {
	IP        string
	Timestamp int64
	Refresh   int
	Image     string
	Text      string
}

type Keyword

type Keyword struct {
	ID     int
	Text   string
	Action string
	Boards []*Board `diff:"-"`
}

func (*Keyword) ActionLabel

func (k *Keyword) ActionLabel(account *Account) string

func (*Keyword) HasBoard

func (k *Keyword) HasBoard(id int) bool

func (*Keyword) Validate

func (k *Keyword) Validate() error

type Log

type Log struct {
	ID        int
	Account   *Account
	Board     *Board
	Timestamp int64
	Message   string
	Changes   string
}

func (*Log) InfoLabel

func (l *Log) InfoLabel() template.HTML

func (*Log) MessageLabel

func (l *Log) MessageLabel() template.HTML

func (*Log) TimestampDate

func (l *Log) TimestampDate() string

type News

type News struct {
	ID        int
	Account   *Account
	Timestamp int64
	Modified  int64
	Share     bool
	Name      string
	Subject   string
	Message   string
}

func (*News) DateInput

func (n *News) DateInput() string

func (*News) DateLabel

func (n *News) DateLabel() template.HTML

func (*News) MayDelete

func (n *News) MayDelete(a *Account) bool

func (*News) MayUpdate

func (n *News) MayUpdate(a *Account) bool

func (*News) Published added in v1.3.9

func (n *News) Published() bool

func (*News) Validate

func (n *News) Validate() error

type Page added in v1.3.3

type Page struct {
	ID      int
	Path    string
	Content string
}

func (*Page) AddHeaderAndFooter added in v1.3.3

func (p *Page) AddHeaderAndFooter() bool

func (*Page) URL added in v1.3.3

func (p *Page) URL() string

func (*Page) Validate added in v1.3.3

func (p *Page) Validate() error

type Post

type Post struct {
	ID           int
	Board        *Board
	Parent       int
	Timestamp    int64
	Bumped       int64
	IP           string
	Name         string
	Tripcode     string
	Email        string
	NameBlock    string
	Subject      string
	Message      string
	Password     string
	File         string
	FileMIME     string
	FileHash     string
	FileOriginal string
	FileSize     int64
	FileWidth    int
	FileHeight   int
	Thumb        string
	ThumbWidth   int
	ThumbHeight  int
	Moderated    PostModerated
	Stickied     bool
	Locked       bool

	// Calculated fields.
	Replies int
}

func (*Post) AddMediaOverlay

func (p *Post) AddMediaOverlay(img image.Image) image.Image
func (p *Post) Backlinks(posts []*Post) template.HTML

func (*Post) Copy

func (p *Post) Copy() *Post

func (*Post) EmbedInfo

func (p *Post) EmbedInfo() []string

func (*Post) ExpandHTML

func (p *Post) ExpandHTML() template.HTML

func (*Post) FileSizeLabel

func (p *Post) FileSizeLabel() string

func (*Post) Identifier

func (p *Post) Identifier(identifiers bool, force bool) string

func (*Post) IsEmbed

func (p *Post) IsEmbed() bool

func (*Post) IsOekaki

func (p *Post) IsOekaki() bool

func (*Post) IsSWF

func (p *Post) IsSWF() bool

func (*Post) MessageTruncated

func (p *Post) MessageTruncated(lines int, account *Account) template.HTML
func (p *Post) RefLink() template.HTML

func (*Post) ResetAttachment added in v1.2.7

func (p *Post) ResetAttachment()

func (*Post) SetNameBlock

func (p *Post) SetNameBlock(defaultName string, capcode string, identifiers bool)

func (*Post) Thread

func (p *Post) Thread() int

func (*Post) TimestampLabel

func (p *Post) TimestampLabel() template.HTML

func (*Post) URL

func (p *Post) URL(siteHome string) string

type PostModerated

type PostModerated int
const (
	ModeratedHidden   PostModerated = 0
	ModeratedVisible  PostModerated = 1
	ModeratedApproved PostModerated = 2
)

type Report

type Report struct {
	ID        int
	Board     *Board
	Post      *Post
	Timestamp int64
	IP        string

	// Calculated fields.
	Count int
}

type Subscription added in v1.3.9

type Subscription struct {
	ID      int
	IP      string // For anti-spam protection. Cleared after 24 hours.
	Confirm int64  // Timestamp when confirmation request was zent, or zero once confirmed.
	Email   string // Email address.
	Board   int    // Only set when Target is a SubscriptionType.
	Target  int    // When greater than zero, Target is a post ID. Otherwise, Target is a SubscriptionType.
}

func (*Subscription) Validate added in v1.3.9

func (s *Subscription) Validate() error

type SubscriptionType added in v1.3.9

type SubscriptionType int
const (
	SubscriptionAll     SubscriptionType = 0  // Subscribe to all new posts.
	SubscriptionThreads SubscriptionType = -1 // Subscribe to new threads.
)

Jump to

Keyboard shortcuts

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