mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
PeerTube: process incoming Update/Video activity
This commit is contained in:
parent
2abadb183f
commit
4c1f5cad53
2 changed files with 14 additions and 0 deletions
|
@ -969,6 +969,16 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
|||
activity_log.exception_message = 'Edit attempt denied'
|
||||
else:
|
||||
activity_log.exception_message = 'PostReply not found'
|
||||
elif request_json['object']['type'] == 'Video': # PeerTube: editing a video (PT doesn't seem to Announce these)
|
||||
post = Post.query.filter_by(ap_id=request_json['object']['id']).first()
|
||||
if post:
|
||||
if can_edit(request_json['actor'], post):
|
||||
update_post_from_activity(post, request_json)
|
||||
activity_log.result = 'success'
|
||||
else:
|
||||
activity_log.exception_message = 'Edit attempt denied'
|
||||
else:
|
||||
activity_log.exception_message = 'Post not found'
|
||||
elif request_json['type'] == 'Delete':
|
||||
if isinstance(request_json['object'], str):
|
||||
ap_id = request_json['object'] # lemmy
|
||||
|
|
|
@ -1839,6 +1839,10 @@ def update_post_from_activity(post: Post, request_json: dict):
|
|||
old_url = post.url
|
||||
old_image_id = post.image_id
|
||||
post.url = ''
|
||||
if request_json['object']['type'] == 'Video':
|
||||
post.type = POST_TYPE_VIDEO
|
||||
# PeerTube URL isn't going to change, so set to old_url to prevent this function changing type or icon
|
||||
post.url = old_url
|
||||
if 'attachment' in request_json['object'] and len(request_json['object']['attachment']) > 0 and \
|
||||
'type' in request_json['object']['attachment'][0]:
|
||||
if request_json['object']['attachment'][0]['type'] == 'Link':
|
||||
|
|
Loading…
Add table
Reference in a new issue