mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(embed): reddit links have to include '/comments/' to be embeddable
This commit is contained in:
@@ -306,6 +306,11 @@ const canEmbedHosts = new Set<string>([
|
||||
]);
|
||||
|
||||
export const canEmbed = (parsedUrl: URL): boolean => {
|
||||
if (redditHosts.has(parsedUrl.host)) {
|
||||
// Reddit posts are not embeddable if the URL does not include '/comments/'
|
||||
return parsedUrl.pathname.includes('/comments/');
|
||||
}
|
||||
|
||||
return canEmbedHosts.has(parsedUrl.host) || (parsedUrl.host.startsWith('yt.') && parsedUrl.searchParams.has('v'));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user