1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export const frameHtml = (frame, baseUrl = "") => {
const prefixUrl = url => baseUrl && url.startsWith("/") ? `${baseUrl}${url}` : url
const aspectRatio = frame.aspectRatio || "1.91:1"
const buttonsHtml = frame.buttons.map((b, i) => (`
<meta property="${`fc:frame:button:${i + 1}`}" content="${b.text}" />
<meta property="${`fc:frame:button:${i + 1}:target`}" content="${prefixUrl(b.target)}" />
<meta property="${`of:button:${i + 1}`}" content="${b.text}" />
<meta property="${`of:button:${i + 1}:target`}" content="${prefixUrl(b.target)}" />
`))
return (
`
<meta property="fc:frame" content="vNext" />
<meta property="of:version" content="vNext" />
<meta property="of:accepts:lens" content="1.0.0" />
<meta property="of:accepts:xmtp" content="2024-02-09" />
<meta property="fc:frame:image" content="${prefixUrl(frame.image)}" />
<meta property="of:image" content="${prefixUrl(frame.image)}" />
<meta property="og:image" content="${prefixUrl(frame.image)}" />
<meta property="fc:frame:image:aspect_ratio" content="${aspectRatio}" />
<meta property="of:image:aspect_ratio" content="${aspectRatio}" />
${buttonsHtml}
`
) as any
}