mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Pretend to be WhatsApp when fetching links
This commit is contained in:
parent
ba241f0431
commit
5f1b87c3b6
1 changed files with 5 additions and 1 deletions
|
|
@ -13,7 +13,11 @@ async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard
|
||||||
debug(`Unfurling ${url}...`);
|
debug(`Unfurling ${url}...`);
|
||||||
try {
|
try {
|
||||||
const result = await unfurl(url, {
|
const result = await unfurl(url, {
|
||||||
fetch: (url) => fetchWorker(url, { signal }),
|
fetch: (url) =>
|
||||||
|
fetchWorker(url, {
|
||||||
|
headers: { 'User-Agent': 'WhatsApp/2' },
|
||||||
|
signal,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const { oEmbed, title, description, canonical_url, open_graph } = result;
|
const { oEmbed, title, description, canonical_url, open_graph } = result;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue