@farcaster/snap-hono 1.5.2 → 1.5.4

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.js CHANGED
@@ -214,7 +214,11 @@ function snapOriginFromRequest(request) {
214
214
  return fromEnv.replace(/\/$/, "");
215
215
  }
216
216
  }
217
- return new URL(request.url).origin;
217
+ const url = new URL(request.url);
218
+ const proto = request.headers.get("x-forwarded-proto") ??
219
+ url.protocol.replace(":", "");
220
+ const host = request.headers.get("x-forwarded-host") ?? url.host;
221
+ return `${proto}://${host}`;
218
222
  }
219
223
  function clientWantsSnapResponse(accept) {
220
224
  if (!accept || accept.trim() === "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/snap-hono",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Hono integration for Farcaster Snap servers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@resvg/resvg-wasm": "^2.6.2",
30
30
  "satori": "^0.10.0",
31
- "@farcaster/snap": "1.16.2"
31
+ "@farcaster/snap": "1.17.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "hono": ">=4.0.0"
package/src/index.ts CHANGED
@@ -313,7 +313,12 @@ function snapOriginFromRequest(request: Request): string {
313
313
  }
314
314
  }
315
315
 
316
- return new URL(request.url).origin;
316
+ const url = new URL(request.url);
317
+ const proto =
318
+ request.headers.get("x-forwarded-proto") ??
319
+ url.protocol.replace(":", "");
320
+ const host = request.headers.get("x-forwarded-host") ?? url.host;
321
+ return `${proto}://${host}`;
317
322
  }
318
323
 
319
324
  function clientWantsSnapResponse(accept: string | undefined): boolean {