mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Check for Tautulli footer in newsletters
This commit is contained in:
parent
348707b6b9
commit
e7f930bd0f
3 changed files with 23 additions and 3 deletions
|
@ -955,7 +955,7 @@
|
|||
<td class="footer" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;clear: both;margin-top: 10px;text-align: center;width: 100%;">
|
||||
<div class="footer-bar" style="margin-left: auto;margin-right: auto;width: 200px;border-top: 1px solid #E5A00D;margin-top: 25px;"></div>
|
||||
<div class="content-block powered-by" style="padding-bottom: 10px;padding-top: 10px;">
|
||||
Newsletter generated by <a href="https://tautulli.com" target="_blank" style="text-decoration: underline;color: #fff;font-size: 12px;text-align: center;">Tautulli</a>.
|
||||
<!-- FOOTER MESSAGE - DO NOT REMOVE -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -956,7 +956,7 @@
|
|||
<td class="footer">
|
||||
<div class="footer-bar"></div>
|
||||
<div class="content-block powered-by">
|
||||
Newsletter generated by <a href="https://tautulli.com" target="_blank">Tautulli</a>.
|
||||
<!-- FOOTER MESSAGE - DO NOT REMOVE -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -19,6 +19,7 @@ from itertools import groupby
|
|||
from mako.lookup import TemplateLookup
|
||||
from mako import exceptions
|
||||
import os
|
||||
import re
|
||||
|
||||
import plexpy
|
||||
import common
|
||||
|
@ -420,7 +421,7 @@ class Newsletter(object):
|
|||
|
||||
self.retrieve_data()
|
||||
|
||||
return serve_template(
|
||||
newsletter_rendered = serve_template(
|
||||
templatename=self._TEMPLATE,
|
||||
uuid=self.uuid,
|
||||
subject=self.subject_formatted,
|
||||
|
@ -431,6 +432,25 @@ class Newsletter(object):
|
|||
preview=self.is_preview
|
||||
)
|
||||
|
||||
# Force Tautulli footer
|
||||
if '<!-- FOOTER MESSAGE - DO NOT REMOVE -->' in newsletter_rendered:
|
||||
newsletter_rendered = newsletter_rendered.replace(
|
||||
'<!-- FOOTER MESSAGE - DO NOT REMOVE -->',
|
||||
'Newsletter generated by <a href="https://tautulli.com" target="_blank" '
|
||||
'style="text-decoration: underline;color: #fff;font-size: 12px;">Tautulli</a>.'
|
||||
)
|
||||
return newsletter_rendered
|
||||
else:
|
||||
msg = ('<div style="text-align: center;padding-top: 100px;padding-bottom: 100px;">'
|
||||
'<p style="font-family: \'Open Sans\', Helvetica, Arial, sans-serif;color: #282A2D;'
|
||||
'font-size: 18px;line-height: 30px;">'
|
||||
'The Tautulli newsletter footer was removed from the newsletter template.<br>'
|
||||
'Please leave the footer in place as it is unobtrusive and supports '
|
||||
'<a href="https://tautulli.com" target="_blank">Tautulli</a>.<br>Thank you.'
|
||||
'</p></div>')
|
||||
newsletter_rendered = re.sub(r'(<body.*?>)', r'\1' + msg, newsletter_rendered)
|
||||
return newsletter_rendered
|
||||
|
||||
def send(self):
|
||||
self.newsletter = self.generate_newsletter()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue