-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4afedf4
commit 39b3dbd
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
diff --git a/node_modules/@napi-rs/canvas/load-image.js b/node_modules/@napi-rs/canvas/load-image.js | ||
index 09e74f0..5d10642 100644 | ||
index 09e74f0..0079ea8 100644 | ||
--- a/node_modules/@napi-rs/canvas/load-image.js | ||
+++ b/node_modules/@napi-rs/canvas/load-image.js | ||
@@ -59,6 +59,12 @@ function makeRequest(url, resolve, reject, redirectCount, requestOptions) { | ||
@@ -59,13 +59,19 @@ function makeRequest(url, resolve, reject, redirectCount, requestOptions) { | ||
// lazy load the lib | ||
const lib = isHttps ? (!https ? (https = require('https')) : https) : !http ? (http = require('http')) : http | ||
|
||
+ if (url.host === "i.imgur.com") { | ||
+ requestOptions ??= {}; | ||
+ requestOptions.headers ??= {}; | ||
+ requestOptions.headers.Authorization = process.env.YR_PROXY_AUTH; | ||
+ url = new URL(`https://proxy.yiff.rocks/get?url=${url.href}`); | ||
+ url = new URL(`https://proxy.yiff.rocks/get?url=${url.toString()}`); | ||
+ } | ||
lib | ||
.get(url.toString(), requestOptions || {}, (res) => { | ||
const shouldRedirect = REDIRECT_STATUSES.has(res.statusCode) && typeof res.headers.location === 'string' | ||
if (shouldRedirect && redirectCount > 0) | ||
return makeRequest(new URL(res.headers.location), resolve, reject, redirectCount - 1, requestOptions) | ||
if (typeof res.statusCode === 'number' && (res.statusCode < 200 || res.statusCode >= 300)) { | ||
- return reject(new Error(`remote source rejected with status code ${res.statusCode}`)) | ||
+ return reject(new Error(`remote source "${url.toString()}" rejected with status code ${res.statusCode}`)) | ||
} | ||
|
||
consumeStream(res).then(resolve, reject) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/node_modules/discord-arts/src/cards/profile-image.js b/node_modules/discord-arts/src/cards/profile-image.js | ||
index 6db3d23..386c8af 100644 | ||
--- a/node_modules/discord-arts/src/cards/profile-image.js | ||
+++ b/node_modules/discord-arts/src/cards/profile-image.js | ||
@@ -17,7 +17,7 @@ async function profileImage(userId, options) { | ||
return buffer; | ||
} catch (error) { | ||
if (error.message.includes('source rejected')) { | ||
- throw new DiscordArtsError(`Error loading user assets, try again later`, { userId }) | ||
+ throw new DiscordArtsError(`Error loading user assets, try again later`, { userId, cause: error }) | ||
} | ||
throw new DiscordArtsError(error?.message, { userId }) | ||
} | ||
diff --git a/node_modules/discord-arts/src/utils/error.utils.js b/node_modules/discord-arts/src/utils/error.utils.js | ||
index 1779fdf..b075070 100644 | ||
--- a/node_modules/discord-arts/src/utils/error.utils.js | ||
+++ b/node_modules/discord-arts/src/utils/error.utils.js | ||
@@ -1,7 +1,7 @@ | ||
class DiscordArtsError extends Error { | ||
constructor(message, info) { | ||
- const { userId, packageVersion } = info; | ||
- super(message); | ||
+ const { userId, packageVersion, cause } = info; | ||
+ super(message, { cause }); | ||
this.userId = userId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters