use thumbnail image for videos #366

This commit is contained in:
rimu 2024-12-03 09:15:03 +13:00
parent 04cce6ec9d
commit 36b272e797

View file

@ -1259,6 +1259,9 @@ class Post(db.Model):
post.image = image post.image = image
elif is_video_url(post.url): # youtube is detected later elif is_video_url(post.url): # youtube is detected later
post.type = constants.POST_TYPE_VIDEO post.type = constants.POST_TYPE_VIDEO
if 'image' in request_json['object'] and 'url' in request_json['object']['image']:
image = File(source_url=request_json['object']['image']['url'])
else:
image = File(source_url=post.url) image = File(source_url=post.url)
db.session.add(image) db.session.add(image)
post.image = image post.image = image