Override email template footers
This commit is contained in:
28
start.sh
28
start.sh
@@ -797,6 +797,34 @@ customize_mail_templates() {
|
|||||||
{{end}}
|
{{end}}
|
||||||
EOF_BASE_TEMPLATE
|
EOF_BASE_TEMPLATE
|
||||||
chown cloudron:cloudron "$base_template"
|
chown cloudron:cloudron "$base_template"
|
||||||
|
|
||||||
|
python3 - "$MUSEUM_RUNTIME_DIR/mail-templates" "$BASE_URL" <<'PY'
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
template_dir = Path(sys.argv[1])
|
||||||
|
base_url = sys.argv[2]
|
||||||
|
|
||||||
|
footer_html = f'''
|
||||||
|
<div class="footer" style="text-align: center; font-size: 12px; color: #888; padding: 16px;">
|
||||||
|
<p style="margin-bottom: 4px;">
|
||||||
|
<strong><a href="{base_url}" target="_blank" style="color: #555;">{base_url}</a></strong>
|
||||||
|
</p>
|
||||||
|
<p style="margin: 0;">This email was sent by a self-hosted instance of the open source Ente application.</p>
|
||||||
|
</div>
|
||||||
|
</body>'''.lstrip()
|
||||||
|
|
||||||
|
pattern = re.compile(r'<div class="footer".*?</div>\s*</body>', re.DOTALL | re.IGNORECASE)
|
||||||
|
|
||||||
|
for html_path in template_dir.rglob("*.html"):
|
||||||
|
original = html_path.read_text()
|
||||||
|
updated = pattern.sub(footer_html, original)
|
||||||
|
if updated != original:
|
||||||
|
html_path.write_text(updated)
|
||||||
|
# Ownership will be fixed later by the caller
|
||||||
|
PY
|
||||||
|
find "$MUSEUM_RUNTIME_DIR/mail-templates" -type f -name "*.html" -exec chown cloudron:cloudron {} +
|
||||||
}
|
}
|
||||||
|
|
||||||
customize_mail_templates
|
customize_mail_templates
|
||||||
|
|||||||
Reference in New Issue
Block a user