mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02: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 {
|
||||
const response = await fetch(url, {
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (process.env.PROXY) {
|
||||
options.agent = new HttpsProxyAgent(process.env.PROXY);
|
||||
}
|
||||
|
||||
const response = await fetch(url, options);
|
||||
|
||||
if (response.ok) {
|
||||
const buffer = await response.buffer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue