From 142b170ec99498bbeb41d7f4ce5b7140db597e56 Mon Sep 17 00:00:00 2001 From: Ibrahem Khalil Date: Thu, 30 Mar 2023 15:27:12 +0200 Subject: [PATCH] Allow/Add YouTube and Twitter mobile link previews (#3314) --- VERSION | 2 +- protocol/urls/urls.go | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 98e431957..06b552cfe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.142.3 +0.142.4 diff --git a/protocol/urls/urls.go b/protocol/urls/urls.go index 2d1065a0d..95bcd9ff2 100644 --- a/protocol/urls/urls.go +++ b/protocol/urls/urls.go @@ -80,11 +80,21 @@ func LinkPreviewWhitelist() []Site { Address: "youtu.be", ImageSite: false, }, + { + Title: "YouTube Mobile", + Address: "m.youtube.com", + ImageSite: false, + }, { Title: "Twitter", Address: "twitter.com", ImageSite: false, }, + { + Title: "Twitter Mobile", + Address: "mobile.twitter.com", + ImageSite: false, + }, { Title: "GIPHY GIFs shortener", Address: "gph.is", @@ -267,7 +277,7 @@ func GetLinkPreviewData(link string) (previewData LinkPreviewData, err error) { hostname := strings.ToLower(u.Hostname()) switch hostname { - case "youtube.com", "youtu.be", "www.youtube.com": + case "youtube.com", "youtu.be", "www.youtube.com", "m.youtube.com": return GetYoutubePreviewData(link) case "github.com", "our.status.im": return GetGenericLinkPreviewData(link) @@ -275,7 +285,7 @@ func GetLinkPreviewData(link string) (previewData LinkPreviewData, err error) { return GetGiphyPreviewData(link) case "gph.is": return GetGiphyShortURLPreviewData(link) - case "twitter.com": + case "twitter.com", "mobile.twitter.com": return GetTwitterPreviewData(link) case "media.tenor.com": return FakeGenericImageLinkPreviewData("Tenor", link)