Add pinterest domain and asset domains for link preview support
Co-authored-by: ken@signal.org Co-authored-by: @cmswalker
This commit is contained in:
parent
2a5cd3e4ea
commit
4a8e0bd466
2 changed files with 41 additions and 4 deletions
|
@ -34,6 +34,9 @@ const SUPPORTED_DOMAINS = [
|
|||
'instagram.com',
|
||||
'www.instagram.com',
|
||||
'm.instagram.com',
|
||||
'pinterest.com',
|
||||
'www.pinterest.com',
|
||||
'pin.it',
|
||||
];
|
||||
function isLinkInWhitelist(link) {
|
||||
try {
|
||||
|
@ -58,7 +61,7 @@ function isLinkInWhitelist(link) {
|
|||
}
|
||||
}
|
||||
|
||||
const SUPPORTED_MEDIA_DOMAINS = /^([^.]+\.)*(ytimg.com|cdninstagram.com|redd.it|imgur.com|fbcdn.net)$/i;
|
||||
const SUPPORTED_MEDIA_DOMAINS = /^([^.]+\.)*(ytimg.com|cdninstagram.com|redd.it|imgur.com|fbcdn.net|pinimg.com)$/i;
|
||||
function isMediaLinkInWhitelist(link) {
|
||||
try {
|
||||
const url = new URL(link);
|
||||
|
@ -81,8 +84,8 @@ function isMediaLinkInWhitelist(link) {
|
|||
}
|
||||
}
|
||||
|
||||
const META_TITLE = /<meta\s+property="og:title"\s+content="([\s\S]+?)"\s*\/?\s*>/im;
|
||||
const META_IMAGE = /<meta\s+property="og:image"\s+content="([\s\S]+?)"\s*\/?\s*>/im;
|
||||
const META_TITLE = /<meta\s+property="og:title"[^>]+?content="([\s\S]+?)"[^>]*>/im;
|
||||
const META_IMAGE = /<meta\s+property="og:image"[^>]+?content="([\s\S]+?)"[^>]*>/im;
|
||||
function _getMetaTag(html, regularExpression) {
|
||||
const match = regularExpression.exec(html);
|
||||
if (match && match[1]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue