forked from forks/microblog.pub
Add support for Article
This commit is contained in:
parent
6cc30f622a
commit
d3db16c63d
3 changed files with 18 additions and 3 deletions
8
app.py
8
app.py
|
@ -336,6 +336,14 @@ def has_type(doc, _type):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@app.template_filter()
|
||||||
|
def has_actor_type(doc):
|
||||||
|
for t in ap.ACTOR_TYPES:
|
||||||
|
if has_type(doc, t.value):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _is_img(filename):
|
def _is_img(filename):
|
||||||
filename = filename.lower()
|
filename = filename.lower()
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{% if data %}
|
{% if data %}
|
||||||
{% set data = data.to_dict() %}
|
{% set data = data.to_dict() %}
|
||||||
<div id="lookup-result" style="margin-top:30px;">
|
<div id="lookup-result" style="margin-top:30px;">
|
||||||
{% if data | has_type('Person') or data | has_type('Service') %}
|
{% if data | has_actor_type %}
|
||||||
<div style="margin-left:95px;padding-bottom:5px;margin-bottom:15px;">
|
<div style="margin-left:95px;padding-bottom:5px;margin-bottom:15px;">
|
||||||
<form action="/api/follow" class="action-form" method="POST">
|
<form action="/api/follow" class="action-form" method="POST">
|
||||||
<input type="hidden" name="redirect" value="{{ request.path }}"/>
|
<input type="hidden" name="redirect" value="{{ request.path }}"/>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set actor = obj.attributedTo | get_actor %}
|
{% set actor = obj.attributedTo | get_actor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="note-box">
|
<div class="note-box">
|
||||||
<div class="note h-entry" id="activity-{{ obj.id | permalink_id }}">
|
<div class="note h-entry" id="activity-{{ obj.id | permalink_id }}">
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="note-wrapper">
|
<div class="note-wrapper">
|
||||||
|
<div style="clear:both;height:20px;">
|
||||||
<a href="{{ actor | url_or_id | get_url }}" style="margin:0;text-decoration:none;margin: 0;text-decoration: none;display: block;width: 80%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float: left;" class="no-hover"><strong>{{ actor.name or actor.preferredUsername }}</strong>
|
<a href="{{ actor | url_or_id | get_url }}" style="margin:0;text-decoration:none;margin: 0;text-decoration: none;display: block;width: 80%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float: left;" class="no-hover"><strong>{{ actor.name or actor.preferredUsername }}</strong>
|
||||||
<span class="l">@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor.preferredUsername }}</span>{% else %}{{ actor.preferredUsername }}{% endif %}@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor | url_or_id | get_url | domain }}</span>{% else %}{{ actor | url_or_id | get_url | domain }}{% endif %}</span></a>
|
<span class="l">@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor.preferredUsername }}</span>{% else %}{{ actor.preferredUsername }}{% endif %}@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor | url_or_id | get_url | domain }}</span>{% else %}{{ actor | url_or_id | get_url | domain }}{% endif %}</span></a>
|
||||||
|
|
||||||
|
@ -42,12 +44,17 @@
|
||||||
<time class="dt-published" title="{{ obj.published }}" datetime="{{ obj.published }}">{{ obj.published | format_timeago }}</time></a>
|
<time class="dt-published" title="{{ obj.published }}" datetime="{{ obj.published }}">{{ obj.published | format_timeago }}</time></a>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean }}</p>{% endif %}
|
{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean }}</p>{% endif %}
|
||||||
<div class="note-container{% if perma %} perma{%endif%} p-name e-content">
|
<div class="note-container{% if perma %} perma{%endif%} p-name e-content">
|
||||||
|
{% if obj | has_type('Article') %}
|
||||||
|
{{ obj.name }} <a href="{{ obj | url_or_id | get_url }}">{{ obj | url_or_id | get_url }}</a>
|
||||||
|
{% else %}
|
||||||
{{ obj.content | clean | safe }}
|
{{ obj.content | clean | safe }}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if obj.attachment %}
|
{% if obj.attachment and obj | has_type('Note') %}
|
||||||
<div style="padding:20px 0;">
|
<div style="padding:20px 0;">
|
||||||
{% if obj.attachment | not_only_imgs %}
|
{% if obj.attachment | not_only_imgs %}
|
||||||
<h3 class="l">Attachment</h3>
|
<h3 class="l">Attachment</h3>
|
||||||
|
@ -68,7 +75,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if meta and meta.og_metadata %}
|
{% if meta and meta.og_metadata and obj | has_type('Note') %}
|
||||||
{% for og in meta.og_metadata %}
|
{% for og in meta.og_metadata %}
|
||||||
<a href="{{ og.url }}" class="og-link" style="margin:30px 0;clear:both;display: flex;">
|
<a href="{{ og.url }}" class="og-link" style="margin:30px 0;clear:both;display: flex;">
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in a new issue