Documentation ¶
Overview ¶
Package config stores and exports the configuration for server-side use and the public availability JSON struct, which includes a small subset of the server configuration.
Index ¶
- Variables
- func Clear()
- func ClearBoards()
- func GetBoards() []string
- func GetClient() ([]byte, string)
- func IsBoard(b string) bool
- func RemoveBoard(b string)
- func Set(c Configs) error
- func SetBoardConfigs(conf BoardConfigs) (bool, error)
- func SetClient(json []byte, cHash string)
- type BoardConfContainer
- type BoardConfigs
- type BoardPublic
- type BoardTitle
- type BoardTitles
- type Configs
- type Public
Constants ¶
This section is empty.
Variables ¶
var ( // AllBoardConfigs stores board-specific configurations for the /all/ // metaboard. Constant. AllBoardConfigs = BoardConfContainer{ BoardConfigs: BoardConfigs{ ID: "all", BoardPublic: BoardPublic{ Title: "Aggregator metaboard", }, }, Hash: "0", } // Defaults contains the default server configuration values Defaults = Configs{ ThreadExpiry: 14, BoardExpiry: 7, JPEGQuality: 80, MaxSize: 5, MaxHeight: 6000, MaxWidth: 6000, SessionExpiry: 30, Salt: "LALALALALALALALALALALALALALALALALALALALA", FeedbackEmail: "admin@email.com", RootURL: "http://localhost", FAQ: defaultFAQ, Public: Public{ DefaultCSS: "moe", DefaultLang: "en_GB", Links: map[string]string{"4chan": "http://www.4chan.org/"}, }, } // EightballDefaults contains the default eightball answer set EightballDefaults = []string{ "Yes", "No", "Maybe", "It can't be helped", "Hell yeah, motherfucker!", "Anta baka?", } )
Functions ¶
func ClearBoards ¶
func ClearBoards()
ClearBoards clears any existing board configuration entries. Only use in tests.
func GetClient ¶
GetClient returns public availability configuration JSON and a truncated configuration MD5 hash
func RemoveBoard ¶
func RemoveBoard(b string)
RemoveBoard removes a board from the exiting board list and deletes its configurations. To be called, when a board is deleted.
func SetBoardConfigs ¶
func SetBoardConfigs(conf BoardConfigs) (bool, error)
SetBoardConfigs sets configurations for a specific board as well as pregenerates their public JSON and hash. Returns if any changes were made to the configs in result.
Types ¶
type BoardConfContainer ¶
type BoardConfContainer struct { BoardConfigs JSON []byte Hash string }
BoardConfContainer contains configurations for an individual board as well as pregenerated public JSON and it's hash
func GetAllBoardConfigs ¶
func GetAllBoardConfigs() []BoardConfContainer
GetAllBoardConfigs returns board-specific configurations for all boards. Do not modify the retrieved structs.
func GetBoardConfigs ¶
func GetBoardConfigs(b string) BoardConfContainer
GetBoardConfigs returns board-specific configurations for a board combined with pregenerated public JSON of these configurations and their hash. Do not modify the retrieved struct.
type BoardConfigs ¶
type BoardConfigs struct { BoardPublic ID string `json:"id"` Eightball []string `json:"eightball"` }
BoardConfigs stores board-specific configuration
type BoardPublic ¶
type BoardPublic struct { ReadOnly bool `json:"readOnly"` TextOnly bool `json:"textOnly"` ForcedAnon bool `json:"forcedAnon"` Title string `json:"title"` Notice string `json:"notice"` Rules string `json:"rules"` }
BoardPublic contains publically accessible board-specific configurations
type BoardTitle ¶
BoardTitle contains a board's ID and title
type BoardTitles ¶
type BoardTitles []BoardTitle
BoardTitles implements sort.Interface
func GetBoardTitles ¶
func GetBoardTitles() BoardTitles
GetBoardTitles returns a slice of all existing boards and their titles
func (BoardTitles) Len ¶
func (b BoardTitles) Len() int
func (BoardTitles) Less ¶
func (b BoardTitles) Less(i, j int) bool
func (BoardTitles) Swap ¶
func (b BoardTitles) Swap(i, j int)
type Configs ¶
type Configs struct { Public PruneThreads bool `json:"pruneThreads"` PruneBoards bool `json:"pruneBoards"` Pyu bool `json:"pyu"` JPEGQuality uint8 MaxWidth uint16 `json:"maxWidth"` MaxHeight uint16 `json:"maxHeight"` ThreadExpiry uint `json:"threadExpiry"` BoardExpiry uint `json:"boardExpiry"` MaxSize uint `json:"maxSize"` SessionExpiry uint `json:"sessionExpiry"` RootURL string `json:"rootURL"` Salt string `json:"salt"` FeedbackEmail string `json:"feedbackEmail"` CaptchaPrivateKey string `json:"captchaPrivateKey"` FAQ string }
Configs stores the global server configuration
type Public ¶
type Public struct { Captcha bool `json:"captcha"` Mature bool `json:"mature"` DefaultLang string `json:"defaultLang"` DefaultCSS string `json:"defaultCSS"` CaptchaPublicKey string `json:"captchaPublicKey"` ImageRootOverride string `json:"imageRootOverride"` Links map[string]string `json:"links"` }
Public contains configurations exposeable through public availability APIs