Fix subject template
This commit is contained in:
parent
92c40adcd7
commit
a6ec889b11
4 changed files with 51 additions and 37 deletions
|
@ -324,7 +324,7 @@ class MastodonEmailBridge:
|
||||||
@click.option(
|
@click.option(
|
||||||
'--subjet-template',
|
'--subjet-template',
|
||||||
'-t',
|
'-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.'
|
help='Jinja2 template for the subject of the emails.'
|
||||||
)
|
)
|
||||||
@click.option('--log-file', '-l', help="File to store all debug messages.")
|
@click.option('--log-file', '-l', help="File to store all debug messages.")
|
||||||
|
|
|
@ -7,7 +7,7 @@ Homepage = "https://codeberg.org/adelgado/mastodon_email_bridge"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "mastodon_email_bridge"
|
name = "mastodon_email_bridge"
|
||||||
version = "0.0.8"
|
version = "0.0.9"
|
||||||
description = "Redirect your Mastodon Home timeline to your email"
|
description = "Redirect your Mastodon Home timeline to your email"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "Antonio J. Delgado", email = "ad@susurrando.com" }]
|
authors = [{ name = "Antonio J. Delgado", email = "ad@susurrando.com" }]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = mastodon_email_bridge
|
name = mastodon_email_bridge
|
||||||
version = 0.0.8
|
version = 0.0.9
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
packages = mastodon_email_bridge
|
packages = mastodon_email_bridge
|
||||||
|
|
|
@ -68,38 +68,45 @@
|
||||||
<!-- media -->
|
<!-- media -->
|
||||||
{% if data['media_attachments'] %}
|
{% if data['media_attachments'] %}
|
||||||
{% for media in data['media_attachments'] %}
|
{% for media in data['media_attachments'] %}
|
||||||
{% if media['type'] == 'image' %}
|
{% if media['type'] == 'image' -%}
|
||||||
<IMG SRC="{{ media['preview_url'] }}" ALT="{{ media['description'] }}">
|
<IMG SRC="{{ media['preview_url'] }}" ALT="{{ media['description'] }}">
|
||||||
{% elif media['type'] == 'video' or media['type'] == 'gifv' %}
|
{% elif media['type'] == 'video' or media['type'] == 'gifv' -%}
|
||||||
<video controls height="50%">
|
<video controls height="50%">
|
||||||
<source src="{{ media['url'] }}" type="video/webm" />
|
<source src="{{ media['url'] }}" type="video/webm" />
|
||||||
<A HREF="{{ media['url'] }}">Download video</A>
|
<A HREF="{{ media['url'] }}">Download video</A>
|
||||||
</video>
|
</video>
|
||||||
{% elif media['type'] == 'audio' %}
|
{% elif media['type'] == 'audio' -%}
|
||||||
<audio controls src="{{ media['url'] }}"></audio>
|
<audio controls src="{{ media['url'] }}"></audio>
|
||||||
<A HREF="{{ media['url'] }}">Download audio</A>
|
<A HREF="{{ media['url'] }}">Download audio</A>
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data['meb_reply_to'] %}
|
{% if data['meb_reply_to'] %}
|
||||||
{% for reply in data['meb_reply_to'] %}
|
{% for reply in data['meb_reply_to'] %}
|
||||||
<!-- reply -->
|
<!-- reply -->
|
||||||
<DIV STYLE="margin:5%;">
|
<A TARGET="_blank" HREF="{{ reply['url'] }}">Reply original page</A>
|
||||||
<DIV>
|
<!-- creation_date -->
|
||||||
<A TARGET="_blank" HREF="{{ reply['url'] }}">Reply original page</A>
|
<P STYLE='font-size: 12px;'>
|
||||||
</DIV>
|
{% 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) }}
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<DIV STYLE="margin:1%;">
|
||||||
<!-- reply-account -->
|
<!-- reply-account -->
|
||||||
<DIV>
|
<TABLE>
|
||||||
<A HREF="{{ reply['account']['url'] }}" TARGET="_blank"></A>
|
<TR>
|
||||||
<IMG ALT="{{ reply['account']['display_name'] }} avatar image" SRC="{{ reply['account']['avatar_static'] }}" STYLE='width:64px;height:64px;margin:1%;float: left;'>
|
<TD>
|
||||||
<B>{{ reply['account']['display_name'] }} ({{ reply['account']['username'] }})</B>
|
<A HREF="{{ reply['account']['url'] }}" TARGET="_blank">
|
||||||
</A>
|
<IMG ALT="{{ reply['account']['display_name'] }} avatar image" SRC="{{ reply['account']['avatar_static'] }}" STYLE="width:64px;height:64px;margin:1%;float: left;">
|
||||||
</DIV>
|
</A>
|
||||||
<!-- reply_creation_date -->
|
</TD>
|
||||||
<DIV STYLE='font-size: 12px;'>
|
<TD>
|
||||||
{% set created_date = time.strptime(reply['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') %}
|
<A HREF="{{ reply['account']['url'] }}" TARGET="_blank">
|
||||||
{{ time.strftime('%Y-%m-%d %H:%M:%S %zUTC', created_date) }}
|
<B>{{ reply['account']['display_name'] }} ({{ reply['account']['acct'] }})</B>
|
||||||
</DIV>
|
</A>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
</TABLE>
|
||||||
<!-- reply_content_bloc -->
|
<!-- reply_content_bloc -->
|
||||||
<DIV STYLE='font-size: 24px;'>
|
<DIV STYLE='font-size: 24px;'>
|
||||||
<!-- reply_spoiler -->
|
<!-- reply_spoiler -->
|
||||||
|
@ -132,22 +139,29 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if data['reblog'] %}
|
{% if data['reblog'] %}
|
||||||
<!-- reblog -->
|
<!-- reblog -->
|
||||||
<DIV STYLE="margin:5%;">
|
<DIV STYLE="margin:1%;">
|
||||||
<DIV>
|
<!-- reply -->
|
||||||
<A TARGET="_blank" HREF="{{ data['reblog']['url'] }}">Reply original page</A>
|
<A TARGET="_blank" HREF="{{ data['reblog']['url'] }}">Reply original page</A>
|
||||||
</DIV>
|
<!-- creation_date -->
|
||||||
|
<P STYLE='font-size: 12px;'>
|
||||||
|
{% 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) }}
|
||||||
|
</P>
|
||||||
<!-- reblog-account -->
|
<!-- reblog-account -->
|
||||||
<DIV>
|
<TABLE>
|
||||||
<A HREF="{{ data['reblog']['account']['url'] }}" TARGET="_blank"></A>
|
<TR>
|
||||||
<IMG ALT="{{ data['reblog']['account']['display_name'] }} avatar image" SRC="{{ data['reblog']['account']['avatar_static'] }}" STYLE='width:64px;height:64px;margin:1%;float: left;'>
|
<TD>
|
||||||
<B>{{ data['reblog']['account']['display_name'] }} ({{ data['reblog']['account']['username'] }})</B>
|
<A HREF="{{ data['reblog']['account']['url'] }}" TARGET="_blank">
|
||||||
</A>
|
<IMG ALT="{{ data['reblog']['account']['display_name'] }} avatar image" SRC="{{ data['reblog']['account']['avatar_static'] }}" STYLE="width:64px;height:64px;margin:1%;float: left;">
|
||||||
</DIV>
|
</A>
|
||||||
<!-- reblog_creation_date -->
|
</TD>
|
||||||
<DIV STYLE='font-size: 12px;'>
|
<TD>
|
||||||
{% set created_date = time.strptime(data['reblog']['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') %}
|
<A HREF="{{ data['reblog']['account']['url'] }}" TARGET="_blank">
|
||||||
{{ time.strftime('%Y-%m-%d %H:%M:%S %zUTC', created_date) }}
|
<B>{{ data['reblog']['account']['display_name'] }} ({{ data['reblog']['account']['acct'] }})</B>
|
||||||
</DIV>
|
</A>
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
</TABLE>
|
||||||
<!-- reblog_content_bloc -->
|
<!-- reblog_content_bloc -->
|
||||||
<DIV STYLE='font-size: 24px;'>
|
<DIV STYLE='font-size: 24px;'>
|
||||||
<!-- reblog_spoiler -->
|
<!-- reblog_spoiler -->
|
||||||
|
|
Loading…
Reference in a new issue