fix: don't refetch Threads avatars whose signed URL changed (v2.13.0)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55ce6a1fdd
commit
d400e4d838
3 files changed
+34
-2
No files matched your search
@@ -256,9 +256,18 @@ def store(db, note_id: int, target_url: str, origin: str, harvest: Harvest) -> N
|
||||
keep = [r for r in harvest.responses if not _opted_out(r)]
|
||||
dropped = [r.source_url for r in harvest.responses if _opted_out(r)]
|
||||
|
||||
from starpunk.avatars import cached_name
|
||||
|
||||
before = _display_state(db, note_id)
|
||||
for r in keep:
|
||||
snippet = _snippet(r.content_html) if r.content_html else None
|
||||
# Threads avatar URLs are signed and change on every request: keep
|
||||
# the stored URL while its saved copy exists, so it isn't refetched
|
||||
old = db.execute("SELECT author_photo FROM webmentions WHERE source_url = ? AND target_url = ?",
|
||||
(r.source_url, target_url)).fetchone()
|
||||
if old and old["author_photo"] and origin == "threads" \
|
||||
and cached_name(current_app.config["DATA_PATH"], old["author_photo"]):
|
||||
r.author_photo = old["author_photo"]
|
||||
db.execute(
|
||||
"""
|
||||
INSERT INTO webmentions (
|
||||
|
||||
Reference in new issue
Block a user