mirror of https://github.com/Chocobozzz/PeerTube
Allow to control emails prefix and signature with config (#1789)
* Allow to control emails prefix and signature with config * Adapt email config according to @Chocobozzz reviewpull/1830/head
parent
3daaa19274
commit
b5bfadf0b5
|
@ -53,6 +53,12 @@ smtp:
|
||||||
ca_file: null # Used for self signed certificates
|
ca_file: null # Used for self signed certificates
|
||||||
from_address: 'admin@example.com'
|
from_address: 'admin@example.com'
|
||||||
|
|
||||||
|
email:
|
||||||
|
body:
|
||||||
|
signature: "PeerTube"
|
||||||
|
object:
|
||||||
|
prefix: "[PeerTube]"
|
||||||
|
|
||||||
# From the project root directory
|
# From the project root directory
|
||||||
storage:
|
storage:
|
||||||
tmp: 'storage/tmp/' # Used to download data (imports etc), store uploaded files before processing...
|
tmp: 'storage/tmp/' # Used to download data (imports etc), store uploaded files before processing...
|
||||||
|
|
|
@ -44,6 +44,14 @@ const CONFIG = {
|
||||||
CA_FILE: config.get<string>('smtp.ca_file'),
|
CA_FILE: config.get<string>('smtp.ca_file'),
|
||||||
FROM_ADDRESS: config.get<string>('smtp.from_address')
|
FROM_ADDRESS: config.get<string>('smtp.from_address')
|
||||||
},
|
},
|
||||||
|
EMAIL: {
|
||||||
|
BODY: {
|
||||||
|
SIGNATURE: config.get<string>('email.body.signature')
|
||||||
|
},
|
||||||
|
OBJECT: {
|
||||||
|
PREFIX: config.get<string>('email.object.prefix') + ' '
|
||||||
|
}
|
||||||
|
},
|
||||||
STORAGE: {
|
STORAGE: {
|
||||||
TMP_DIR: buildPath(config.get<string>('storage.tmp')),
|
TMP_DIR: buildPath(config.get<string>('storage.tmp')),
|
||||||
AVATARS_DIR: buildPath(config.get<string>('storage.avatars')),
|
AVATARS_DIR: buildPath(config.get<string>('storage.avatars')),
|
||||||
|
|
|
@ -100,11 +100,11 @@ class Emailer {
|
||||||
`You can view it on ${videoUrl} ` +
|
`You can view it on ${videoUrl} ` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: channelName + ' just published a new video',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + channelName + ' just published a new video',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,11 +119,11 @@ class Emailer {
|
||||||
`Your ${followType} ${followingName} has a new subscriber: ${followerName}` +
|
`Your ${followType} ${followingName} has a new subscriber: ${followerName}` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: 'New follower on your channel ' + followingName,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'New follower on your channel ' + followingName,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,11 +137,11 @@ class Emailer {
|
||||||
`Your instance has a new follower: ${actorFollow.ActorFollower.url}${awaitingApproval}` +
|
`Your instance has a new follower: ${actorFollow.ActorFollower.url}${awaitingApproval}` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: 'New instance follower',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'New instance follower',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,11 +157,11 @@ class Emailer {
|
||||||
`You can view it on ${videoUrl} ` +
|
`You can view it on ${videoUrl} ` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: `Your video ${video.name} is published`,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + `Your video ${video.name} is published`,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,11 +177,11 @@ class Emailer {
|
||||||
`You can view the imported video on ${videoUrl} ` +
|
`You can view the imported video on ${videoUrl} ` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: `Your video import ${videoImport.getTargetIdentifier()} is finished`,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + `Your video import ${videoImport.getTargetIdentifier()} is finished`,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,11 +197,11 @@ class Emailer {
|
||||||
`See your videos import dashboard for more information: ${importUrl}` +
|
`See your videos import dashboard for more information: ${importUrl}` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: `Your video import ${videoImport.getTargetIdentifier()} encountered an error`,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + `Your video import ${videoImport.getTargetIdentifier()} encountered an error`,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,11 +219,11 @@ class Emailer {
|
||||||
`You can view it on ${commentUrl} ` +
|
`You can view it on ${commentUrl} ` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: 'New comment on your video ' + video.name,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'New comment on your video ' + video.name,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,11 +241,11 @@ class Emailer {
|
||||||
`You can view the comment on ${commentUrl} ` +
|
`You can view the comment on ${commentUrl} ` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: 'Mention on video ' + video.name,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'Mention on video ' + video.name,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,11 +258,11 @@ class Emailer {
|
||||||
const text = `Hi,\n\n` +
|
const text = `Hi,\n\n` +
|
||||||
`${WEBSERVER.HOST} received an abuse for the following video ${videoUrl}\n\n` +
|
`${WEBSERVER.HOST} received an abuse for the following video ${videoUrl}\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: '[PeerTube] Received a video abuse',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'Received a video abuse',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,11 +281,11 @@ class Emailer {
|
||||||
`A full list of auto-blacklisted videos can be reviewed here: ${VIDEO_AUTO_BLACKLIST_URL}` +
|
`A full list of auto-blacklisted videos can be reviewed here: ${VIDEO_AUTO_BLACKLIST_URL}` +
|
||||||
`\n\n` +
|
`\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: '[PeerTube] An auto-blacklisted video is awaiting review',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'An auto-blacklisted video is awaiting review',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,11 +296,11 @@ class Emailer {
|
||||||
const text = `Hi,\n\n` +
|
const text = `Hi,\n\n` +
|
||||||
`User ${user.username} just registered on ${WEBSERVER.HOST} PeerTube instance.\n\n` +
|
`User ${user.username} just registered on ${WEBSERVER.HOST} PeerTube instance.\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: '[PeerTube] New user registration on ' + WEBSERVER.HOST,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'New user registration on ' + WEBSERVER.HOST,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,11 +318,11 @@ class Emailer {
|
||||||
blockedString +
|
blockedString +
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
'Cheers,\n' +
|
'Cheers,\n' +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: `[PeerTube] Video ${videoName} blacklisted`,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + `Video ${videoName} blacklisted`,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,11 +336,11 @@ class Emailer {
|
||||||
`Your video ${video.name} (${videoUrl}) on ${WEBSERVER.HOST} has been unblacklisted.` +
|
`Your video ${video.name} (${videoUrl}) on ${WEBSERVER.HOST} has been unblacklisted.` +
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
'Cheers,\n' +
|
'Cheers,\n' +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to,
|
to,
|
||||||
subject: `[PeerTube] Video ${video.name} unblacklisted`,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + `Video ${video.name} unblacklisted`,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,11 +353,11 @@ class Emailer {
|
||||||
`Please follow this link to reset it: ${resetPasswordUrl}\n\n` +
|
`Please follow this link to reset it: ${resetPasswordUrl}\n\n` +
|
||||||
`If you are not the person who initiated this request, please ignore this email.\n\n` +
|
`If you are not the person who initiated this request, please ignore this email.\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to: [ to ],
|
to: [ to ],
|
||||||
subject: 'Reset your PeerTube password',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'Reset your password',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,11 +370,11 @@ class Emailer {
|
||||||
`Please follow this link to verify this email belongs to you: ${verifyEmailUrl}\n\n` +
|
`Please follow this link to verify this email belongs to you: ${verifyEmailUrl}\n\n` +
|
||||||
`If you are not the person who initiated this request, please ignore this email.\n\n` +
|
`If you are not the person who initiated this request, please ignore this email.\n\n` +
|
||||||
`Cheers,\n` +
|
`Cheers,\n` +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to: [ to ],
|
to: [ to ],
|
||||||
subject: 'Verify your PeerTube email',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'Verify your email',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,12 +390,12 @@ class Emailer {
|
||||||
blockedString +
|
blockedString +
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
'Cheers,\n' +
|
'Cheers,\n' +
|
||||||
`PeerTube.`
|
`${CONFIG.EMAIL.BODY.SIGNATURE}`
|
||||||
|
|
||||||
const to = user.email
|
const to = user.email
|
||||||
const emailPayload: EmailPayload = {
|
const emailPayload: EmailPayload = {
|
||||||
to: [ to ],
|
to: [ to ],
|
||||||
subject: '[PeerTube] Account ' + blockedWord,
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'Account ' + blockedWord,
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ class Emailer {
|
||||||
fromDisplayName: fromEmail,
|
fromDisplayName: fromEmail,
|
||||||
replyTo: fromEmail,
|
replyTo: fromEmail,
|
||||||
to: [ CONFIG.ADMIN.EMAIL ],
|
to: [ CONFIG.ADMIN.EMAIL ],
|
||||||
subject: '[PeerTube] Contact form submitted',
|
subject: CONFIG.EMAIL.OBJECT.PREFIX + 'Contact form submitted',
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue