summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Kangas <gabek@real-ity.com>2022-03-08 14:28:10 -0800
committerGabe Kangas <gabek@real-ity.com>2022-03-08 14:28:10 -0800
commit58d899adc7a1faab9432e66974ff1ef94cdb5697 (patch)
tree24f53f838e27325a5d82fd07d0ada08312f0d24b
parent31e0d9dc0805a41e240e1998a7ba572503546bb5 (diff)
Allow overriding go live email templategek/stream-notifications
-rw-r--r--notifications/email/email.go6
-rw-r--r--static/emailtemplates.go8
-rw-r--r--static/golive.html.tmpl (renamed from notifications/email/golive.tmpl.html)0
3 files changed, 10 insertions, 4 deletions
diff --git a/notifications/email/email.go b/notifications/email/email.go
index ef7b5c0b4..a1da045f0 100644
--- a/notifications/email/email.go
+++ b/notifications/email/email.go
@@ -9,12 +9,10 @@ import (
"text/template"
"github.com/owncast/owncast/core/data"
+ "github.com/owncast/owncast/static"
"github.com/pkg/errors"
)
-//go:embed "golive.tmpl.html"
-var goLiveTemplate string
-
// Email represents an instance of the Email notifier.
type Email struct {
From string
@@ -79,7 +77,7 @@ func GenerateEmailContent() (string, error) {
StreamDescription: data.GetStreamTitle(),
}
- t, err := template.New("goLive").Parse(goLiveTemplate)
+ t, err := template.New("goLive").Parse(static.GetEmailLiveTemplate())
if err != nil {
return "", errors.Wrap(err, "failed to parse go live email template")
}
diff --git a/static/emailtemplates.go b/static/emailtemplates.go
index 330b3d496..5e3cf0688 100644
--- a/static/emailtemplates.go
+++ b/static/emailtemplates.go
@@ -9,11 +9,19 @@ import (
//go:embed "emailconfirm.html.tmpl"
var emailConfirmTemplate []byte
+//go:embed "golive.html.tmpl"
+var goLiveTemplate []byte
+
// GetEmailConfirmTemplate will return the email confirmation template.
func GetEmailConfirmTemplate() string {
return string(getFileSystemStaticFileOrDefault("emailconfirm.html.tmpl", emailConfirmTemplate))
}
+// GetEmailLiveTemplate will return the email live template.
+func GetEmailLiveTemplate() string {
+ return string(getFileSystemStaticFileOrDefault("golive.html.tmpl", goLiveTemplate))
+}
+
// GetEmailConfirmTemplateWithContent will return the email confirmation
// template with content populated.
func GetEmailConfirmTemplateWithContent(title, subtitle, footer, button, buttonLink string) (string, error) {
diff --git a/notifications/email/golive.tmpl.html b/static/golive.html.tmpl
index c773fe52f..c773fe52f 100644
--- a/notifications/email/golive.tmpl.html
+++ b/static/golive.html.tmpl