From 58d899adc7a1faab9432e66974ff1ef94cdb5697 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Tue, 8 Mar 2022 14:28:10 -0800 Subject: Allow overriding go live email template --- notifications/email/email.go | 6 +- notifications/email/golive.tmpl.html | 487 ----------------------------------- static/emailtemplates.go | 8 + static/golive.html.tmpl | 487 +++++++++++++++++++++++++++++++++++ 4 files changed, 497 insertions(+), 491 deletions(-) delete mode 100644 notifications/email/golive.tmpl.html create mode 100644 static/golive.html.tmpl 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/notifications/email/golive.tmpl.html b/notifications/email/golive.tmpl.html deleted file mode 100644 index c773fe52f..000000000 --- a/notifications/email/golive.tmpl.html +++ /dev/null @@ -1,487 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  -
- -
- - 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/static/golive.html.tmpl b/static/golive.html.tmpl new file mode 100644 index 000000000..c773fe52f --- /dev/null +++ b/static/golive.html.tmpl @@ -0,0 +1,487 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  +
+ +
+ + -- cgit v1.2.3