mirror of
https://github.com/owncast/owncast.git
synced 2025-11-01 10:55:57 +08:00
Allow adding custom javascript to the page. Closes #2604
This commit is contained in:
@ -44,6 +44,7 @@ const (
|
||||
chatDisabledKey = "chat_disabled"
|
||||
externalActionsKey = "external_actions"
|
||||
customStylesKey = "custom_styles"
|
||||
customJavascriptKey = "custom_javascript"
|
||||
videoCodecKey = "video_codec"
|
||||
blockedUsernamesKey = "blocked_usernames"
|
||||
publicKeyKey = "public_key"
|
||||
@ -560,6 +561,21 @@ func GetCustomStyles() string {
|
||||
return style
|
||||
}
|
||||
|
||||
// SetCustomJavascript will save a string with Javascript to insert into the page.
|
||||
func SetCustomJavascript(styles string) error {
|
||||
return _datastore.SetString(customJavascriptKey, styles)
|
||||
}
|
||||
|
||||
// GetCustomJavascript will return a string with Javascript to insert into the page.
|
||||
func GetCustomJavascript() string {
|
||||
style, err := _datastore.GetString(customJavascriptKey)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
||||
|
||||
// SetVideoCodec will set the codec used for video encoding.
|
||||
func SetVideoCodec(codec string) error {
|
||||
return _datastore.SetString(videoCodecKey, codec)
|
||||
|
||||
Reference in New Issue
Block a user