diff --git a/apps/web/src/api/og/route.ts b/apps/web/src/api/og/route.ts new file mode 100644 index 000000000..17cd7e825 --- /dev/null +++ b/apps/web/src/api/og/route.ts @@ -0,0 +1,5 @@ +import { NextResponse } from 'next/server'; + +export async function GET() { + return NextResponse.json({ hello: 'world' }); +} diff --git a/apps/web/src/app/(share)/api/share/route.tsx b/apps/web/src/app/(share)/api/share/route.tsx new file mode 100644 index 000000000..d7984db84 --- /dev/null +++ b/apps/web/src/app/(share)/api/share/route.tsx @@ -0,0 +1,51 @@ +import { ImageResponse } from 'next/server'; + +export const config = { + runtime: 'edge', +}; + +export async function GET() { + const [imageData, fontData] = await Promise.all([ + fetch(new URL('../../../../assets/background-pattern.png', import.meta.url)).then((res) => + res.arrayBuffer(), + ), + fetch(new URL('../../../assets/Caveat-Regular.ttf', import.meta.url)).then((res) => + res.arrayBuffer(), + ), + ]); + + return new ImageResponse( + ( +
+
+
Duncan
+
+
+ ), + { + width: 1200, + height: 630, + fonts: [ + { + name: 'Caveat', + data: fontData, + style: 'italic', + }, + ], + }, + ); +} diff --git a/apps/web/src/app/(share)/share/page.tsx b/apps/web/src/app/(share)/share/page.tsx new file mode 100644 index 000000000..a0309503c --- /dev/null +++ b/apps/web/src/app/(share)/share/page.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +export default async function SharePage() { + return ( +
+

Share Page

+
+ ); +} diff --git a/apps/web/src/assets/Caveat-Regular.ttf b/apps/web/src/assets/Caveat-Regular.ttf new file mode 100644 index 000000000..96540955a Binary files /dev/null and b/apps/web/src/assets/Caveat-Regular.ttf differ diff --git a/apps/web/src/assets/Inter-Regular.ttf b/apps/web/src/assets/Inter-Regular.ttf new file mode 100644 index 000000000..8d4eebf20 Binary files /dev/null and b/apps/web/src/assets/Inter-Regular.ttf differ diff --git a/apps/web/src/assets/background-pattern-og.png b/apps/web/src/assets/background-pattern-og.png new file mode 100644 index 000000000..363bbd2e2 Binary files /dev/null and b/apps/web/src/assets/background-pattern-og.png differ diff --git a/apps/web/src/pages/api/share-og/index.tsx b/apps/web/src/pages/api/share-og/index.tsx new file mode 100644 index 000000000..a3e8b8308 --- /dev/null +++ b/apps/web/src/pages/api/share-og/index.tsx @@ -0,0 +1,62 @@ +import { ImageResponse } from 'next/server'; + +export const config = { + runtime: 'edge', +}; + +export default async function handler() { + const [imageData, CaveatFontData, InterFontData] = await Promise.all([ + fetch(new URL('../../../assets/background-pattern-og.png', import.meta.url)).then((res) => + res.arrayBuffer(), + ), + fetch(new URL('../../../assets/Caveat-Regular.ttf', import.meta.url)).then((res) => + res.arrayBuffer(), + ), + fetch(new URL('../../../assets/Inter-Regular.ttf', import.meta.url)).then((res) => + res.arrayBuffer(), + ), + ]); + + return new ImageResponse( + ( +
+
+
Duncan
+
+
+ You signed with Documenso +
+
+ ), + { + width: 1200, + height: 630, + fonts: [ + { + name: 'Caveat', + data: CaveatFontData, + style: 'italic', + }, + { + name: 'Inter', + data: InterFontData, + style: 'normal', + }, + ], + }, + ); +} diff --git a/packages/lib/types/font.d.ts b/packages/lib/types/font.d.ts new file mode 100644 index 000000000..1764f41e0 --- /dev/null +++ b/packages/lib/types/font.d.ts @@ -0,0 +1 @@ +declare module '*.ttf';