@medialane/sdk 0.188.0 → 0.189.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{errors-BmfXtwJN.d.cts → errors-CrBviXC8.d.cts} +0 -1
- package/dist/{errors-Ds0aiIkd.d.ts → errors-kCrcWfrz.d.ts} +0 -1
- package/dist/index.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.d.cts +2 -2
- package/dist/starknet/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -453,6 +453,15 @@ async function readBodyWithCap(res, maxBytes) {
|
|
|
453
453
|
function createImageProxyHandler(config) {
|
|
454
454
|
const doFetch = config.fetchImpl ?? fetch;
|
|
455
455
|
const userAgent = config.userAgent ?? DEFAULT_USER_AGENT;
|
|
456
|
+
const backendOrigin = config.backend ? new URL(config.backend.backendUrl).origin : null;
|
|
457
|
+
function headersFor(url) {
|
|
458
|
+
const headers2 = { "User-Agent": userAgent };
|
|
459
|
+
if (!config.backend || url.origin !== backendOrigin) return headers2;
|
|
460
|
+
if (config.backend.apiKey) headers2["x-api-key"] = config.backend.apiKey;
|
|
461
|
+
headers2["x-app-id"] = config.backend.appId;
|
|
462
|
+
if (config.backend.appSecret) headers2["x-app-secret"] = config.backend.appSecret;
|
|
463
|
+
return headers2;
|
|
464
|
+
}
|
|
456
465
|
async function resolvesToPrivateHost(hostname) {
|
|
457
466
|
try {
|
|
458
467
|
const addresses = await config.resolveHostname(hostname);
|
|
@@ -469,7 +478,7 @@ function createImageProxyHandler(config) {
|
|
|
469
478
|
}
|
|
470
479
|
const res = await doFetch(url.toString(), {
|
|
471
480
|
redirect: "manual",
|
|
472
|
-
headers:
|
|
481
|
+
headers: headersFor(url)
|
|
473
482
|
});
|
|
474
483
|
if (res.status >= 300 && res.status < 400) {
|
|
475
484
|
const location = res.headers.get("location");
|
|
@@ -621,7 +630,8 @@ var PUBLIC_ROUTES = {
|
|
|
621
630
|
`sponsorship/proposals/${SEG}`,
|
|
622
631
|
"sponsorship/licenses",
|
|
623
632
|
`sponsorship/licenses/${SEG}`,
|
|
624
|
-
"auth/email/exists"
|
|
633
|
+
"auth/email/exists",
|
|
634
|
+
`media/${SEG}/${SEG}/${SEG}/image`
|
|
625
635
|
].map((p) => new RegExp(`^${p}$`)),
|
|
626
636
|
POST: [
|
|
627
637
|
"auth/email/(request-code|verify-code|register-account|confirm)",
|