data

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BanIPAddress added in v0.0.12

func BanIPAddress(address, note string) error

BanIPAddress will persist a new IP address ban to the datastore.

func CreateBanIPTable added in v0.0.12

func CreateBanIPTable(db *sql.DB)

CreateBanIPTable will create the IP ban table if needed.

func CreateMessagesTable added in v0.0.8

func CreateMessagesTable(db *sql.DB)

CreateMessagesTable will create the chat messages table if needed.

func DeleteWebhook added in v0.0.6

func DeleteWebhook(id int) error

DeleteWebhook will delete a webhook from the database.

func FindHighestVideoQualityIndex added in v0.0.6

func FindHighestVideoQualityIndex(qualities []models.StreamOutputVariant) (int, bool)

FindHighestVideoQualityIndex will return the highest quality from a slice of variants.

func GetAdminPassword added in v0.1.0

func GetAdminPassword() string

GetAdminPassword will return the admin password.

func GetBlockedFederatedDomains added in v0.0.11

func GetBlockedFederatedDomains() []string

GetBlockedFederatedDomains will return a list of blocked federated domains.

func GetBrowserPushConfig added in v0.0.12

func GetBrowserPushConfig() models.BrowserNotificationConfiguration

GetBrowserPushConfig will return the browser push configuration.

func GetBrowserPushPrivateKey added in v0.0.12

func GetBrowserPushPrivateKey() (string, error)

GetBrowserPushPrivateKey will return the private key for browser pushes.

func GetBrowserPushPublicKey added in v0.0.12

func GetBrowserPushPublicKey() (string, error)

GetBrowserPushPublicKey will return the public key for browser pushes.

func GetChatDisabled added in v0.0.7

func GetChatDisabled() bool

GetChatDisabled will return if chat is disabled.

func GetChatEstbalishedUsersOnlyMode added in v0.0.12

func GetChatEstbalishedUsersOnlyMode() bool

GetChatEstbalishedUsersOnlyMode returns the state of established user only mode.

func GetChatJoinPartMessagesEnabled added in v0.1.2

func GetChatJoinPartMessagesEnabled() bool

GetChatJoinPartMessagesEnabled will return if chat join messages are enabled.

func GetCustomColorVariableValues added in v0.1.0

func GetCustomColorVariableValues() map[string]string

GetCustomColorVariableValues gets CSS variable names and values.

func GetCustomJavascript added in v0.1.0

func GetCustomJavascript() string

GetCustomJavascript will return a string with Javascript to insert into the page.

func GetCustomOfflineMessage added in v0.1.0

func GetCustomOfflineMessage() string

GetCustomOfflineMessage will return the custom offline message.

func GetCustomStyles added in v0.0.7

func GetCustomStyles() string

GetCustomStyles will return a string with CSS to insert into the page.

func GetDatabase

func GetDatabase() *sql.DB

GetDatabase will return the shared instance of the actual database.

func GetDefaultFederationUsername added in v0.0.11

func GetDefaultFederationUsername() string

GetDefaultFederationUsername will return the username used for sending federation activities.

func GetDirectoryEnabled added in v0.0.6

func GetDirectoryEnabled() bool

GetDirectoryEnabled will return if this server should register to YP.

func GetDirectoryRegistrationKey added in v0.0.6

func GetDirectoryRegistrationKey() string

GetDirectoryRegistrationKey will return the YP protocol registration key.

func GetDisableSearchIndexing added in v0.1.1

func GetDisableSearchIndexing() bool

GetDisableSearchIndexing will return if the web server should be indexable.

func GetDiscordConfig added in v0.0.12

func GetDiscordConfig() models.DiscordConfiguration

GetDiscordConfig will return the Discord configuration.

func GetEmojiList added in v0.1.0

func GetEmojiList() []models.CustomEmoji

GetEmojiList returns a list of custom emoji from the emoji directory.

func GetExternalActions added in v0.0.7

func GetExternalActions() []models.ExternalAction

GetExternalActions will return the registered external actions.

func GetExtraPageBodyContent added in v0.0.6

func GetExtraPageBodyContent() string

GetExtraPageBodyContent will return the user-supplied body content.

func GetFederatedInboxMap added in v0.0.11

func GetFederatedInboxMap() map[string]string

GetFederatedInboxMap is a mapping between account names and their outbox.

func GetFederationEnabled added in v0.0.11

func GetFederationEnabled() bool

GetFederationEnabled will return if federation is enabled.

func GetFederationGoLiveMessage added in v0.0.11

func GetFederationGoLiveMessage() string

GetFederationGoLiveMessage will return the message sent when going live.

func GetFederationIsPrivate added in v0.0.11

func GetFederationIsPrivate() bool

GetFederationIsPrivate will return if federation is private.

func GetFederationShowEngagement added in v0.0.11

func GetFederationShowEngagement() bool

GetFederationShowEngagement will return if fediverse engagement shows in chat.

func GetFederationUsername added in v0.0.11

func GetFederationUsername() string

GetFederationUsername will return the username used in federated activities.

func GetFfMpegPath added in v0.0.6

func GetFfMpegPath() string

GetFfMpegPath will return the ffmpeg path.

func GetForbiddenUsernameList added in v0.0.8

func GetForbiddenUsernameList() []string

GetForbiddenUsernameList will return the blocked usernames as a comma separated string.

func GetHTTPListenAddress added in v0.0.8

func GetHTTPListenAddress() string

GetHTTPListenAddress will return the HTTP listen address.

func GetHTTPPortNumber added in v0.0.6

func GetHTTPPortNumber() int

GetHTTPPortNumber will return the server HTTP port.

func GetHasPerformedInitialNotificationsConfig added in v0.0.12

func GetHasPerformedInitialNotificationsConfig() bool

GetHasPerformedInitialNotificationsConfig gets when performed initial setup.

func GetHideViewerCount added in v0.1.0

func GetHideViewerCount() bool

GetHideViewerCount will return if the viewer count shold be hidden.

func GetIPAddressBans added in v0.0.12

func GetIPAddressBans() ([]models.IPAddress, error)

GetIPAddressBans will return all the banned IP addresses.

func GetLastDisconnectTime added in v0.0.6

func GetLastDisconnectTime() (*utils.NullTime, error)

GetLastDisconnectTime will return the time the last stream ended.

func GetLogoPath added in v0.0.6

func GetLogoPath() string

GetLogoPath will return the path for the logo, relative to webroot.

func GetLogoUniquenessString added in v0.0.12

func GetLogoUniquenessString() string

GetLogoUniquenessString will return the logo cache busting string.

func GetMessagesCount added in v0.0.12

func GetMessagesCount() int64

GetMessagesCount will return the number of messages in the database.

func GetNSFW added in v0.0.6

func GetNSFW() bool

GetNSFW will return if this stream has NSFW content.

func GetNotificationsEnabled added in v0.0.12

func GetNotificationsEnabled() bool

GetNotificationsEnabled will return the enabled state of notifications.

func GetPeakOverallViewerCount added in v0.0.6

func GetPeakOverallViewerCount() int

GetPeakOverallViewerCount will return the overall max number of viewers.

func GetPeakSessionViewerCount added in v0.0.6

func GetPeakSessionViewerCount() int

GetPeakSessionViewerCount will return the max number of viewers for this stream.

func GetPrivateKey added in v0.0.11

func GetPrivateKey() string

GetPrivateKey will return the private key.

func GetPublicKey added in v0.0.11

func GetPublicKey() string

GetPublicKey will return the public key.

func GetRTMPPortNumber added in v0.0.6

func GetRTMPPortNumber() int

GetRTMPPortNumber will return the server RTMP port.

func GetS3Config added in v0.0.6

func GetS3Config() models.S3

GetS3Config will return the external storage configuration.

func GetServerInitTime added in v0.0.11

func GetServerInitTime() (*utils.NullTime, error)

GetServerInitTime will return when the server was first setup.

func GetServerMetadataTags added in v0.0.6

func GetServerMetadataTags() []string

GetServerMetadataTags will return the metadata tags.

func GetServerName added in v0.0.6

func GetServerName() string

GetServerName will return the server name text.

func GetServerSummary added in v0.0.6

func GetServerSummary() string

GetServerSummary will return the server summary text.

func GetServerURL added in v0.0.6

func GetServerURL() string

GetServerURL will return the server URL.

func GetServerWelcomeMessage added in v0.0.7

func GetServerWelcomeMessage() string

GetServerWelcomeMessage will return the server welcome message text.

func GetSocialHandles added in v0.0.6

func GetSocialHandles() []models.SocialHandle

GetSocialHandles will return the external social links.

func GetStreamKeys added in v0.1.0

func GetStreamKeys() []models.StreamKey

GetStreamKeys will return valid stream keys.

func GetStreamLatencyLevel added in v0.0.6

func GetStreamLatencyLevel() models.LatencyLevel

GetStreamLatencyLevel will return the stream latency level.

func GetStreamOutputVariants added in v0.0.6

func GetStreamOutputVariants() []models.StreamOutputVariant

GetStreamOutputVariants will return all of the stream output variants.

func GetStreamTitle added in v0.0.6

func GetStreamTitle() string

GetStreamTitle will return the name of the current stream.

func GetSuggestedUsernamesList added in v0.0.11

func GetSuggestedUsernamesList() []string

GetSuggestedUsernamesList will return the suggested usernames. If the number of suggested usernames is smaller than 10, the number pool is not used (see code in the CreateAnonymousUser function).

func GetUsersCount added in v0.0.12

func GetUsersCount() int64

GetUsersCount will return the number of users in the database.

func GetVideoCodec added in v0.0.7

func GetVideoCodec() string

GetVideoCodec returns the codec to use for transcoding video.

func GetVideoServingEndpoint added in v0.1.1

func GetVideoServingEndpoint() string

GetVideoServingEndpoint returns the custom video endpont.

func GetWebhooks added in v0.0.6

func GetWebhooks() ([]models.Webhook, error)

GetWebhooks will return all the webhooks.

func GetWebhooksForEvent added in v0.0.6

func GetWebhooksForEvent(event models.EventType) []models.Webhook

GetWebhooksForEvent will return all of the webhooks that want to be notified about an event type.

func GetWebsocketOverrideHost added in v0.0.12

func GetWebsocketOverrideHost() string

GetWebsocketOverrideHost will return the host override for websockets.

func HasPopulatedDefaults added in v0.0.6

func HasPopulatedDefaults() bool

HasPopulatedDefaults will determine if the defaults have been inserted into the database.

func InsertWebhook added in v0.0.6

func InsertWebhook(url string, events []models.EventType) (int, error)

InsertWebhook will add a new webhook to the database.

func IsIPAddressBanned added in v0.0.12

func IsIPAddressBanned(address string) (bool, error)

IsIPAddressBanned will return if an IP address has been previously blocked.

func MustExec added in v0.0.13

func MustExec(s string, db *sql.DB)

MustExec will execute a SQL statement on a provided database instance.

func PopulateDefaults added in v0.0.6

func PopulateDefaults()

PopulateDefaults will set default values in the database.

func RemoveIPAddressBan added in v0.0.12

func RemoveIPAddressBan(address string) error

RemoveIPAddressBan will remove a previously banned IP address.

func SetAdminPassword added in v0.1.0

func SetAdminPassword(key string) error

SetAdminPassword will set the admin password.

func SetBlockedFederatedDomains added in v0.0.11

func SetBlockedFederatedDomains(domains []string) error

SetBlockedFederatedDomains will set the blocked federated domains.

func SetBrowserPushConfig added in v0.0.12

func SetBrowserPushConfig(config models.BrowserNotificationConfiguration) error

SetBrowserPushConfig will set the browser push configuration.

func SetBrowserPushPrivateKey added in v0.0.12

func SetBrowserPushPrivateKey(key string) error

SetBrowserPushPrivateKey will set the private key for browser pushes.

func SetBrowserPushPublicKey added in v0.0.12

func SetBrowserPushPublicKey(key string) error

SetBrowserPushPublicKey will set the public key for browser pushes.

func SetChatDisabled added in v0.0.7

func SetChatDisabled(disabled bool) error

SetChatDisabled will disable chat if set to true.

func SetChatEstablishedUsersOnlyMode added in v0.0.12

func SetChatEstablishedUsersOnlyMode(enabled bool) error

SetChatEstablishedUsersOnlyMode sets the state of established user only mode.

func SetChatJoinMessagesEnabled added in v0.0.12

func SetChatJoinMessagesEnabled(enabled bool) error

SetChatJoinMessagesEnabled will set if chat join messages are enabled.

func SetCustomColorVariableValues added in v0.1.0

func SetCustomColorVariableValues(variables map[string]string) error

SetCustomColorVariableValues sets CSS variable names and values.

func SetCustomJavascript added in v0.1.0

func SetCustomJavascript(styles string) error

SetCustomJavascript will save a string with Javascript to insert into the page.

func SetCustomOfflineMessage added in v0.1.0

func SetCustomOfflineMessage(message string) error

SetCustomOfflineMessage will set the custom offline message.

func SetCustomStyles added in v0.0.7

func SetCustomStyles(styles string) error

SetCustomStyles will save a string with CSS to insert into the page.

func SetDirectoryEnabled added in v0.0.6

func SetDirectoryEnabled(enabled bool) error

SetDirectoryEnabled will set if this server should register to YP.

func SetDirectoryRegistrationKey added in v0.0.6

func SetDirectoryRegistrationKey(key string) error

SetDirectoryRegistrationKey will set the YP protocol registration key.

func SetDisableSearchIndexing added in v0.1.1

func SetDisableSearchIndexing(disableSearchIndexing bool) error

SetDisableSearchIndexing will set if the web server should be indexable.

func SetDiscordConfig added in v0.0.12

func SetDiscordConfig(config models.DiscordConfiguration) error

SetDiscordConfig will set the Discord configuration.

func SetExternalActions added in v0.0.7

func SetExternalActions(actions []models.ExternalAction) error

SetExternalActions will save external actions.

func SetExtraPageBodyContent added in v0.0.6

func SetExtraPageBodyContent(content string) error

SetExtraPageBodyContent will set the user-supplied body content.

func SetFederationEnabled added in v0.0.11

func SetFederationEnabled(enabled bool) error

SetFederationEnabled will enable federation if set to true.

func SetFederationGoLiveMessage added in v0.0.11

func SetFederationGoLiveMessage(message string) error

SetFederationGoLiveMessage will set the message sent when going live.

func SetFederationIsPrivate added in v0.0.11

func SetFederationIsPrivate(isPrivate bool) error

SetFederationIsPrivate will set if federation activity is private.

func SetFederationShowEngagement added in v0.0.11

func SetFederationShowEngagement(showEngagement bool) error

SetFederationShowEngagement will set if fediverse engagement shows in chat.

func SetFederationUsername added in v0.0.11

func SetFederationUsername(username string) error

SetFederationUsername will set the username used in federated activities.

func SetFfmpegPath added in v0.0.6

func SetFfmpegPath(path string) error

SetFfmpegPath will set the custom ffmpeg path.

func SetForbiddenUsernameList added in v0.0.8

func SetForbiddenUsernameList(usernames []string) error

SetForbiddenUsernameList set the username blocklist as a comma separated string.

func SetHTTPListenAddress added in v0.0.8

func SetHTTPListenAddress(address string) error

SetHTTPListenAddress will set the server HTTP listen address.

func SetHTTPPortNumber added in v0.0.6

func SetHTTPPortNumber(port float64) error

SetHTTPPortNumber will set the server HTTP port.

func SetHasPerformedInitialNotificationsConfig added in v0.0.12

func SetHasPerformedInitialNotificationsConfig(hasConfigured bool) error

SetHasPerformedInitialNotificationsConfig sets when performed initial setup.

func SetHideViewerCount added in v0.1.0

func SetHideViewerCount(hide bool) error

SetHideViewerCount will set if the viewer count should be hidden.

func SetLastDisconnectTime added in v0.0.6

func SetLastDisconnectTime(disconnectTime time.Time) error

SetLastDisconnectTime will set the time the last stream ended.

func SetLogoPath added in v0.0.6

func SetLogoPath(logo string) error

SetLogoPath will set the path for the logo, relative to webroot.

func SetLogoUniquenessString added in v0.0.12

func SetLogoUniquenessString(uniqueness string) error

SetLogoUniquenessString will set the logo cache busting string.

func SetNSFW added in v0.0.6

func SetNSFW(isNSFW bool) error

SetNSFW will set if this stream has NSFW content.

func SetNotificationsEnabled added in v0.0.12

func SetNotificationsEnabled(enabled bool) error

SetNotificationsEnabled will save the enabled state of notifications.

func SetPeakOverallViewerCount added in v0.0.6

func SetPeakOverallViewerCount(count int) error

SetPeakOverallViewerCount will set the overall max number of viewers.

func SetPeakSessionViewerCount added in v0.0.6

func SetPeakSessionViewerCount(count int) error

SetPeakSessionViewerCount will set the max number of viewers for this stream.

func SetPrivateKey added in v0.0.11

func SetPrivateKey(key string) error

SetPrivateKey will save the private key.

func SetPublicKey added in v0.0.11

func SetPublicKey(key string) error

SetPublicKey will save the public key.

func SetRTMPPortNumber added in v0.0.6

func SetRTMPPortNumber(port float64) error

SetRTMPPortNumber will set the server RTMP port.

func SetS3Config added in v0.0.6

func SetS3Config(config models.S3) error

SetS3Config will set the external storage configuration.

func SetServerInitTime added in v0.0.11

func SetServerInitTime(t time.Time) error

SetServerInitTime will set when the server was first created.

func SetServerMetadataTags added in v0.0.6

func SetServerMetadataTags(tags []string) error

SetServerMetadataTags will return the metadata tags.

func SetServerName added in v0.0.6

func SetServerName(name string) error

SetServerName will set the server name text.

func SetServerSummary added in v0.0.6

func SetServerSummary(summary string) error

SetServerSummary will set the server summary text.

func SetServerURL added in v0.0.6

func SetServerURL(url string) error

SetServerURL will set the server URL.

func SetServerWelcomeMessage added in v0.0.7

func SetServerWelcomeMessage(welcomeMessage string) error

SetServerWelcomeMessage will set the server welcome message text.

func SetSocialHandles added in v0.0.6

func SetSocialHandles(socialHandles []models.SocialHandle) error

SetSocialHandles will set the external social links.

func SetStreamKeys added in v0.1.0

func SetStreamKeys(actions []models.StreamKey) error

SetStreamKeys will set valid stream keys.

func SetStreamLatencyLevel added in v0.0.6

func SetStreamLatencyLevel(level float64) error

SetStreamLatencyLevel will set the stream latency level.

func SetStreamOutputVariants added in v0.0.6

func SetStreamOutputVariants(variants []models.StreamOutputVariant) error

SetStreamOutputVariants will set the stream output variants.

func SetStreamTitle added in v0.0.6

func SetStreamTitle(title string) error

SetStreamTitle will set the name of the current stream.

func SetSuggestedUsernamesList added in v0.0.11

func SetSuggestedUsernamesList(usernames []string) error

SetSuggestedUsernamesList sets the username suggestion list.

func SetVideoCodec added in v0.0.7

func SetVideoCodec(codec string) error

SetVideoCodec will set the codec used for video encoding.

func SetVideoServingEndpoint added in v0.1.1

func SetVideoServingEndpoint(message string) error

SetVideoServingEndpoint sets the custom video endpoint.

func SetWebhookAsUsed added in v0.0.6

func SetWebhookAsUsed(webhook models.Webhook) error

SetWebhookAsUsed will update the last used time for a webhook.

func SetWebsocketOverrideHost added in v0.0.12

func SetWebsocketOverrideHost(host string) error

SetWebsocketOverrideHost will set the host override for websockets.

func SetupEmojiDirectory added in v0.1.0

func SetupEmojiDirectory() (err error)

SetupEmojiDirectory sets up the custom emoji directory by copying all built-in emojis if the directory does not yet exist.

func SetupPersistence

func SetupPersistence(file string) error

SetupPersistence will open the datastore and make it available.

func UpdateEmojiList added in v0.1.1

func UpdateEmojiList(force bool) (time.Time, error)

UpdateEmojiList will update the cache (if required) and return the modifiation time.

func VerifySettings added in v0.0.6

func VerifySettings() error

VerifySettings will perform a sanity check for specific settings values.

Types

type ConfigEntry added in v0.0.6

type ConfigEntry struct {
	Value interface{}
	Key   string
}

ConfigEntry is the actual object saved to the database. The Value is encoded using encoding/gob.

type Datastore added in v0.0.6

type Datastore struct {
	DB *sql.DB

	DbLock *sync.Mutex
	// contains filtered or unexported fields
}

Datastore is the global key/value store for configuration values.

func GetDatastore added in v0.0.8

func GetDatastore() *Datastore

GetDatastore returns the shared instance of the owncast datastore.

func GetStore added in v0.0.6

func GetStore() *Datastore

GetStore will return the shared instance of the read/write datastore.

func (*Datastore) Get added in v0.0.6

func (ds *Datastore) Get(key string) (ConfigEntry, error)

Get will query the database for the key and return the entry.

func (*Datastore) GetBool added in v0.0.6

func (ds *Datastore) GetBool(key string) (bool, error)

GetBool will return the boolean value for a key.

func (*Datastore) GetCachedValue added in v0.0.6

func (ds *Datastore) GetCachedValue(key string) ([]byte, error)

GetCachedValue will return a value for key from the cache.

func (*Datastore) GetNumber added in v0.0.6

func (ds *Datastore) GetNumber(key string) (float64, error)

GetNumber will return the numeric value for a key.

func (*Datastore) GetQueries added in v0.0.11

func (ds *Datastore) GetQueries() *db.Queries

GetQueries will return the shared instance of the SQL query generator.

func (*Datastore) GetString added in v0.0.6

func (ds *Datastore) GetString(key string) (string, error)

GetString will return the string value for a key.

func (*Datastore) GetStringMap added in v0.1.0

func (ds *Datastore) GetStringMap(key string) (map[string]string, error)

GetStringMap will return the string map value for a key.

func (*Datastore) GetStringSlice added in v0.0.12

func (ds *Datastore) GetStringSlice(key string) ([]string, error)

GetStringSlice will return the string slice value for a key.

func (*Datastore) MustExec added in v0.0.13

func (ds *Datastore) MustExec(s string)

MustExec will execute a SQL statement on a provided database instance.

func (*Datastore) Reset added in v0.0.6

func (ds *Datastore) Reset()

Reset will delete all config entries in the datastore and start over.

func (*Datastore) Save added in v0.0.6

func (ds *Datastore) Save(e ConfigEntry) error

Save will save the ConfigEntry to the database.

func (*Datastore) SetBool added in v0.0.6

func (ds *Datastore) SetBool(key string, value bool) error

SetBool will set the boolean value for a key.

func (*Datastore) SetCachedValue added in v0.0.6

func (ds *Datastore) SetCachedValue(key string, b []byte)

SetCachedValue will set a value for key in the cache.

func (*Datastore) SetNumber added in v0.0.6

func (ds *Datastore) SetNumber(key string, value float64) error

SetNumber will set the numeric value for a key.

func (*Datastore) SetString added in v0.0.6

func (ds *Datastore) SetString(key string, value string) error

SetString will set the string value for a key.

func (*Datastore) SetStringMap added in v0.1.0

func (ds *Datastore) SetStringMap(key string, value map[string]string) error

SetStringMap will set the string map value for a key.

func (*Datastore) SetStringSlice added in v0.0.12

func (ds *Datastore) SetStringSlice(key string, value []string) error

SetStringSlice will set the string slice value for a key.

func (*Datastore) Setup added in v0.0.6

func (ds *Datastore) Setup()

Setup will create the datastore table and perform initial initialization.

Jump to

Keyboard shortcuts

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