email: change font, template common parts

Using the newer Jellyfin logo font for the header and hanken grotesk for the body.
Tried to redo emails with maizzle because using tailwind sounded nice, but getting it
to look like a17t would be more trouble than it's worth, since you can't
use CSS vars in emails and a17t uses them heavily. Instead, cleaned up
the mj-header a little and stored it in a separate file, and also the
header & footer, and changed the template vars with {{ .header }}  and
{{ .footer }} for all emails. Values are determined by
CustomContentInfo.Header/FooterText funcs. nil values are replaced at
program start by _runtimeValidator.

also, i beg of you don't try to do light/dark mode with mjml, you'll
want to die.
This commit is contained in:
Harvey Tindall
2025-09-01 15:27:57 +01:00
parent eb941794a8
commit 8781e48601
22 changed files with 318 additions and 893 deletions

View File

@@ -21,6 +21,7 @@ steps:
commands: commands:
- npm i - npm i
- make precompile - make precompile
- go mod download
- name: test - name: test
image: docker.io/hrfee/jfa-go-build-docker:latest image: docker.io/hrfee/jfa-go-build-docker:latest
environment: environment:

18
css/colors.js Normal file
View File

@@ -0,0 +1,18 @@
const colors = require("tailwindcss/colors");
const dark = require("../css/dark");
export const colorSet = {
neutral: colors.slate,
positive: colors.green,
urge: colors.violet,
warning: colors.yellow,
info: colors.blue,
critical: colors.red,
d_neutral: dark.d_neutral,
d_positive: dark.d_positive,
d_urge: dark.d_urge,
d_warning: dark.d_warning,
d_info: dark.d_info,
d_critical: dark.d_critical,
discord: "#5865F2"
};

View File

@@ -19,6 +19,18 @@ func defaultVals(vals map[string]any) map[string]any {
return vals return vals
} }
func vendorHeader(config *Config, lang *emailLang) string { return "jfa-go" }
func serverHeader(config *Config, lang *emailLang) string {
if substituteStrings == "" {
return "Jellyfin"
} else {
return substituteStrings
}
}
func messageFooter(config *Config, lang *emailLang) string {
return config.Section("messages").Key("message").String()
}
var customContent = map[string]CustomContentInfo{ var customContent = map[string]CustomContentInfo{
"EmailConfirmation": { "EmailConfirmation": {
Name: "EmailConfirmation", Name: "EmailConfirmation",
@@ -94,6 +106,10 @@ var customContent = map[string]CustomContentInfo{
Subject: func(config *Config, lang *emailLang) string { Subject: func(config *Config, lang *emailLang) string {
return lang.InviteExpiry.get("title") return lang.InviteExpiry.get("title")
}, },
HeaderText: vendorHeader,
FooterText: func(config *Config, lang *emailLang) string {
return lang.InviteExpiry.get("notificationNotice")
},
Variables: []string{ Variables: []string{
"code", "code",
"time", "time",
@@ -131,7 +147,7 @@ var customContent = map[string]CustomContentInfo{
Section: "password_resets", Section: "password_resets",
SettingPrefix: "email_", SettingPrefix: "email_",
// This was the first email type added, hence the undescriptive filename. // This was the first email type added, hence the undescriptive filename.
DefaultValue: "email", DefaultValue: "password-reset",
}, },
}, },
"UserCreated": { "UserCreated": {
@@ -141,6 +157,10 @@ var customContent = map[string]CustomContentInfo{
Subject: func(config *Config, lang *emailLang) string { Subject: func(config *Config, lang *emailLang) string {
return lang.UserCreated.get("title") return lang.UserCreated.get("title")
}, },
HeaderText: vendorHeader,
FooterText: func(config *Config, lang *emailLang) string {
return lang.UserCreated.get("notificationNotice")
},
Variables: []string{ Variables: []string{
"code", "code",
"name", "name",
@@ -346,6 +366,8 @@ var EmptyCustomContent = CustomContentInfo{
Subject: func(config *Config, lang *emailLang) string { Subject: func(config *Config, lang *emailLang) string {
return "EmptyCustomContent" return "EmptyCustomContent"
}, },
HeaderText: serverHeader,
FooterText: messageFooter,
Description: nil, Description: nil,
Variables: []string{}, Variables: []string{},
Placeholders: map[string]any{}, Placeholders: map[string]any{},
@@ -359,6 +381,7 @@ var AnnouncementCustomContent = func(subject string) CustomContentInfo {
return cci return cci
} }
// Validates customContent and sets default fields if needed.
var _runtimeValidation = func() bool { var _runtimeValidation = func() bool {
for name, cc := range customContent { for name, cc := range customContent {
if name != cc.Name { if name != cc.Name {
@@ -367,6 +390,14 @@ var _runtimeValidation = func() bool {
if cc.DisplayName == nil { if cc.DisplayName == nil {
panic(fmt.Errorf("no customContent[%s] DisplayName set", name)) panic(fmt.Errorf("no customContent[%s] DisplayName set", name))
} }
if cc.HeaderText == nil {
cc.HeaderText = serverHeader
customContent[name] = cc
}
if cc.FooterText == nil {
cc.FooterText = messageFooter
customContent[name] = cc
}
} }
return true return true
}() }()

View File

@@ -269,9 +269,6 @@ func (emailer *Emailer) construct(contentInfo CustomContentInfo, cc CustomConten
"plaintext": text, "plaintext": text,
"md": content, "md": content,
} }
if message, ok := data["message"]; ok {
templateData["message"] = message
}
data = templateData data = templateData
} }
var err error = nil var err error = nil
@@ -280,11 +277,8 @@ func (emailer *Emailer) construct(contentInfo CustomContentInfo, cc CustomConten
msg.Text = "" msg.Text = ""
msg.Markdown = "" msg.Markdown = ""
msg.HTML = "" msg.HTML = ""
if substituteStrings == "" { data["header"] = contentInfo.HeaderText(emailer.config, &emailer.lang)
data["jellyfin"] = "Jellyfin" data["footer"] = contentInfo.FooterText(emailer.config, &emailer.lang)
} else {
data["jellyfin"] = substituteStrings
}
var keys []string var keys []string
plaintext := emailer.config.Section("email").Key("plaintext").MustBool(false) plaintext := emailer.config.Section("email").Key("plaintext").MustBool(false)
if plaintext { if plaintext {
@@ -349,7 +343,6 @@ func (emailer *Emailer) baseValues(name string, username string, placeholders bo
contentInfo := customContent[name] contentInfo := customContent[name]
template := map[string]any{ template := map[string]any{
"username": username, "username": username,
"message": emailer.config.Section("messages").Key("message").String(),
} }
maps.Copy(template, values) maps.Copy(template, values)
// When generating a version for the user to customise, we'll replace "variable" with "{variable}", so the templater used for custom content understands them. // When generating a version for the user to customise, we'll replace "variable" with "{variable}", so the templater used for custom content understands them.
@@ -409,11 +402,10 @@ func (emailer *Emailer) constructInvite(invite Invite, placeholders bool) (*Mess
func (emailer *Emailer) constructExpiry(invite Invite, placeholders bool) (*Message, error) { func (emailer *Emailer) constructExpiry(invite Invite, placeholders bool) (*Message, error) {
expiry := formatDatetime(invite.ValidTill) expiry := formatDatetime(invite.ValidTill)
contentInfo, template := emailer.baseValues("InviteExpiry", "", placeholders, map[string]any{ contentInfo, template := emailer.baseValues("InviteExpiry", "", placeholders, map[string]any{
"inviteExpired": emailer.lang.InviteExpiry.get("inviteExpired"), "inviteExpired": emailer.lang.InviteExpiry.get("inviteExpired"),
"notificationNotice": emailer.lang.InviteExpiry.get("notificationNotice"), "expiredAt": emailer.lang.InviteExpiry.get("expiredAt"),
"expiredAt": emailer.lang.InviteExpiry.get("expiredAt"), "code": "\"" + invite.Code + "\"",
"code": "\"" + invite.Code + "\"", "time": expiry,
"time": expiry,
}) })
if !placeholders { if !placeholders {
template["expiredAt"] = emailer.lang.InviteExpiry.template("expiredAt", template) template["expiredAt"] = emailer.lang.InviteExpiry.template("expiredAt", template)
@@ -426,15 +418,14 @@ func (emailer *Emailer) constructCreated(username, address string, when time.Tim
// NOTE: This was previously invite.Created, not sure why. // NOTE: This was previously invite.Created, not sure why.
created := formatDatetime(when) created := formatDatetime(when)
contentInfo, template := emailer.baseValues("UserCreated", username, placeholders, map[string]any{ contentInfo, template := emailer.baseValues("UserCreated", username, placeholders, map[string]any{
"aUserWasCreated": emailer.lang.UserCreated.get("aUserWasCreated"), "aUserWasCreated": emailer.lang.UserCreated.get("aUserWasCreated"),
"nameString": emailer.lang.Strings.get("name"), "nameString": emailer.lang.Strings.get("name"),
"addressString": emailer.lang.Strings.get("emailAddress"), "addressString": emailer.lang.Strings.get("emailAddress"),
"timeString": emailer.lang.UserCreated.get("time"), "timeString": emailer.lang.UserCreated.get("time"),
"notificationNotice": emailer.lang.UserCreated.get("notificationNotice"), "code": "\"" + invite.Code + "\"",
"code": "\"" + invite.Code + "\"", "name": username,
"name": username, "time": created,
"time": created, "address": address,
"address": address,
}) })
if !placeholders { if !placeholders {
template["aUserWasCreated"] = emailer.lang.UserCreated.template("aUserWasCreated", template) template["aUserWasCreated"] = emailer.lang.UserCreated.template("aUserWasCreated", template)

View File

@@ -1,78 +1,17 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <p>{{ .helloUser }}</p>
Color-scheme: light dark; <p>{{ .clickBelow }}</p>
supported-color-schemes: light dark; <p>{{ .ifItWasNotYou }}</p>
} </mj-text>
@media (prefers-color-scheme: light) { <mj-button mj-class="blue text-white" href="{{ .confirmationURL }}">{{ .confirmEmail }}</mj-button>
Color-scheme: dark; </mj-column>
.body { </mj-section>
background: #242424 !important; <mj-include path="./layout/body-end.mjml" />
background-color: #242424 !important; </mj-body>
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .helloUser }}</p>
<p>{{ .clickBelow }}</p>
<p>{{ .ifItWasNotYou }}</p>
</mj-text>
<mj-button mj-class="blue bold" href="{{ .confirmationURL }}">{{ .confirmEmail }}</mj-button>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,86 +1,25 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <p>{{ .aUserWasCreated }}</p>
Color-scheme: light dark; </mj-text>
supported-color-schemes: light dark; <mj-table css-class="bg-gray" mj-class="bg-gray">
} <tr style="text-align: left;">
@media (prefers-color-scheme: light) { <th>{{ .nameString }}</th>
Color-scheme: dark; <th>{{ .addressString }}</th>
.body { <th>{{ .timeString }}</th>
background: #242424 !important; </tr>
background-color: #242424 !important; <tr class="text-gray" style="font-style: italic; text-align: left;">
} <th>{{ .name }}</th>
[data-ogsc] .body { <th>{{ .address }}</th>
background: #242424 !important; <th>{{ .time }}</th>
background-color: #242424 !important; </mj-table>
} </mj-column>
[data-ogsb] .body { </mj-section>
background: #242424 !important; <mj-include path="./layout/body-end.mjml" />
background-color: #242424 !important; </mj-body>
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> jellyfin-accounts </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .aUserWasCreated }}</p>
</mj-text>
<mj-table mj-class="text" container-background-color="#242424">
<tr style="text-align: left;">
<th>{{ .nameString }}</th>
<th>{{ .addressString }}</th>
<th>{{ .timeString }}</th>
</tr>
<tr style="font-style: italic; text-align: left; color: rgb(153,153,153);">
<th>{{ .name }}</th>
<th>{{ .address }}</th>
<th>{{ .time }}</th>
</mj-table>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .notificationNotice }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,78 +1,17 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <p>{{ .helloUser }}</p>
Color-scheme: light dark;
supported-color-schemes: light dark; <h3>{{ .yourAccountWas }}</h3>
} <p>{{ .reasonString }}: <i>{{ .reason }}</i></p>
@media (prefers-color-scheme: light) { </mj-text>
Color-scheme: dark; </mj-column>
.body { </mj-section>
background: #242424 !important; <mj-include path="./layout/body-end.mjml" />
background-color: #242424 !important; </mj-body>
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .helloUser }}</p>
<h3>{{ .yourAccountWas }}</h3>
<p>{{ .reasonString }}: <i>{{ .reason }}</i></p>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,84 +0,0 @@
<mjml>
<mj-head>
<mj-raw>
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
</mj-raw>
<mj-style>
:root {
Color-scheme: light dark;
supported-color-schemes: light dark;
}
@media (prefers-color-scheme: light) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .helloUser }}</p>
<p>{{ .someoneHasRequestedReset }}</p>
<p>{{ .ifItWasYou }}</p>
<p>{{ .codeExpiry }}</p>
<p>{{ .ifItWasNotYou }}</p>
</mj-text>
<mj-raw>{{ if .link_reset }}</mj-raw>
<mj-button mj-class="blue bold" href="{{ .pin }}"><mj-raw>{{ .pin_code }}</mj-raw></mj-button>
<mj-raw>{{ else }}</mj-raw>
<mj-button mj-class="blue bold"><mj-raw>{{ .pin }}</mj-raw></mj-button>
<mj-raw>{{ end }}</mj-raw>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml>

View File

@@ -1,76 +1,15 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <h3>{{ .inviteExpired }}</h3>
Color-scheme: light dark; <p>{{ .expiredAt }}</p>
supported-color-schemes: light dark; </mj-text>
} </mj-column>
@media (prefers-color-scheme: light) { </mj-section>
Color-scheme: dark; <mj-include path="./layout/body-end.mjml" />
.body { </mj-body>
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> jellyfin-accounts </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<h3>{{ .inviteExpired }}</h3>
<p>{{ .expiredAt }}</p>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .notificationNotice }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,83 +1,18 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <p>{{ .helloUser }}</p>
Color-scheme: light dark; <h3>{{ .yourExpiryWasAdjusted }}</h3>
supported-color-schemes: light dark; <p>{{ .ifPreviouslyDisabled }}</p>
} <h4>{{ .newExpiry }}</h4>
@media (prefers-color-scheme: light) { <p>{{ .reasonString }}: <i>{{ .reason }}</i></p>
Color-scheme: dark; </mj-text>
.body { </mj-column>
background: #242424 !important; </mj-section>
background-color: #242424 !important; <mj-include path="./layout/body-end.mjml" />
} </mj-body>
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .helloUser }}</p>
<h3>{{ .yourExpiryWasAdjusted }}</h3>
<p>{{ .ifPreviouslyDisabled }}</p>
<h4>{{ .newExpiry }}</h4>
<p>{{ .reasonString }}: <i>{{ .reason }}</i></p>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,77 +1,15 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <p>{{ .helloUser }}</p>
Color-scheme: light dark; <p>{{ .yourAccountIsDueToExpire }}</p>
supported-color-schemes: light dark; </mj-text>
} </mj-column>
@media (prefers-color-scheme: light) { </mj-section>
Color-scheme: dark; <mj-include path="./layout/body-end.mjml" />
.body { </mj-body>
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .helloUser }}</p>
<p>{{ .yourAccountIsDueToExpire }}</p>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,79 +1,18 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <p>{{ .hello }},</p>
Color-scheme: light dark; <h3>{{ .youHaveBeenInvited }}</h3>
supported-color-schemes: light dark; <p>{{ .toJoin }}</p>
} <p>{{ .inviteExpiry }}</p>
@media (prefers-color-scheme: light) { </mj-text>
Color-scheme: dark; <mj-button mj-class="blue text-white" href="{{ .inviteURL }}">{{ .linkButton }}</mj-button>
.body { </mj-column>
background: #242424 !important; </mj-section>
background-color: #242424 !important; <mj-include path="./layout/body-end.mjml" />
} </mj-body>
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<p>{{ .hello }},</p>
<h3>{{ .youHaveBeenInvited }}</h3>
<p>{{ .toJoin }}</p>
<p>{{ .inviteExpiry }}</p>
</mj-text>
<mj-button mj-class="blue bold" href="{{ .inviteURL }}">{{ .linkButton }}</mj-button>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -0,0 +1,5 @@
<mj-section mj-class="bg-gray">
<mj-column>
<mj-text mj-class="secondary text-gray">{{ .footer }}</mj-text>
</mj-column>
</mj-section>

View File

@@ -0,0 +1,5 @@
<mj-section mj-class="bg-gray">
<mj-column>
<mj-text mj-class="text-white" font-size="25px" font-family="Plus Jakarta Sans, Noto Sans, Helvetica, Arial, sans-serif"> {{ .header }} </mj-text>
</mj-column>
</mj-section>

64
mail/layout/header.mjml Normal file
View File

@@ -0,0 +1,64 @@
<mj-head>
<mj-raw>
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
</mj-raw>
<mj-style>
:root {
Color-scheme: light dark;
supported-color-schemes: light dark;
}
body, .body {
background: #101010 !important;
background-color: #101010 !important;
}
.text-gray {
color: rgb(153,153,153) !important;
}
.bg-gray {
background: #292929 !important;
background-color: #292929 !important;
}
@media (prefers-color-scheme: light) {
Color-scheme: dark;
body, .body {
background: #101010 !important;
background-color: #101010 !important;
}
[data-ogsc] .body {
background: #101010 !important;
background-color: #101010 !important;
}
[data-ogsb] .body {
background: #101010 !important;
background-color: #101010 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
body, .body {
background: #101010 !important;
background-color: #101010 !important;
}
[data-ogsc] .body {
background: #101010 !important;
background-color: #101010 !important;
}
[data-ogsb] .body {
background: #101010 !important;
background-color: #101010 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="body" background-color="#101010" />
<mj-class name="bg-gray" background-color="#292929" />
<mj-class name="text-white" color="rgb(255,255,255)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
<mj-class name="secondary" font-style="italic" font-size="14px" />
<mj-class name="text-gray" color="rgb(153,153,153)" />
<mj-all font-family="Hanken Grotesk, Noto Sans, Helvetica, Arial, sans-serif" font-size="16px" color="rgba(255,255,255,0.8)">
</mj-attributes>
<mj-font name="Plus Jakarta Sans" href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,700;1,700&display=swap" />
<mj-font name="Hanken Grotesk" href="https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital@0;1&display=swap" />
</mj-head>

23
mail/password-reset.mjml Normal file
View File

@@ -0,0 +1,23 @@
<mjml>
<mj-include path="./layout/header.mjml" />
<mj-body>
<mj-include path="./layout/body-start.mjml" />
<mj-section mj-class="body">
<mj-column>
<mj-text>
<p>{{ .helloUser }}</p>
<p>{{ .someoneHasRequestedReset }}</p>
<p>{{ .ifItWasYou }}</p>
<p>{{ .codeExpiry }}</p>
<p>{{ .ifItWasNotYou }}</p>
</mj-text>
<mj-raw>{{ if .link_reset }}</mj-raw>
<mj-button mj-class="blue text-white" href="{{ .pin }}"><mj-raw>{{ .pin_code }}</mj-raw></mj-button>
<mj-raw>{{ else }}</mj-raw>
<mj-button mj-class="blue text-white"><mj-raw>{{ .pin }}</mj-raw></mj-button>
<mj-raw>{{ end }}</mj-raw>
</mj-column>
</mj-section>
<mj-include path="./layout/body-end.mjml" />
</mj-body>
</mjml>

View File

@@ -1,75 +1,14 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { {{ .text }}
Color-scheme: light dark; </mj-text>
supported-color-schemes: light dark; </mj-column>
} </mj-section>
@media (prefers-color-scheme: light) { <mj-include path="./layout/body-end.mjml" />
Color-scheme: dark; </mj-body>
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<mj-raw>{{ .text }}</mj-raw>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,76 +1,15 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <h3>{{ .yourAccountHasExpired }}</h3>
Color-scheme: light dark; <p>{{ .contactTheAdmin }}</p>
supported-color-schemes: light dark; </mj-text>
} </mj-column>
@media (prefers-color-scheme: light) { </mj-section>
Color-scheme: dark; <mj-include path="./layout/body-end.mjml" />
.body { </mj-body>
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<h3>{{ .yourAccountHasExpired }}</h3>
<p>{{ .contactTheAdmin }}</p>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -1,79 +1,18 @@
<mjml> <mjml>
<mj-head> <mj-include path="./layout/header.mjml" />
<mj-raw> <mj-body>
<meta name="color-scheme" content="light dark"> <mj-include path="./layout/body-start.mjml" />
<meta name="supported-color-schemes" content="light dark"> <mj-section mj-class="body">
</mj-raw> <mj-column>
<mj-style> <mj-text>
:root { <h3>{{ .welcome }}</h3>
Color-scheme: light dark; <p>{{ .youCanLoginWith }}:</p>
supported-color-schemes: light dark; {{ .jellyfinURLString }}: <a href="{{ .jellyfinURL }}">{{ .jellyfinURL }}</a>
} <p>{{ .usernameString }}: <i>{{ .username }}</i></p>
@media (prefers-color-scheme: light) { <p>{{ .yourAccountWillExpire }}</p>
Color-scheme: dark; </mj-text>
.body { </mj-column>
background: #242424 !important; </mj-section>
background-color: #242424 !important; <mj-include path="./layout/body-end.mjml" />
} </mj-body>
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
@media (prefers-color-scheme: dark) {
Color-scheme: dark;
.body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsc] .body {
background: #242424 !important;
background-color: #242424 !important;
}
[data-ogsb] .body {
background: #242424 !important;
background-color: #242424 !important;
}
}
</mj-style>
<mj-attributes>
<mj-class name="bg" background-color="#101010" />
<mj-class name="bg2" background-color="#242424" />
<mj-class name="text" color="#cacaca" />
<mj-class name="bold" color="rgba(255,255,255,0.87)" />
<mj-class name="secondary" color="rgb(153,153,153)" />
<mj-class name="blue" background-color="rgb(0,164,220)" />
</mj-attributes>
<mj-font name="Quicksand" href="https://fonts.googleapis.com/css2?family=Quicksand" />
<mj-font name="Noto Sans" href="https://fonts.googleapis.com/css2?family=Noto+Sans" />
</mj-head>
<mj-body>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="bold" font-size="25px" font-family="Quicksand, Noto Sans, Helvetica, Arial, sans-serif"> {{ .jellyfin }} </mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg">
<mj-column>
<mj-text mj-class="text" font-size="16px" font-family="Noto Sans, Helvetica, Arial, sans-serif">
<h3>{{ .welcome }}</h3>
<p>{{ .youCanLoginWith }}:</p>
{{ .jellyfinURLString }}: <a href="{{ .jellyfinURL }}">{{ .jellyfinURL }}</a>
<p>{{ .usernameString }}: <i>{{ .username }}</i></p>
<p>{{ .yourAccountWillExpire }}</p>
</mj-text>
</mj-column>
</mj-section>
<mj-section mj-class="bg2">
<mj-column>
<mj-text mj-class="secondary" font-style="italic" font-size="14px">
{{ .message }}
</mj-text>
</mj-column>
</mj-section>
</body>
</mjml> </mjml>

View File

@@ -719,7 +719,8 @@ type ContentSourceFileInfo struct{ Section, SettingPrefix, DefaultValue string }
type CustomContentInfo struct { type CustomContentInfo struct {
Name string `json:"name" badgerhold:"key"` Name string `json:"name" badgerhold:"key"`
DisplayName, Description func(dict *Lang, lang string) string DisplayName, Description func(dict *Lang, lang string) string
Subject func(config *Config, lang *emailLang) string // Subject returns the subject of the email. Header/FooterText returns what should show in the header, a nil-value implies "Jellyfin" (or user-supplied text).
Subject, HeaderText, FooterText func(config *Config, lang *emailLang) string
// Config section, the main part of the setting name (without "html" or "text"), and the default filename (without ".html" or ".txt"). // Config section, the main part of the setting name (without "html" or "text"), and the default filename (without ".html" or ".txt").
SourceFile ContentSourceFileInfo SourceFile ContentSourceFileInfo
ContentType CustomContentContext `json:"type"` ContentType CustomContentContext `json:"type"`

View File

@@ -1,5 +1,4 @@
let colors = require("tailwindcss/colors") import { colorSet } from "./css/colors";
let dark = require("./css/dark");
module.exports = { module.exports = {
content: ["./data/html/*.html", "./build/data/html/*.html", "./ts/*.ts", "./ts/modules/*.ts"], content: ["./data/html/*.html", "./build/data/html/*.html", "./ts/*.ts", "./ts/modules/*.ts"],
@@ -62,21 +61,7 @@ module.exports = {
'slide-out': 'slide-out 0.2s cubic-bezier(.08,.52,.01,.98)', 'slide-out': 'slide-out 0.2s cubic-bezier(.08,.52,.01,.98)',
'pulse': 'pulse 0.2s cubic-bezier(0.25, 0.45, 0.45, 0.94)' 'pulse': 'pulse 0.2s cubic-bezier(0.25, 0.45, 0.45, 0.94)'
}, },
colors: { colors: colorSet,
neutral: colors.slate,
positive: colors.green,
urge: colors.violet,
warning: colors.yellow,
info: colors.blue,
critical: colors.red,
d_neutral: dark.d_neutral,
d_positive: dark.d_positive,
d_urge: dark.d_urge,
d_warning: dark.d_warning,
d_info: dark.d_info,
d_critical: dark.d_critical,
discord: "#5865F2"
}
} }
}, },
plugins: [require("a17t")], plugins: [require("a17t")],