From 6ec218696453e45787f8502a8f9ac670446dd5aa Mon Sep 17 00:00:00 2001 From: Ankit Dash Date: Tue, 2 Jul 2024 13:58:14 +0530 Subject: [PATCH] avoid parsing --- apps/studio-next/src/app/page.tsx | 68 +------------------------------ 1 file changed, 1 insertion(+), 67 deletions(-) diff --git a/apps/studio-next/src/app/page.tsx b/apps/studio-next/src/app/page.tsx index 10a3c5b09..95367f726 100644 --- a/apps/studio-next/src/app/page.tsx +++ b/apps/studio-next/src/app/page.tsx @@ -1,74 +1,8 @@ import dynamic from 'next/dynamic'; -import parseURL from '@/helpers/parser'; -import { DocumentInfo } from '@/types'; const StudioWrapper = dynamic(() => import('@/components/StudioWrapper'), {ssr: false}) import { Metadata } from 'next'; -import ogImage from '@/img/meta-studio-og-image.jpeg'; -type Props = { - searchParams: { [key: string]: string | undefined }; -}; - -export async function generateMetadata({ - searchParams, -}: Props): Promise { - const base64Doc = searchParams["base64"]; - let metadata: Metadata = { - metadataBase: new URL("https://studio-studio-next.vercel.app"), - openGraph: { - type: "website", - title: "AsyncAPI Studio", - description: - "Studio for AsyncAPI specification, where you can validate, view preview documentation, and generate templates from AsyncAPI document.", - url: "https://studio-studio-next.vercel.app", - images: [ - { - url: ogImage.src, - alt: "AsyncAPI default image", - }, - ], - }, - twitter: { - site: "@AsyncAPISpec", - }, - }; - if (base64Doc) { - try { - const ogInfo: DocumentInfo = await parseURL(base64Doc); - metadata = { - ...metadata, - openGraph: { - ...metadata.openGraph, - title: ogInfo.title, - description: ogInfo.description, - images: [ - { - url: `https://ogp-studio.vercel.app/api/og?title=${ogInfo.title}&description=${ogInfo.description}&numServers=${ogInfo.numServers}&numChannels=${ogInfo.numChannels}`, - alt: "AsyncAPI default image", - }, - ], - }, - twitter: { - ...metadata.twitter, - title: ogInfo.title, - description: ogInfo.description, - images: [ - { - url: `https://ogp-studio.vercel.app/api/og?title=${ogInfo.title}&description=${ogInfo.description}&numServers=${ogInfo.numServers}&numChannels=${ogInfo.numChannels}`, - alt: "AsyncAPI default image", - }, - ], - }, - }; - } catch (error) { - console.error("Error parsing URL:", error); - } - } - - return metadata; -} -export default async function Home({ searchParams }: Props) { - await generateMetadata({ searchParams }); +export default async function Home() { return ( )