From a6ec889b11b5501492d12f89e8ae83945a514f6e Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Fri, 30 Aug 2024 19:42:41 +0300 Subject: [PATCH] Fix subject template --- .../mastodon_email_bridge.py | 2 +- pyproject.toml | 2 +- setup.cfg | 2 +- templates/new_post.html.j2 | 82 +++++++++++-------- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/mastodon_email_bridge/mastodon_email_bridge.py b/mastodon_email_bridge/mastodon_email_bridge.py index 6abc34f..199b54d 100755 --- a/mastodon_email_bridge/mastodon_email_bridge.py +++ b/mastodon_email_bridge/mastodon_email_bridge.py @@ -324,7 +324,7 @@ class MastodonEmailBridge: @click.option( '--subjet-template', '-t', - default='{% if data["in_reply_to_id"] %}FediReply{% else %}FediPost{% endif %} from {{ data["account"]["display_name"] }} ({{ data["account"]["username"] }}){% for tag in data["tags"] %} #{{ tag["name"] }}{% endfor %}', + default='{{ data["account"]["display_name"] }} ({{ data["account"]["username"] }}) {% if data["in_reply_to_id"] %}replied {% else %}posted{% endif %}{% for tag in data["tags"] %} #{{ tag["name"] }}{% endfor %}', help='Jinja2 template for the subject of the emails.' ) @click.option('--log-file', '-l', help="File to store all debug messages.") diff --git a/pyproject.toml b/pyproject.toml index 0c77084..2b87958 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ Homepage = "https://codeberg.org/adelgado/mastodon_email_bridge" [project] name = "mastodon_email_bridge" -version = "0.0.8" +version = "0.0.9" description = "Redirect your Mastodon Home timeline to your email" readme = "README.md" authors = [{ name = "Antonio J. Delgado", email = "ad@susurrando.com" }] diff --git a/setup.cfg b/setup.cfg index 0c64a1e..e4f14f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mastodon_email_bridge -version = 0.0.8 +version = 0.0.9 [options] packages = mastodon_email_bridge diff --git a/templates/new_post.html.j2 b/templates/new_post.html.j2 index 1e82ded..5e209ca 100644 --- a/templates/new_post.html.j2 +++ b/templates/new_post.html.j2 @@ -68,38 +68,45 @@ {% if data['media_attachments'] %} {% for media in data['media_attachments'] %} - {% if media['type'] == 'image' %} + {% if media['type'] == 'image' -%} {{ media['description'] }} - {% elif media['type'] == 'video' or media['type'] == 'gifv' %} + {% elif media['type'] == 'video' or media['type'] == 'gifv' -%} - {% elif media['type'] == 'audio' %} + {% elif media['type'] == 'audio' -%} Download audio - {% endif %} + {%- endif %} {% endfor %} {% endif %} {% if data['meb_reply_to'] %} {% for reply in data['meb_reply_to'] %} -
-
- Reply original page -
+ Reply original page + +

+ {% set reply_created_date = time.strptime(reply['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') %} + {{ time.strftime('%Y-%m-%d %H:%M:%S %zUTC', reply_created_date) }} +

+ +
-
- - {{ reply['account']['display_name'] }} avatar image - {{ reply['account']['display_name'] }} ({{ reply['account']['username'] }}) - -
- -
- {% set created_date = time.strptime(reply['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') %} - {{ time.strftime('%Y-%m-%d %H:%M:%S %zUTC', created_date) }} -
+ + + + + +
+ + {{ reply['account']['display_name'] }} avatar image + + + + {{ reply['account']['display_name'] }} ({{ reply['account']['acct'] }}) + +
@@ -132,22 +139,29 @@ {% endif %} {% if data['reblog'] %} -
- +
+ + Reply original page + +

+ {% set reblog_created_date = time.strptime(data['reblog']['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') %} + {{ time.strftime('%Y-%m-%d %H:%M:%S %zUTC', reblog_created_date) }} +

-
- - {{ data['reblog']['account']['display_name'] }} avatar image - {{ data['reblog']['account']['display_name'] }} ({{ data['reblog']['account']['username'] }}) - -
- -
- {% set created_date = time.strptime(data['reblog']['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') %} - {{ time.strftime('%Y-%m-%d %H:%M:%S %zUTC', created_date) }} -
+ + + + + +
+ + {{ data['reblog']['account']['display_name'] }} avatar image + + + + {{ data['reblog']['account']['display_name'] }} ({{ data['reblog']['account']['acct'] }}) + +