Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Current = DefaultConfig()
Current loaded configuration.
Functions ¶
func LoadSettings ¶
func LoadSettings() error
LoadSettings reads a settings.toml from disk if available.
func WriteSettings ¶
func WriteSettings() error
WriteSettings will commit the settings.toml to disk.
Types ¶
type Channel ¶
type Channel struct {
ID string // Like "lobby"
Name string // Like "Main Chat Room"
Icon string `toml:",omitempty"` // CSS class names for room icon (optional)
VIP bool // For VIP users only
PermitPhotos bool // photos are allowed to be shared
// ChatServer messages to send to the user immediately upon connecting.
WelcomeMessages []string
EchoMessagesOnJoin int
}
Channel config for a default public room.
type CommunityModeration ¶
type CommunityModeration struct {
Enabled bool
RedCameraFlagsWindow time.Duration `` /* 318-byte string literal not displayed */
RedCameraFlagsCount int `` /* 143-byte string literal not displayed */
RedCameraLockExpires time.Duration `` /* 228-byte string literal not displayed */
}
CommunityModeration configures the red camera moderation feature.
type Config ¶
type Config struct {
Version int `` // will re-save your settings.toml on migrations
/* 192-byte string literal not displayed */
JWT struct {
Enabled bool
Strict bool
SecretKey string
LandingPageURL string
} `toml:"" comment:"Use JWT tokens to log users into chat from your main website."`
Title string `toml:"" comment:"Your chat room title (plain text)"`
Branding string `` /* 147-byte string literal not displayed */
WebsiteURL string `toml:"" comment:"Your main website's base URL, for e.g. avatars and profile URLs to be relative to"`
CORSHosts []string
AdminAPIKey string
PermitNSFW bool
BlockableAdmins bool
AnnounceKicks bool `` /* 135-byte string literal not displayed */
UseXForwardedFor bool
WebSocketReadLimit int64
WebSocketSendTimeout int
ImageDMPermission string `toml:"" comment:"Who can share images in DMs? Ops, VIP users, or anybody?\nOne of: admin, vip, any, none"`
MaxImageWidth int
PreviewImageWidth int
HostImages bool `` /* 348-byte string literal not displayed */
HostImagesExpireDays int `toml:"" comment:"If hosting images, expire/remove the files from disk after this many days."`
HostImagesURLPrefix string `` /* 249-byte string literal not displayed */
TURN TurnConfig `` /* 560-byte string literal not displayed */
PublicChannels []Channel `toml:"" comment:"Your pre-defined common public chat rooms.\n"`
WebhookURLs []WebhookURL
VIP VIP
MessageFilters []*MessageFilter
ModerationRule []*ModerationRule
CommunityModeration CommunityModeration `` /* 238-byte string literal not displayed */
DirectMessageHistory DirectMessageHistory
DMLinkSpamProtection DMLinkSpamProtection
Strings Strings
Logging Logging
}
Config for your BareRTC app.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns sensible defaults and will write the initial settings.toml file to disk.
func (Config) GetChannel ¶
GetChannel looks up and returns a channel by ID.
func (Config) GetChannels ¶
GetChannels returns a JavaScript safe array of the default PublicChannels.
func (Config) GetModerationRule ¶
func (c Config) GetModerationRule(username string) *ModerationRule
GetModerationRule returns a matching ModerationRule for the given user, or nil if no rule is found.
type DMLinkSpamProtection ¶
type DMLinkSpamProtection struct {
Enabled bool `` /* 181-byte string literal not displayed */
MaxThreads int `toml:"" comment:"The max number of DM threads the user can paste the same link into"`
TimeLimit time.Duration `` /* 130-byte string literal not displayed */
BanHours time.Duration `` /* 133-byte string literal not displayed */
BlockUnsolicited bool `` /* 146-byte string literal not displayed */
UnsolicitedHours time.Duration `toml:"" comment:"If BlockUnsolicited is enabled, how many hours is it considered for the recent reply from the recipient."`
}
type DirectMessageHistory ¶
type DirectMessageHistory struct {
Enabled bool
DatabaseType string `toml:"" comment:"Which database driver to use: sqlite3, postgres"`
SQLiteDatabase string
PostgresDatabase string
RetentionDays int
DisclaimerMessage string
// Connection pooling.
DatabaseMaxIdleConns int `toml:"" comment:"Tune the connection pooling settings for your database.\nSet to 0 to not pool connections."`
DatabaseMaxOpenConns int
}
type MessageFilter ¶
type MessageFilter struct {
Enabled bool
PublicChannels bool
PrivateChannels bool
KeywordPhrases []string
CensorMessage bool
ForwardMessage bool
ReportMessage bool
ChatServerResponse string
// contains filtered or unexported fields
}
MessageFilter configures censored or auto-flagged messages in chat.
func (*MessageFilter) IterPhrases ¶
func (mf *MessageFilter) IterPhrases() []*regexp.Regexp
IterPhrases returns the keyword phrases as regular expressions.
type ModerationRule ¶
type ModerationRule struct {
Username string
CameraAlwaysNSFW bool
NoBroadcast bool
NoVideo bool
NoImage bool
NoDarkVideo bool
}
ModerationRule applies certain rules to moderate specific users.
type Strings ¶
type Strings struct {
ModRuleErrorCameraAlwaysNSFW string
ModRuleErrorNoBroadcast string
ModRuleErrorNoVideo string
ModRuleErrorNoImage string
}
Strings config for customizing certain user-facing messaging around the app.
type TurnConfig ¶
type WebhookURL ¶
WebhookURL allows tighter integration with your website.