mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
federate higher quality images
This commit is contained in:
parent
dff6fc31e7
commit
4dddd7724f
2 changed files with 6 additions and 3 deletions
|
@ -776,14 +776,15 @@ def federate_post(community, post):
|
||||||
if post.type == POST_TYPE_LINK or post.type == POST_TYPE_VIDEO:
|
if post.type == POST_TYPE_LINK or post.type == POST_TYPE_VIDEO:
|
||||||
page['attachment'] = [{'href': post.url, 'type': 'Link'}]
|
page['attachment'] = [{'href': post.url, 'type': 'Link'}]
|
||||||
elif post.image_id:
|
elif post.image_id:
|
||||||
if post.image.file_path:
|
image_url = ''
|
||||||
|
if post.image.source_url:
|
||||||
|
image_url = post.image.source_url
|
||||||
|
elif post.image.file_path:
|
||||||
image_url = post.image.file_path.replace('app/static/',
|
image_url = post.image.file_path.replace('app/static/',
|
||||||
f"https://{current_app.config['SERVER_NAME']}/static/")
|
f"https://{current_app.config['SERVER_NAME']}/static/")
|
||||||
elif post.image.thumbnail_path:
|
elif post.image.thumbnail_path:
|
||||||
image_url = post.image.thumbnail_path.replace('app/static/',
|
image_url = post.image.thumbnail_path.replace('app/static/',
|
||||||
f"https://{current_app.config['SERVER_NAME']}/static/")
|
f"https://{current_app.config['SERVER_NAME']}/static/")
|
||||||
else:
|
|
||||||
image_url = post.image.source_url
|
|
||||||
# NB image is a dict while attachment is a list of dicts (usually just one dict in the list)
|
# NB image is a dict while attachment is a list of dicts (usually just one dict in the list)
|
||||||
page['image'] = {'type': 'Image', 'url': image_url}
|
page['image'] = {'type': 'Image', 'url': image_url}
|
||||||
if post.type == POST_TYPE_IMAGE:
|
if post.type == POST_TYPE_IMAGE:
|
||||||
|
|
|
@ -31,3 +31,5 @@ Disallow: /
|
||||||
User-agent: DataForSeoBot
|
User-agent: DataForSeoBot
|
||||||
Disallow: /
|
Disallow: /
|
||||||
|
|
||||||
|
User-agent: MJ12bot
|
||||||
|
Disallow: /
|
||||||
|
|
Loading…
Add table
Reference in a new issue