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

refactor: remove oEmbed support from account, group, and post routes

yoginth.com 2fb5efb0 aabe1a57

verified
-71
-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 - /> 43 37 <title>${escTitle}</title> 44 38 <meta name="description" content="${escDescription}" /> 45 39 <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 - /> 44 38 <title>${escTitle}</title> 45 39 <meta name="description" content="${escDescription}" /> 46 40 <meta property="og:title" content="${escTitle}" />
-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;
-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 - /> 66 60 <title>${escTitle}</title> 67 61 <meta name="description" content="${escDescription}" /> 68 62 <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"; 8 7 import getPost from "./getPost"; 9 8 10 9 const app = new Hono(); ··· 22 21 ); 23 22 24 23 app.get( 25 - "/posts/:slug/oembed", 26 - zValidator("param", z.object({ slug: z.string() })), 27 - getOEmbed 28 - ); 29 - 30 - app.get( 31 24 "/g/:address", 32 25 zValidator( 33 26 "param", ··· 35 28 ), 36 29 getGroup 37 30 ); 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); 55 31 56 32 export default app;