mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 12:27:44 +00:00
fix: og image compat
This commit is contained in:
@@ -7,7 +7,11 @@ const ogSchema = z.object({
|
|||||||
mode: z.string(),
|
mode: z.string(),
|
||||||
type: z.string(),
|
type: z.string(),
|
||||||
});
|
});
|
||||||
|
const val = {
|
||||||
|
heading: "Some headin",
|
||||||
|
mode: "dark",
|
||||||
|
type: "documentation",
|
||||||
|
};
|
||||||
export async function GET(req: Request) {
|
export async function GET(req: Request) {
|
||||||
try {
|
try {
|
||||||
const geist = await fetch(
|
const geist = await fetch(
|
||||||
@@ -18,7 +22,7 @@ export async function GET(req: Request) {
|
|||||||
).then((res) => res.arrayBuffer());
|
).then((res) => res.arrayBuffer());
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
const urlParamsValues = Object.fromEntries(url.searchParams);
|
const urlParamsValues = Object.fromEntries(url.searchParams);
|
||||||
const validParams = ogSchema.parse(urlParamsValues);
|
const validParams = ogSchema.parse(val);
|
||||||
const { heading, type } = validParams;
|
const { heading, type } = validParams;
|
||||||
const trueHeading =
|
const trueHeading =
|
||||||
heading.length > 140 ? `${heading.substring(0, 140)}...` : heading;
|
heading.length > 140 ? `${heading.substring(0, 140)}...` : heading;
|
||||||
@@ -27,8 +31,9 @@ export async function GET(req: Request) {
|
|||||||
|
|
||||||
const fontSize = trueHeading.length > 100 ? "30px" : "60px";
|
const fontSize = trueHeading.length > 100 ? "30px" : "60px";
|
||||||
return new ImageResponse(
|
return new ImageResponse(
|
||||||
|
(
|
||||||
<div
|
<div
|
||||||
tw="flex w-full relative flex-col p-9"
|
tw="flex w-full relative flex-col p-12"
|
||||||
style={{
|
style={{
|
||||||
color: paint,
|
color: paint,
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
@@ -38,7 +43,7 @@ export async function GET(req: Request) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
tw={`relative flex flex-col w-full h-full border-2 border-[${paint}]/20 p-8}`}
|
tw={`relative flex flex-col w-full h-full border-2 border-[${paint}]/20 p-10}`}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
style={{
|
style={{
|
||||||
@@ -182,7 +187,8 @@ export async function GET(req: Request) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>
|
||||||
|
),
|
||||||
{
|
{
|
||||||
width: 1200,
|
width: 1200,
|
||||||
height: 630,
|
height: 630,
|
||||||
|
|||||||
Reference in New Issue
Block a user