Skip to content

Commit

Permalink
Merge pull request #269 from framesjs/feat/relative-image-urls
Browse files Browse the repository at this point in the history
feat: relative url support for images
  • Loading branch information
stephancill authored Apr 2, 2024
2 parents 9965461 + f7b00b0 commit 7c6e54f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/light-fireants-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"frames.js": patch
---

feat: relative url support for images
2 changes: 2 additions & 0 deletions packages/frames.js/src/middleware/openframes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ describe("openframes middleware", () => {
method: "POST",
body: JSON.stringify(signedPayload),
}),
url: new URL("https://example.com").toString(),
basePath: "/",
} as any;

const mw1 = openframes({
Expand Down
6 changes: 5 additions & 1 deletion packages/frames.js/src/middleware/renderResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export function renderResponse(): FramesMiddleware<any, {}> {
// and disabling it, has no effect on final bundle size of app
image:
typeof result.image === "string"
? result.image
? generateTargetURL({
target: result.image,
currentURL: context.url,
basePath: context.basePath,
})
: await renderImage(result.image, result.imageOptions).catch(
(e) => {
console.error(e);
Expand Down

0 comments on commit 7c6e54f

Please sign in to comment.