diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx
deleted file mode 100644
index 2579c0c8..00000000
--- a/src/app/api/og/route.tsx
+++ /dev/null
@@ -1,145 +0,0 @@
-import { ImageResponse, type NextRequest } from "next/server"
-import removeMarkdown from "remove-markdown"
-import uniqolor from "uniqolor"
-
-import { gql } from "@urql/core"
-
-import { toGateway } from "~/lib/ipfs-parser"
-import { client } from "~/queries/graphql"
-
-const fontNormal = fetch(
- "https://github.com/lxgw/LxgwWenKai-Screen/releases/download/v1.300/LXGWWenKaiScreenR.ttf",
-).then((res) => res.arrayBuffer())
-
-export const runtime = "edge"
-
-export const revalidate = 60 * 60 * 24 // 24 hours
-export const GET = async (req: NextRequest) => {
- try {
- const fontData = await fontNormal
-
- // api/og?characterId=52055¬eId=286&site=innei-4525
- const noteId = req.nextUrl.searchParams.get("noteId")
- const characterId = req.nextUrl.searchParams.get("characterId")
-
- if (!noteId || !characterId)
- return new Response(`Missing noteId or characterId`, { status: 400 })
-
- const result = await client
- .query(
- gql`
- query getNote($characterId: Int!, $noteId: Int!) {
- note(
- where: {
- note_characterId_noteId_unique: {
- characterId: $characterId
- noteId: $noteId
- }
- }
- ) {
- metadata {
- content
- }
- character {
- handle
- metadata {
- content
- }
- }
- }
- }
- `,
- {
- characterId: parseInt(characterId),
- noteId: parseInt(noteId),
- },
- )
- .toPromise()
- const title = result.data.note.metadata?.content?.title
- const subtitle =
- result.data.note.metadata?.content?.summary ||
- removeMarkdown(result.data.note.metadata.content.content)
- const avatar = toGateway(
- result.data.note.character.metadata?.content?.avatars?.[0] ||
- `https://api.dicebear.com/6.x/bottts-neutral/svg?seed=${characterId}`,
- )
-
- const siteName =
- result.data.note.character.metadata?.content?.site_name ||
- result.data.note.character.metadata?.content?.name
-
- const bgAccent = uniqolor(title, {
- saturation: [30, 35],
- lightness: [60, 70],
- }).color
-
- const bgAccentLight = uniqolor(title, {
- saturation: [30, 35],
- lightness: [80, 90],
- }).color
-
- const bgAccentUltraLight = uniqolor(title, {
- saturation: [30, 35],
- lightness: [95, 96],
- }).color
-
- return new ImageResponse(
- (
-
-
- {avatar && (
- // eslint-disable-next-line @next/next/no-img-element
-

- )}
-
- {siteName}
-
-
-
- {title}
-
-
-
- {subtitle}
-
-
-
- ),
- {
- width: 1920,
- height: 1080,
- fonts: [
- {
- name: "LXGW WenKai Screen R",
- data: fontData,
- weight: 400,
- style: "normal",
- },
- ],
- },
- )
- } catch (e: any) {
- return new Response(`Failed to generate the OG image. Error ${e.message}`, {
- status: 500,
- })
- }
-}
diff --git a/src/app/site/[site]/[slug]/page.tsx b/src/app/site/[site]/[slug]/page.tsx
index caee5635..ba5677f4 100644
--- a/src/app/site/[site]/[slug]/page.tsx
+++ b/src/app/site/[site]/[slug]/page.tsx
@@ -8,6 +8,7 @@ import PageContent from "~/components/common/PageContent"
import { OIAButton } from "~/components/site/OIAButton"
import { PostFooter } from "~/components/site/PostFooter"
import PostMeta from "~/components/site/PostMeta"
+import { SITE_URL } from "~/lib/env"
import { getSiteLink } from "~/lib/helpers"
import { getTranslation } from "~/lib/i18n"
import { toCid, toGateway } from "~/lib/ipfs-parser"
@@ -44,7 +45,9 @@ export async function generateMetadata({
const description = page?.metadata?.content?.summary
- const images = toGateway(page?.metadata?.content?.cover!)
+ const siteImages =
+ site?.metadata?.content?.avatars?.[0] || `${SITE_URL}/assets/logo.svg`
+ const images = toGateway(page?.metadata?.content?.cover || siteImages)
const useLargeOGImage = !!page?.metadata?.content?.cover
const twitterCreator = site?.metadata?.content?.connected_accounts
?.find((account) => account?.endsWith?.("@twitter"))
diff --git a/src/lib/expand-unit.ts b/src/lib/expand-unit.ts
index 8dfbd749..fbef1035 100644
--- a/src/lib/expand-unit.ts
+++ b/src/lib/expand-unit.ts
@@ -54,9 +54,7 @@ export const expandCrossbellNote = async ({
expandedNote.metadata.content.cover =
expandedNote.metadata?.content?.attachments?.find(
(attachment) => attachment.name === "cover",
- )?.address ||
- rendered.cover ||
- `${SITE_URL}/api/og?noteId=${expandedNote.noteId}&characterId=${expandedNote.characterId}`
+ )?.address || rendered.cover
expandedNote.metadata.content.images = []
const cover = expandedNote.metadata?.content?.attachments?.find(
@@ -67,11 +65,6 @@ export const expandCrossbellNote = async ({
}
expandedNote.metadata.content.images =
expandedNote.metadata.content.images.concat(rendered.images)
- if (!expandedNote.metadata.content.images.length) {
- expandedNote.metadata.content.images.push(
- `${SITE_URL}/api/og?noteId=${expandedNote.noteId}&characterId=${expandedNote.characterId}`,
- )
- }
expandedNote.metadata.content.images = [
...new Set(expandedNote.metadata.content.images),
]