feat: back button; show author emojis
This commit is contained in:
parent
cea96e6fe0
commit
0f40ecdcdc
2 changed files with 73 additions and 31 deletions
|
@ -61,16 +61,22 @@
|
|||
& .ellipsis::after {
|
||||
content: '...'
|
||||
}
|
||||
& .body {
|
||||
|
||||
& img, & video, & p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
& img, & video {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
& img, & video {
|
||||
border-radius: 5px;
|
||||
max-width: 100%;
|
||||
object-fit: cover;
|
||||
border: 1px solid rgba(34, 34, 34, 0.15);
|
||||
& p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
& img, & video, & .link_card {
|
||||
border-radius: 5px;
|
||||
max-width: 100%;
|
||||
object-fit: cover;
|
||||
border: 1px solid rgba(34, 34, 34, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
& .author a {
|
||||
|
@ -79,6 +85,11 @@
|
|||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
& .emoji {
|
||||
display: inline;
|
||||
width: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
& .meta {
|
||||
|
@ -100,6 +111,13 @@
|
|||
cursor: pointer;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
& .link_card {
|
||||
& strong, & em, & small {
|
||||
display: block;
|
||||
}
|
||||
padding: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.card_avatar img {
|
||||
|
@ -140,21 +158,24 @@
|
|||
<div class="card_content">
|
||||
|
||||
<h3 class="author">
|
||||
<a rel="author" href="{{thread.account.url}}">{{thread.account.display_name}}</a>
|
||||
<a rel="author" href="{{thread.account.url}}">{{thread.account.display_name | safe}}</a>
|
||||
</h3>
|
||||
|
||||
{{thread.content | safe}}
|
||||
<div class="body">
|
||||
{{thread.content | safe}}
|
||||
|
||||
{% for media in thread.media_attachments %}
|
||||
{% if media.type == 'image'%}
|
||||
<img src="{{media.url}}" />
|
||||
{% elif media.type == 'gifv' %}
|
||||
<video controls autoplay="autoplay" muted loop>
|
||||
<source src="{{media.url}}" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% for media in thread.media_attachments %}
|
||||
{% if media.type == 'image'%}
|
||||
<img src="{{media.url}}" />
|
||||
{% elif media.type == 'gifv' %}
|
||||
<video controls autoplay="autoplay" muted loop>
|
||||
<source src="{{media.url}}" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if thread.descendants %}
|
||||
<div class="meta">
|
||||
|
@ -171,17 +192,33 @@
|
|||
</div>
|
||||
|
||||
<div class="card_content">
|
||||
{{ descendant.content | safe }}
|
||||
{% for media in descendant.media_attachments%}
|
||||
{% if media.type == 'image'%}
|
||||
<img src="{{media.url}}" />
|
||||
{% elif media.type == 'gifv' %}
|
||||
<video controls autoplay="autoplay" muted loop>
|
||||
<source src="{{media.url}}" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
<div class="body">
|
||||
{{ descendant.content | safe }}
|
||||
{% for media in descendant.media_attachments%}
|
||||
{% if media.type == 'image'%}
|
||||
<img src="{{media.url}}" />
|
||||
{% elif media.type == 'gifv' %}
|
||||
<video controls autoplay="autoplay" muted loop>
|
||||
<source src="{{media.url}}" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if descendant.card %}
|
||||
<a href="{{ descendant.card.url }}">
|
||||
<div class="link_card">
|
||||
|
||||
<small>
|
||||
{{ descendant.card.provider_name or descendant.card.provider_url }}
|
||||
</small>
|
||||
<strong>{{ descendant.card.title }}</strong>
|
||||
<em>{{descendant.card.description}}</em>
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="meta">
|
||||
<a href="{{descendant.url}}" target="_blank">{{ descendant.created_at }}</a>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ threads = Blueprint('threads', __name__, template_folder='template')
|
|||
|
||||
# TODO: move following to an app config or sqlite #########
|
||||
server = 'https://social.ayco.io'
|
||||
thread_ids = ['112319729193615365', '112258065967208438']
|
||||
thread_ids = ['112319729193615365', '112258065967208438', '109545132056133905']
|
||||
app = {
|
||||
"title":"Ayo's Threads",
|
||||
"description": "Release candidate for thoughts before they become a blog."
|
||||
|
@ -64,6 +64,11 @@ def get_descendants(server, status):
|
|||
return descendants
|
||||
|
||||
def clean_author(account):
|
||||
if 'emojis' in account and len(account['emojis']) > 0:
|
||||
name = account['display_name']
|
||||
for emoji in account['emojis']:
|
||||
account['display_name'] = name.replace(":" + emoji['shortcode'] + ":", '<img class="emoji" src="'+emoji['url']+'" />')
|
||||
|
||||
return clean_dict(account, ['avatar', 'display_name', 'id', 'url'])
|
||||
|
||||
def clean_status(status):
|
||||
|
|
Loading…
Reference in a new issue