mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Support PixelFed's attachment format
(for the first image, anyway)
This commit is contained in:
parent
424f8e004f
commit
948a2bf2f7
1 changed files with 4 additions and 0 deletions
|
@ -1451,6 +1451,8 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json
|
|||
post.url = request_json['object']['attachment'][0]['href'] # Lemmy
|
||||
if request_json['object']['attachment'][0]['type'] == 'Document':
|
||||
post.url = request_json['object']['attachment'][0]['url'] # Mastodon
|
||||
if request_json['object']['attachment'][0]['type'] == 'Image':
|
||||
post.url = request_json['object']['attachment'][0]['url'] # PixelFed
|
||||
if post.url:
|
||||
if is_image_url(post.url):
|
||||
post.type = POST_TYPE_IMAGE
|
||||
|
@ -1636,6 +1638,8 @@ def update_post_from_activity(post: Post, request_json: dict):
|
|||
post.url = request_json['object']['attachment'][0]['href'] # Lemmy
|
||||
if request_json['object']['attachment'][0]['type'] == 'Document':
|
||||
post.url = request_json['object']['attachment'][0]['url'] # Mastodon
|
||||
if request_json['object']['attachment'][0]['type'] == 'Image':
|
||||
post.url = request_json['object']['attachment'][0]['url'] # PixelFed
|
||||
if post.url == '':
|
||||
post.type = POST_TYPE_ARTICLE
|
||||
if (post.url and post.url != old_url) or (post.url == '' and old_url != ''):
|
||||
|
|
Loading…
Add table
Reference in a new issue