@medialane/sdk 0.106.0 → 0.107.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/index.cjs CHANGED
@@ -1377,8 +1377,19 @@ function createRateLimiter(windowMs, max) {
1377
1377
  return true;
1378
1378
  };
1379
1379
  }
1380
+ var TRUSTED_APP_IP_HEADER = "x-medialane-client-ip";
1380
1381
  function requestIp(req) {
1381
- return req.headers.get("x-forwarded-for")?.split(",")[0].trim() ?? "unknown";
1382
+ const fromApp = req.headers.get(TRUSTED_APP_IP_HEADER)?.trim();
1383
+ if (fromApp) return fromApp;
1384
+ const fromEdge = req.headers.get("x-vercel-forwarded-for")?.split(",")[0]?.trim();
1385
+ if (fromEdge) return fromEdge;
1386
+ const forwarded = req.headers.get("x-forwarded-for");
1387
+ if (forwarded) {
1388
+ const hops = forwarded.split(",").map((hop) => hop.trim()).filter(Boolean);
1389
+ const nearest = hops[hops.length - 1];
1390
+ if (nearest) return nearest;
1391
+ }
1392
+ return "unknown";
1382
1393
  }
1383
1394
 
1384
1395
  // src/server/origin.ts
@@ -1981,6 +1992,7 @@ exports.STARKNET_POP_COLLECTION_CLASS_HASH = STARKNET_POP_COLLECTION_CLASS_HASH;
1981
1992
  exports.STARKNET_POP_FACTORY_CONTRACT = STARKNET_POP_FACTORY_CONTRACT;
1982
1993
  exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
1983
1994
  exports.SUPPORTED_URL_CHAINS = SUPPORTED_URL_CHAINS;
1995
+ exports.TRUSTED_APP_IP_HEADER = TRUSTED_APP_IP_HEADER;
1984
1996
  exports.assetHref = assetHref;
1985
1997
  exports.buildAssetMetadata = buildAssetMetadata;
1986
1998
  exports.chainFromSlug = chainFromSlug;