Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

feat: add oEmbed support for account, group, and post routes

yoginth.com 8b2a868a 0646c29b

verified
+42
+6
apps/api/src/routes/og/getAccount.ts
··· 34 34 <meta name="viewport" content="width=device-width" /> 35 35 <meta http-equiv="content-language" content="en-US" /> 36 36 <meta name="theme-color" content="${BRAND_COLOR}" /> 37 + <link 38 + rel="alternate" 39 + type="application/json+oembed" 40 + href="/og${link}/oembed" 41 + title="${escTitle}" 42 + /> 37 43 <title>${escTitle}</title> 38 44 <meta name="description" content="${escDescription}" /> 39 45 <meta property="og:title" content="${escTitle}" />
+6
apps/api/src/routes/og/getGroup.ts
··· 35 35 <meta name="viewport" content="width=device-width" /> 36 36 <meta http-equiv="content-language" content="en-US" /> 37 37 <meta name="theme-color" content="${BRAND_COLOR}" /> 38 + <link 39 + rel="alternate" 40 + type="application/json+oembed" 41 + href="/og/g/${group.address}/oembed" 42 + title="${escTitle}" 43 + /> 38 44 <title>${escTitle}</title> 39 45 <meta name="description" content="${escDescription}" /> 40 46 <meta property="og:title" content="${escTitle}" />
+6
apps/api/src/routes/og/getPost.ts
··· 57 57 <meta name="viewport" content="width=device-width" /> 58 58 <meta http-equiv="content-language" content="en-US" /> 59 59 <meta name="theme-color" content="${BRAND_COLOR}" /> 60 + <link 61 + rel="alternate" 62 + type="application/json+oembed" 63 + href="/og/posts/${(post as any).slug}/oembed" 64 + title="${escTitle}" 65 + /> 60 66 <title>${escTitle}</title> 61 67 <meta name="description" content="${escDescription}" /> 62 68 <meta property="og:title" content="${escTitle}" />
+24
apps/api/src/routes/og/index.ts
··· 4 4 import { z } from "zod"; 5 5 import getAccount from "./getAccount"; 6 6 import getGroup from "./getGroup"; 7 + import getOEmbed from "./getOEmbed"; 7 8 import getPost from "./getPost"; 8 9 9 10 const app = new Hono(); ··· 21 22 ); 22 23 23 24 app.get( 25 + "/posts/:slug/oembed", 26 + zValidator("param", z.object({ slug: z.string() })), 27 + getOEmbed 28 + ); 29 + 30 + app.get( 24 31 "/g/:address", 25 32 zValidator( 26 33 "param", ··· 28 35 ), 29 36 getGroup 30 37 ); 38 + 39 + app.get( 40 + "/g/:address/oembed", 41 + zValidator( 42 + "param", 43 + z.object({ address: z.string().regex(Regex.evmAddress) }) 44 + ), 45 + getOEmbed 46 + ); 47 + 48 + app.get( 49 + "/u/:username/oembed", 50 + zValidator("param", z.object({ username: z.string() })), 51 + getOEmbed 52 + ); 53 + 54 + app.get("/oembed", getOEmbed); 31 55 32 56 export default app;