config

package
v0.0.0-...-0e46d6e Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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
}

Channel config for a default public room.

type Config

type Config struct {
	Version int // will re-save your settings.toml on migrations

	JWT struct {
		Enabled        bool
		Strict         bool
		SecretKey      string
		LandingPageURL string
	}

	Title      string
	Branding   string
	WebsiteURL string

	CORSHosts       []string
	AdminAPIKey     string
	PermitNSFW      bool
	BlockableAdmins bool

	UseXForwardedFor bool

	WebSocketReadLimit   int64
	WebSocketSendTimeout int
	MaxImageWidth        int
	PreviewImageWidth    int

	TURN TurnConfig

	PublicChannels []Channel

	WebhookURLs []WebhookURL

	VIP VIP

	MessageFilters []*MessageFilter
	ModerationRule []*ModerationRule

	DirectMessageHistory DirectMessageHistory

	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

func (c Config) GetChannel(id string) (Channel, bool)

GetChannel looks up and returns a channel by ID.

func (Config) GetChannels

func (c Config) GetChannels() template.JS

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 DirectMessageHistory

type DirectMessageHistory struct {
	Enabled           bool
	SQLiteDatabase    string
	RetentionDays     int
	DisclaimerMessage string
}

type Logging

type Logging struct {
	Enabled   bool
	Directory string
	Channels  []string
	Usernames []string
}

Logging configs to monitor channels or usernames.

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
}

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 TurnConfig struct {
	URLs       []string
	Username   string
	Credential string
}

type VIP

type VIP struct {
	Name           string
	Branding       string
	Icon           string
	MutuallySecret bool
}

type WebhookURL

type WebhookURL struct {
	Name    string
	Enabled bool
	URL     string
}

WebhookURL allows tighter integration with your website.

Jump to

Keyboard shortcuts

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