Better Link support
This commit is contained in:
parent
364c1d9273
commit
e3284416d2
4 changed files with 15 additions and 12 deletions
4
app.py
4
app.py
|
@ -269,8 +269,10 @@ def domain(url):
|
|||
def get_url(u):
|
||||
if isinstance(u, dict):
|
||||
return u["href"]
|
||||
else:
|
||||
elif isinstance(u, str):
|
||||
return u
|
||||
else:
|
||||
raise ValueError(f"unexpected URL field type: {type(u)}: {u!r}")
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
{% set boost_actor = item.activity.actor | get_actor %}
|
||||
{% if session.logged_in %}
|
||||
<div style="margin-left:65px;padding-bottom:5px;margin-bottom:15px;">
|
||||
<span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url }}">{{ boost_actor.name }}</a> boosted</span>
|
||||
<span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url | get_url }}">{{ boost_actor.name }}</a> boosted</span>
|
||||
<form action="/api/undo" class="action-form" method="POST">
|
||||
<input type="hidden" name="redirect" value="/"/>
|
||||
<input type="hidden" name="id" value="{{ item.remote_id }}"/>
|
||||
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
{% else %}
|
||||
<p style="margin-left:65px;padding-bottom:5px;">
|
||||
<span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url }}">{{ boost_actor.name }}</a> boosted</span>
|
||||
<span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url | get_url }}">{{ boost_actor.name }}</a> boosted</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if item.meta.object %}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
{% if item | has_type('Announce') %}
|
||||
{% set boost_actor = item.activity.actor | get_actor %}
|
||||
<p style="margin-left:70px;padding-bottom:5px;"><span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url }}">{{ boost_actor.name or boost_actor.preferredUsername }}</a> boosted</span></p>
|
||||
<p style="margin-left:70px;padding-bottom:5px;"><span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url | get_url }}">{{ boost_actor.name or boost_actor.preferredUsername }}</a> boosted</span></p>
|
||||
{% if item.meta.object %}
|
||||
{{ utils.display_note(item.meta.object, ui=True) }}
|
||||
{% endif %}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
{% if not perma %}
|
||||
<span style="float:right">
|
||||
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj.url }}">
|
||||
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj.url | get_url }}">
|
||||
<time class="dt-published" title="{{ obj.published }}" datetime="{{ obj.published }}">{{ obj.published | format_timeago }}</time></a>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
@ -47,7 +47,7 @@
|
|||
<ul>
|
||||
{% endif %}
|
||||
{% for a in obj.attachment %}
|
||||
{% if a.url | is_img %}
|
||||
{% if a.url | get_url | is_img %}
|
||||
<a href="{{ a.url | get_attachment_url(None) }}"><img src="{{a.url | get_attachment_url(720) }}" class="img-attachment"></a>
|
||||
{% else %}
|
||||
<li><a href="{{a.url | get_attachment_url(None) }}" class="l">{% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}</a></li>
|
||||
|
@ -61,8 +61,10 @@
|
|||
|
||||
<div class="bottom-bar">
|
||||
{% if perma %}<span class="perma-item">{{ obj.published | format_time }}</span>
|
||||
{% else %}
|
||||
<a class ="bar-item" href="{{ obj.url }}">permalink</a>
|
||||
{% endif %}
|
||||
{% if not obj.id | is_from_outbox %}
|
||||
<a class ="bar-item" href="{{ obj.url | get_url }}">permalink</a>
|
||||
{% endif %}
|
||||
|
||||
{% if session.logged_in %}
|
||||
{% set perma_id = obj.id | permalink_id %}
|
||||
|
@ -70,12 +72,12 @@
|
|||
{% set aid = obj.id | quote_plus %}
|
||||
{% endif %}
|
||||
|
||||
{% if meta.count_reply and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_reply }}</strong> replies</a>
|
||||
{% if meta.count_reply and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_reply }}</strong> replies</a>
|
||||
{% elif meta.count_reply and session.logged_in %}
|
||||
<a class ="bar-item" href="/admin/thread?oid={{aid}}"><strong>{{ meta.count_reply }}</strong> replies</a>{% endif %}
|
||||
|
||||
{% if meta.count_boost and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_boost }}</strong> boosts</a>{% endif %}
|
||||
{% if meta.count_like and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_like }}</strong> likes</a>{% endif %}
|
||||
{% if meta.count_boost and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_boost }}</strong> boosts</a>{% endif %}
|
||||
{% if meta.count_like and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_like }}</strong> likes</a>{% endif %}
|
||||
|
||||
{% if session.logged_in %}
|
||||
{% if ui%}
|
||||
|
@ -132,7 +134,6 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue