diff --git a/src/client/public/icon-512x512.png b/src/client/public/icon-512x512.png new file mode 100644 index 0000000..16102a8 Binary files /dev/null and b/src/client/public/icon-512x512.png differ diff --git a/src/server/src/routes.ts b/src/server/src/routes.ts index f399b66..6c63b3b 100644 --- a/src/server/src/routes.ts +++ b/src/server/src/routes.ts @@ -52,7 +52,11 @@ export const createExpressRouter = (ctx: AppContext) => { const snippet = await ctx.snippetService.get(did, rkey); if (snippet) { const url = `${env.PUBLIC_URL}/user/${snippet.authorDid}/snippet/${snippet.rkey}`; - return res.render("snippet", { snippet: snippet, url: url }); + return res.render("snippet", { + snippet: snippet, + url: url, + imageUrl: env.OG_IMAGE_URL, + }); } } return res.status(404).send(); diff --git a/src/server/src/util/env.ts b/src/server/src/util/env.ts index d7241c5..1c7950e 100644 --- a/src/server/src/util/env.ts +++ b/src/server/src/util/env.ts @@ -53,4 +53,10 @@ export const env = cleanEnv(process.env, { dev: "ws://localhost:6008/subscribe", }), }), + OG_IMAGE_URL: str({ + default: match({ + prod: "https://pastesphere.link/icon-512x512.png", + dev: "http://pastesphere.localhost/icon-512x512.png", + }), + }), }); diff --git a/src/server/views/snippet.ejs b/src/server/views/snippet.ejs index 0f1e0ce..a2ce758 100644 --- a/src/server/views/snippet.ejs +++ b/src/server/views/snippet.ejs @@ -10,6 +10,7 @@ +