mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
still cache actor for note with buggy links
This commit is contained in:
parent
6db28ac94d
commit
00b43fa935
1 changed files with 13 additions and 10 deletions
|
@ -366,7 +366,7 @@ def task_send_webmention() -> _Response:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/task/cache_actor", methods=["POST"])
|
@blueprint.route("/task/cache_actor", methods=["POST"]) # noqa: C910 # too complex
|
||||||
def task_cache_actor() -> _Response:
|
def task_cache_actor() -> _Response:
|
||||||
task = p.parse(flask.request)
|
task = p.parse(flask.request)
|
||||||
app.logger.info(f"task={task!r}")
|
app.logger.info(f"task={task!r}")
|
||||||
|
@ -381,6 +381,7 @@ def task_cache_actor() -> _Response:
|
||||||
# Fetch the Open Grah metadata if it's a `Create`
|
# Fetch the Open Grah metadata if it's a `Create`
|
||||||
if activity.has_type(ap.ActivityType.CREATE):
|
if activity.has_type(ap.ActivityType.CREATE):
|
||||||
obj = activity.get_object()
|
obj = activity.get_object()
|
||||||
|
try:
|
||||||
links = opengraph.links_from_note(obj.to_dict())
|
links = opengraph.links_from_note(obj.to_dict())
|
||||||
if links:
|
if links:
|
||||||
Tasks.fetch_og_meta(iri)
|
Tasks.fetch_og_meta(iri)
|
||||||
|
@ -391,6 +392,8 @@ def task_cache_actor() -> _Response:
|
||||||
and ap.get_visibility(obj) == ap.Visibility.PUBLIC
|
and ap.get_visibility(obj) == ap.Visibility.PUBLIC
|
||||||
):
|
):
|
||||||
Tasks.send_webmentions(activity, links)
|
Tasks.send_webmentions(activity, links)
|
||||||
|
except Exception:
|
||||||
|
app.logger.exception("failed to cache links")
|
||||||
|
|
||||||
if activity.has_type(ap.ActivityType.FOLLOW):
|
if activity.has_type(ap.ActivityType.FOLLOW):
|
||||||
if actor.id == config.ID:
|
if actor.id == config.ID:
|
||||||
|
|
Loading…
Reference in a new issue