redirecter for ao3 that adds opengraph metadata
1import { ImageResponse } from "next/og"
2import { readFile } from 'node:fs/promises'
3import { join } from 'node:path'
4
5export const size = {
6 width: 1600,
7 height: 900,
8}
9export const alt = 'fixAO3'
10
11export const contentType = 'image/webp'
12
13export default async function Image() {
14 return new ImageResponse(
15 (
16 <div
17 style={{
18 backgroundColor: '#990000',
19 color: '#FFFFFF',
20 display: 'flex',
21 alignItems: 'center',
22 justifyContent: 'center',
23 width: '100%',
24 height: '100%',
25 fontFamily: 'Stack Sans Notch',
26 fontSize: 288,
27 fontWeight: 700
28 }}
29 >
30 {process.env.SITENAME}
31 </div>
32 ),
33 {
34 fonts: [
35 {
36 name: 'Stack Sans Notch',
37 data: await readFile(
38 join(process.cwd(), '/fonts/StackSansNotch-Regular.ttf')
39 ),
40 style: 'normal',
41 weight: 400
42 },
43 {
44 name: 'Stack Sans Notch',
45 data: await readFile(
46 join(process.cwd(), '/fonts/StackSansNotch-Bold.ttf')
47 ),
48 style: 'normal',
49 weight: 700
50 }
51 ]
52 }
53 )
54}