mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Tweak the lookup
This commit is contained in:
parent
6cda5402f7
commit
88186e2306
3 changed files with 6 additions and 5 deletions
2
app.py
2
app.py
|
@ -219,7 +219,7 @@ def _get_file_url(url, size, kind):
|
|||
return u
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
{% if not perma %}
|
||||
<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>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
|
|
@ -10,9 +10,10 @@ from little_boxes.webfinger import get_actor_url
|
|||
def lookup(url: str) -> ap.BaseActivity:
|
||||
"""Try to find an AP object related to the given URL."""
|
||||
try:
|
||||
actor_url = get_actor_url(url)
|
||||
if actor_url:
|
||||
return ap.fetch_remote_activity(actor_url)
|
||||
if url.startswith('@'):
|
||||
actor_url = get_actor_url(url)
|
||||
if actor_url:
|
||||
return ap.fetch_remote_activity(actor_url)
|
||||
except NotAnActivityError:
|
||||
pass
|
||||
except requests.HTTPError:
|
||||
|
|
Loading…
Reference in a new issue