emailer: use instance name instead of hostname

pull/3467/head
kontrollanten 2020-12-11 00:10:37 +01:00 committed by Chocobozzz
parent 915e2bbb97
commit 2e4b8ae485
11 changed files with 18 additions and 17 deletions

View File

@ -472,7 +472,7 @@ class Emailer {
const emailPayload: EmailPayload = { const emailPayload: EmailPayload = {
template: 'user-registered', template: 'user-registered',
to, to,
subject: `a new user registered on ${WEBSERVER.HOST}: ${user.username}`, subject: `a new user registered on ${CONFIG.INSTANCE.NAME}: ${user.username}`,
locals: { locals: {
user user
} }
@ -486,7 +486,7 @@ class Emailer {
const videoUrl = WEBSERVER.URL + videoBlacklist.Video.getWatchStaticPath() const videoUrl = WEBSERVER.URL + videoBlacklist.Video.getWatchStaticPath()
const reasonString = videoBlacklist.reason ? ` for the following reason: ${videoBlacklist.reason}` : '' const reasonString = videoBlacklist.reason ? ` for the following reason: ${videoBlacklist.reason}` : ''
const blockedString = `Your video ${videoName} (${videoUrl} on ${WEBSERVER.HOST} has been blacklisted${reasonString}.` const blockedString = `Your video ${videoName} (${videoUrl} on ${CONFIG.INSTANCE.NAME} has been blacklisted${reasonString}.`
const emailPayload: EmailPayload = { const emailPayload: EmailPayload = {
to, to,
@ -506,7 +506,7 @@ class Emailer {
const emailPayload: EmailPayload = { const emailPayload: EmailPayload = {
to, to,
subject: `Video ${video.name} unblacklisted`, subject: `Video ${video.name} unblacklisted`,
text: `Your video "${video.name}" (${videoUrl}) on ${WEBSERVER.HOST} has been unblacklisted.`, text: `Your video "${video.name}" (${videoUrl}) on ${CONFIG.INSTANCE.NAME} has been unblacklisted.`,
locals: { locals: {
title: 'Your video was unblacklisted' title: 'Your video was unblacklisted'
} }
@ -547,7 +547,7 @@ class Emailer {
const emailPayload: EmailPayload = { const emailPayload: EmailPayload = {
template: 'verify-email', template: 'verify-email',
to: [ to ], to: [ to ],
subject: `Verify your email on ${WEBSERVER.HOST}`, subject: `Verify your email on ${CONFIG.INSTANCE.NAME}`,
locals: { locals: {
username, username,
verifyEmailUrl verifyEmailUrl
@ -565,7 +565,7 @@ class Emailer {
const emailPayload: EmailPayload = { const emailPayload: EmailPayload = {
to: [ to ], to: [ to ],
subject: 'Account ' + blockedWord, subject: 'Account ' + blockedWord,
text: `Your account ${user.username} on ${WEBSERVER.HOST} has been ${blockedWord}${reasonString}.` text: `Your account ${user.username} on ${CONFIG.INSTANCE.NAME} has been ${blockedWord}${reasonString}.`
} }
return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
@ -597,7 +597,7 @@ class Emailer {
const fromDisplayName = options.from const fromDisplayName = options.from
? options.from ? options.from
: WEBSERVER.HOST : CONFIG.INSTANCE.NAME
const email = new Email({ const email = new Email({
send: true, send: true,
@ -625,6 +625,7 @@ class Emailer {
locals: { // default variables available in all templates locals: { // default variables available in all templates
WEBSERVER, WEBSERVER,
EMAIL: CONFIG.EMAIL, EMAIL: CONFIG.EMAIL,
instanceName: CONFIG.INSTANCE.NAME,
text: options.text, text: options.text,
subject: options.subject subject: options.subject
} }

View File

@ -6,6 +6,6 @@ block title
block content block content
p p
| A new message by #{messageAccountName} was posted on #[a(href=abuseUrl) abuse report ##{abuseId}] on #{WEBSERVER.HOST} | A new message by #{messageAccountName} was posted on #[a(href=abuseUrl) abuse report ##{abuseId}] on #{instanceName}
blockquote #{messageText} blockquote #{messageText}
br(style="display: none;") br(style="display: none;")

View File

@ -6,4 +6,4 @@ block title
block content block content
p p
| #[a(href=abuseUrl) Your abuse report ##{abuseId}] on #{WEBSERVER.HOST} has been #{isAccepted ? 'accepted' : 'rejected'} | #[a(href=abuseUrl) Your abuse report ##{abuseId}] on #{instanceName} has been #{isAccepted ? 'accepted' : 'rejected'}

View File

@ -6,7 +6,7 @@ block title
block content block content
p p
| #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}] received an abuse report for the #{isLocal ? '' : 'remote '}account | #[a(href=WEBSERVER.URL) #{instanceName}] received an abuse report for the #{isLocal ? '' : 'remote '}account
a(href=accountUrl) #{accountDisplayName} a(href=accountUrl) #{accountDisplayName}
p The reporter, #{reporter}, cited the following reason(s): p The reporter, #{reporter}, cited the following reason(s):

View File

@ -230,7 +230,7 @@ body(width="100%" style="margin: 0; padding: 0 !important; mso-line-height-rule:
tr tr
td(style='padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;') td(style='padding: 20px; font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555;')
p(style='margin: 0;') p(style='margin: 0;')
| You are receiving this email as part of your notification settings on #{WEBSERVER.HOST} for your account #{username}. | You are receiving this email as part of your notification settings on #{instanceName} for your account #{username}.
//- 1 Column Text : END //- 1 Column Text : END
//- Email Body : END //- Email Body : END
//- Email Footer : BEGIN //- Email Footer : BEGIN

View File

@ -4,6 +4,6 @@ block title
| Someone just used the contact form | Someone just used the contact form
block content block content
p #{fromName} sent you a message via the contact form on #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}]: p #{fromName} sent you a message via the contact form on #[a(href=WEBSERVER.URL) #{instanceName}]:
blockquote(style='white-space: pre-wrap') #{body} blockquote(style='white-space: pre-wrap') #{body}
p You can contact them at #[a(href=`mailto:${fromEmail}`) #{fromEmail}], or simply reply to this email to get in touch. p You can contact them at #[a(href=`mailto:${fromEmail}`) #{fromEmail}], or simply reply to this email to get in touch.

View File

@ -5,6 +5,6 @@ block title
block content block content
p. p.
Welcome to #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}], your PeerTube instance. Your username is: #{username}. Welcome to #[a(href=WEBSERVER.URL) #{instanceName}], your PeerTube instance. Your username is: #{username}.
Please set your password by following #[a(href=createPasswordUrl) this link]: #[a(href=createPasswordUrl) #{createPasswordUrl}] Please set your password by following #[a(href=createPasswordUrl) this link]: #[a(href=createPasswordUrl) #{createPasswordUrl}]
(this link will expire within seven days). (this link will expire within seven days).

View File

@ -5,7 +5,7 @@ block title
block content block content
p. p.
A reset password procedure for your account #{username} has been requested on #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}]. A reset password procedure for your account #{username} has been requested on #[a(href=WEBSERVER.URL) #{instanceName}].
Please follow #[a(href=resetPasswordUrl) this link] to reset it: #[a(href=resetPasswordUrl) #{resetPasswordUrl}] Please follow #[a(href=resetPasswordUrl) this link] to reset it: #[a(href=resetPasswordUrl) #{resetPasswordUrl}]
(the link will expire within 1 hour) (the link will expire within 1 hour)
p. p.

View File

@ -6,9 +6,9 @@ block title
block content block content
p Welcome to PeerTube! p Welcome to PeerTube!
p. p.
You just created an account #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}], your new PeerTube instance. You just created an account #[a(href=WEBSERVER.URL) #{instanceName}], your new PeerTube instance.
Your username there is: #{username}. Your username there is: #{username}.
p. p.
To start using PeerTube on #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}] you must verify your email first! To start using PeerTube on #[a(href=WEBSERVER.URL) #{instanceName}] you must verify your email first!
Please follow #[a(href=verifyEmailUrl) this link] to verify this email belongs to you: #[a(href=verifyEmailUrl) #{verifyEmailUrl}] Please follow #[a(href=verifyEmailUrl) this link] to verify this email belongs to you: #[a(href=verifyEmailUrl) #{verifyEmailUrl}]
If you are not the person who initiated this request, please ignore this email. If you are not the person who initiated this request, please ignore this email.

View File

@ -6,7 +6,7 @@ block title
block content block content
p p
| #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}] received an abuse report for the #{isLocal ? '' : 'remote '}video " | #[a(href=WEBSERVER.URL) #{instanceName}] received an abuse report for the #{isLocal ? '' : 'remote '}video "
a(href=videoUrl) #{videoName} a(href=videoUrl) #{videoName}
| " by #[+channel(videoChannel)] | " by #[+channel(videoChannel)]
if videoPublishedAt if videoPublishedAt

View File

@ -6,7 +6,7 @@ block title
block content block content
p p
| #[a(href=WEBSERVER.URL) #{WEBSERVER.HOST}] received an abuse report for the #{isLocal ? '' : 'remote '} | #[a(href=WEBSERVER.URL) #{instanceName}] received an abuse report for the #{isLocal ? '' : 'remote '}
a(href=commentUrl) comment on video "#{videoName}" a(href=commentUrl) comment on video "#{videoName}"
| of #{flaggedAccount} | of #{flaggedAccount}
| created on #{commentCreatedAt} | created on #{commentCreatedAt}