Allow adding custom javascript to the page. Closes #2604

This commit is contained in:
Gabe Kangas
2023-01-18 22:38:24 -08:00
parent 053a33ac47
commit 19c228eaf6
15 changed files with 211 additions and 6 deletions

View File

@ -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)