mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Respect proxies when fetching link previews
This commit is contained in:
@@ -999,6 +999,14 @@ export function initialize({
|
||||
socketManager.authenticate({ username, password });
|
||||
}
|
||||
|
||||
let fetchForLinkPreviews: linkPreviewFetch.FetchFn;
|
||||
if (proxyUrl) {
|
||||
const agent = new ProxyAgent(proxyUrl);
|
||||
fetchForLinkPreviews = (href, init) => fetch(href, { ...init, agent });
|
||||
} else {
|
||||
fetchForLinkPreviews = fetch;
|
||||
}
|
||||
|
||||
// Thanks, function hoisting!
|
||||
return {
|
||||
getSocketStatus,
|
||||
@@ -1968,7 +1976,7 @@ export function initialize({
|
||||
abortSignal: AbortSignal
|
||||
) {
|
||||
return linkPreviewFetch.fetchLinkPreviewMetadata(
|
||||
fetch,
|
||||
fetchForLinkPreviews,
|
||||
href,
|
||||
abortSignal
|
||||
);
|
||||
@@ -1978,7 +1986,11 @@ export function initialize({
|
||||
href: string,
|
||||
abortSignal: AbortSignal
|
||||
) {
|
||||
return linkPreviewFetch.fetchLinkPreviewImage(fetch, href, abortSignal);
|
||||
return linkPreviewFetch.fetchLinkPreviewImage(
|
||||
fetchForLinkPreviews,
|
||||
href,
|
||||
abortSignal
|
||||
);
|
||||
}
|
||||
|
||||
async function makeProxiedRequest(
|
||||
|
||||
Reference in New Issue
Block a user