mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
💊 fix: OpenID proxy support for downloading profile pictures (#3263)
Related to #3261 Add proxy support to `downloadImage` function in `openidStrategy.js` * Import `HttpsProxyAgent` from `https-proxy-agent`. * Add `agent` property to the fetch options in `downloadImage` function if `process.env.PROXY` is set. * Update the `fetch` call in `downloadImage` function to use the proxy agent if available.
This commit is contained in:
parent
1edbfdbce2
commit
e76777d298
1 changed files with 8 additions and 2 deletions
|
|
@ -25,12 +25,18 @@ const downloadImage = async (url, accessToken) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (process.env.PROXY) {
|
||||||
|
options.agent = new HttpsProxyAgent(process.env.PROXY);
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(url, options);
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const buffer = await response.buffer();
|
const buffer = await response.buffer();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue