support .mov videos on normal notes.

This commit is contained in:
fiatjaf
2023-10-01 15:56:35 -03:00
parent abd8102c78
commit 9901c47e46

View File

@@ -159,7 +159,7 @@ func grabData(ctx context.Context, code string, isProfileSitemap bool) (*Data, e
image = imageMatch[0] image = imageMatch[0]
} }
videoMatch := regexp.MustCompile(`https:\/\/[^ ]*\.(mp4|webm)`).FindStringSubmatch(event.Content) videoMatch := regexp.MustCompile(`https:\/\/[^ ]*\.(mp4|mov|webm)`).FindStringSubmatch(event.Content)
var video string var video string
if len(videoMatch) > 0 { if len(videoMatch) > 0 {
video = videoMatch[0] video = videoMatch[0]
@@ -169,6 +169,8 @@ func grabData(ctx context.Context, code string, isProfileSitemap bool) (*Data, e
if video != "" { if video != "" {
if strings.HasSuffix(video, "mp4") { if strings.HasSuffix(video, "mp4") {
videoType = "mp4" videoType = "mp4"
} else if strings.HasSuffix(video, "mov") {
videoType = "mov"
} else { } else {
videoType = "webm" videoType = "webm"
} }