mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-21 22:34:24 +01:00
Fetch link previews with facebookexternalhit instead of WhatsApp/2 by default, make it configurable
This commit is contained in:
@@ -3,6 +3,7 @@ import Debug from '@soapbox/stickynotes/debug';
|
||||
import DOMPurify from 'isomorphic-dompurify';
|
||||
import { unfurl } from 'unfurl.js';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { PreviewCard } from '@/entities/PreviewCard.ts';
|
||||
import { Time } from '@/utils/time.ts';
|
||||
import { fetchWorker } from '@/workers/fetch.ts';
|
||||
@@ -15,7 +16,10 @@ async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard
|
||||
const result = await unfurl(url, {
|
||||
fetch: (url) =>
|
||||
fetchWorker(url, {
|
||||
headers: { 'User-Agent': 'WhatsApp/2' },
|
||||
headers: {
|
||||
'Accept': 'text/html, application/xhtml+xml',
|
||||
'User-Agent': Conf.fetchUserAgent,
|
||||
},
|
||||
signal,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user