a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

adjust microlink og image to use deviceScaleFactor for pub quotes

+5 -4
+3 -2
app/lish/[did]/[publication]/[rkey]/l-quote/[quote]/opengraph-image.ts
··· 11 11 return getMicroLinkOgImage( 12 12 `/lish/${decodeURIComponent(props.params.did)}/${decodeURIComponent(props.params.publication)}/${props.params.rkey}/l-quote/${props.params.quote}#${quotePosition?.start.block.join(".")}_${quotePosition?.start.offset}`, 13 13 { 14 - width: 660, 15 - height: 345, 14 + width: 1132, 15 + height: 592, 16 + deviceScaleFactor: 2, 16 17 }, 17 18 ); 18 19 }
+2 -2
src/utils/getMicroLinkOgImage.ts
··· 2 2 3 3 export async function getMicroLinkOgImage( 4 4 path: string, 5 - options?: { width?: number; height?: number }, 5 + options?: { width?: number; height?: number; deviceScaleFactor?: number }, 6 6 ) { 7 7 const headersList = await headers(); 8 8 const hostname = headersList.get("x-forwarded-host"); 9 9 let protocol = headersList.get("x-forwarded-proto"); 10 10 let full_path = `${protocol}://${hostname}${path}`; 11 11 let response = await fetch( 12 - `https://pro.microlink.io/?url=${encodeURIComponent(full_path)}&screenshot=true&viewport.width=${options?.width || 1200}&viewport.height=${options?.height || 733}&meta=false&embed=screenshot.url&force=true`, 12 + `https://pro.microlink.io/?url=${encodeURIComponent(full_path)}&screenshot=true&viewport.width=${options?.width || 1200}&viewport.height=${options?.height || 733}&deviceScaleFactor=${options?.deviceScaleFactor || 1}&meta=false&embed=screenshot.url&force=true`, 13 13 { 14 14 headers: { 15 15 "x-api-key": process.env.MICROLINK_API_KEY!,