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 aabe1a57 8b2a868a

verified
+29
+29
apps/api/src/routes/og/getOEmbed.ts
··· 1 + import type { Context } from "hono"; 2 + 3 + const getOEmbed = async (ctx: Context) => { 4 + const params = ctx.req.param(); 5 + 6 + let authorUrl = "https://hey.xyz"; 7 + if (params.slug) { 8 + authorUrl = `https://hey.xyz/posts/${params.slug}`; 9 + } else if (params.username) { 10 + authorUrl = `https://hey.xyz/u/${params.username}`; 11 + } else if (params.address) { 12 + authorUrl = `https://hey.xyz/g/${params.address}`; 13 + } 14 + 15 + const payload = { 16 + author_name: "Hey", 17 + author_url: authorUrl, 18 + provider_name: "Hey", 19 + provider_url: "https://hey.xyz", 20 + title: "Embed", 21 + type: "rich", 22 + version: "1.0" 23 + } as const; 24 + 25 + ctx.header("Content-Type", "application/json+oembed"); 26 + return ctx.body(JSON.stringify(payload)); 27 + }; 28 + 29 + export default getOEmbed;