"${escapeHtml(truncatedMessage)}"
Farcaster embeds need valid https:// URLs. Localhost URLs won't work.
To test sharing:
jack shipAPP_URL in wrangler.jsonc to your deployed URL*.workers.dev URLRedirecting to ${appName}...
`; return c.html(html, 200, { "Cache-Control": "public, max-age=86400", }); }); // GET / - Inject fc:miniapp meta tags for Farcaster embeds on the main page // Without this, sharing the app URL in a cast won't render an embed card app.get("/", async (c) => { // Fetch the static index.html from Vite build const response = await c.env.ASSETS.fetch(c.req.raw); const html = await response.text(); const baseUrl = getBaseUrl(c.env, c); // Local dev - serve without meta tags (they require https URLs) if (!baseUrl) { return c.html(html); } // Build embed JSON (same structure as /share route) const embedJson = JSON.stringify({ version: "1", imageUrl: `${baseUrl}/og.png`, button: { title: "Open App", action: { type: "launch_miniapp", name: "jack-template", url: baseUrl, splashImageUrl: `${baseUrl}/icon.png`, splashBackgroundColor: "#0a0a0a", }, }, }); // Meta tags to inject const metaTags = ` `; // Inject before const injectedHtml = html.replace("", `${metaTags}`); return c.html(injectedHtml); }); // Serve React app for all other routes app.get("*", (c) => c.env.ASSETS.fetch(c.req.raw)); // Export type for hono/client export type AppType = typeof app; export default app;