Tweak the lookup

This commit is contained in:
Thomas Sileo 2018-07-30 09:41:04 +02:00
parent 6cda5402f7
commit 88186e2306
3 changed files with 6 additions and 5 deletions

2
app.py
View file

@ -219,7 +219,7 @@ def _get_file_url(url, size, kind):
return u return u
# MEDIA_CACHE.cache(url, kind) # MEDIA_CACHE.cache(url, kind)
app.logger.error("cache not available for {url}/{size}/{kind}") app.logger.error(f"cache not available for {url}/{size}/{kind}")
return url return url

View file

@ -40,7 +40,7 @@
{% if not perma %} {% if not perma %}
<span style="float:right;width: 20%;text-align: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;"> <span style="float:right;width: 20%;text-align: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;">
<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj.url | get_url }}"> <a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj | url_or_id | get_url }}">
<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 %}

View file

@ -10,6 +10,7 @@ from little_boxes.webfinger import get_actor_url
def lookup(url: str) -> ap.BaseActivity: def lookup(url: str) -> ap.BaseActivity:
"""Try to find an AP object related to the given URL.""" """Try to find an AP object related to the given URL."""
try: try:
if url.startswith('@'):
actor_url = get_actor_url(url) actor_url = get_actor_url(url)
if actor_url: if actor_url:
return ap.fetch_remote_activity(actor_url) return ap.fetch_remote_activity(actor_url)