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