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 GetAllBoardConfigs() map[string]BoardConfContainer
- func GetBoards() []string
- func GetClient() ([]byte, string)
- func IsBoard(b string) bool
- func RemoveBoard(b string)
- func Set(c Configs) (err 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 ImagerModeType
- type Public
- type ServerConfigs
Constants ¶
This section is empty.
Variables ¶
var ( // AllBoardConfigs stores board-specific configurations for the /all/ // metaboard. Constant. AllBoardConfigs = BoardConfContainer{ BoardConfigs: BoardConfigs{ ID: "all", Eightball: EightballDefaults, BoardPublic: BoardPublic{ DefaultCSS: Defaults.DefaultCSS, Title: "Everything", Banners: []uint16{}, }, }, Hash: "0", } // Defaults contains the default server configuration values Defaults = Configs{ BoardExpiry: 7, MaxHeight: 6000, MaxWidth: 6000, SessionExpiry: 30, CharScore: 170, PostCreationScore: 15000, ImageScore: 15000, EmailErrPort: 587, Salt: "LALALALALALALALALALALALALALALALALALALALA", EmailErrMail: "filteredstaff@protonmail.com", EmailErrPass: "examplepassword", EmailErrSub: "smtp.gmail.com", FeedbackEmail: "filteredstaff@protonmail.com", RootURL: "https://filtered.fm", FAQ: defaultFAQ, CaptchaTags: []string{"patchouli_knowledge", "cirno", "hakurei_reimu"}, OverrideCaptchaTags: map[string]string{}, Public: Public{ ImageRootOverride: "https://static.filtered.fm", DefaultCSS: "dark", DefaultLang: "en_GB", ThreadExpiryMin: 7, ThreadExpiryMax: 14, MaxSize: 15, Links: map[string]string{}, }, } // EightballDefaults contains the default eightball answer set EightballDefaults = []string{ "Yes", "No", "Maybe", "That sounds emotionally dishonest", "idk", "lol", } )
Functions ¶
func ClearBoards ¶
func ClearBoards()
ClearBoards clears any existing board configuration entries. Only use in tests.
func GetAllBoardConfigs ¶
func GetAllBoardConfigs() map[string]BoardConfContainer
GetAllBoardConfigs returns board-specific configurations for all boards. Do not modify the retrieved structs.
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 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 DisableRobots bool `json:"disableRobots"` 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"` Flags bool `json:"flags"` NSFW bool RbText bool `json:"rbText"` Pyu bool `json:"pyu"` DefaultCSS string `json:"defaultCSS"` Title string `json:"title"` Notice string `json:"notice"` Rules string `json:"rules"` // Can't use []uint8, because it marshals to string Banners []uint16 `json:"banners"` }
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 PruneBoards bool `json:"pruneBoards"` HideNSFW bool `json:"hideNSFW"` EmailErr bool `json:"emailErr"` JPEGThumbnails bool `json:"JPEGThumbnails"` GlobalDisableRobots bool `json:"globalDisableRobots"` MaxWidth uint16 `json:"maxWidth"` MaxHeight uint16 `json:"maxHeight"` BoardExpiry uint `json:"boardExpiry"` SessionExpiry uint `json:"sessionExpiry"` EmailErrPort uint `json:"emailErrPort"` CharScore uint `json:"charScore"` PostCreationScore uint `json:"postCreationScore"` ImageScore uint `json:"imageScore"` RootURL string `json:"rootURL"` Salt string `json:"salt"` EmailErrMail string `json:"emailErrMail"` EmailErrPass string `json:"emailErrPass"` EmailErrSub string `json:"emailErrSub"` FeedbackEmail string `json:"feedbackEmail"` FAQ string CaptchaTags []string `json:"captchaTags"` OverrideCaptchaTags map[string]string `json:"overrideCaptchaTags"` }
Configs stores the global server configuration
type ImagerModeType ¶
type ImagerModeType int
ImagerModeType is the imager functionality setting for this ffmboard process
const ( // IntegratedImager is regular and imager functionality both handled by this process IntegratedImager ImagerModeType = iota // NoImager is imager functionality not handled by this process NoImager // ImagerOnly is only imager functionality handled by this process ImagerOnly )
type Public ¶
type Public struct { Captcha bool `json:"captcha"` Mature bool `json:"mature"` DisableUserBoards bool `json:"disableUserBoards"` PruneThreads bool `json:"pruneThreads"` ThreadExpiryMin uint `json:"threadExpiryMin"` ThreadExpiryMax uint `json:"threadExpiryMax"` MaxSize uint `json:"maxSize"` DefaultLang string `json:"defaultLang"` DefaultCSS string `json:"defaultCSS"` ImageRootOverride string `json:"imageRootOverride"` Links map[string]string `json:"links"` }
Public contains configurations exposeable through public availability APIs
type ServerConfigs ¶
type ServerConfigs struct { Debug bool ImagerMode ImagerModeType `json:"imager_mode"` Database string CacheSize float64 `json:"cache_size"` Server struct { ReverseProxied bool `json:"reverse_proxied"` Address string } Test struct { Database string } }
ServerConfigs of this specific instance passed from config file
var Server ServerConfigs
Server configurations of this specific instance passed from config file. Immutable after loading.
func (*ServerConfigs) Load ¶
func (c *ServerConfigs) Load() (err error)
Load configs from JSON or defaults, if none present