Check for Tautulli footer in newsletters
This commit is contained in:
@@ -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%;">
|
<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="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;">
|
<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>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -956,7 +956,7 @@
|
|||||||
<td class="footer">
|
<td class="footer">
|
||||||
<div class="footer-bar"></div>
|
<div class="footer-bar"></div>
|
||||||
<div class="content-block powered-by">
|
<div class="content-block powered-by">
|
||||||
Newsletter generated by <a href="https://tautulli.com" target="_blank">Tautulli</a>.
|
<!-- FOOTER MESSAGE - DO NOT REMOVE -->
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -19,6 +19,7 @@ from itertools import groupby
|
|||||||
from mako.lookup import TemplateLookup
|
from mako.lookup import TemplateLookup
|
||||||
from mako import exceptions
|
from mako import exceptions
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
import common
|
import common
|
||||||
@@ -420,7 +421,7 @@ class Newsletter(object):
|
|||||||
|
|
||||||
self.retrieve_data()
|
self.retrieve_data()
|
||||||
|
|
||||||
return serve_template(
|
newsletter_rendered = serve_template(
|
||||||
templatename=self._TEMPLATE,
|
templatename=self._TEMPLATE,
|
||||||
uuid=self.uuid,
|
uuid=self.uuid,
|
||||||
subject=self.subject_formatted,
|
subject=self.subject_formatted,
|
||||||
@@ -431,6 +432,25 @@ class Newsletter(object):
|
|||||||
preview=self.is_preview
|
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):
|
def send(self):
|
||||||
self.newsletter = self.generate_newsletter()
|
self.newsletter = self.generate_newsletter()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user