Remove title and description from page metadata

This commit is contained in:
Adw8 2025-02-05 19:54:28 +05:30
parent 20b4fe3182
commit 0107137271
5 changed files with 13 additions and 15 deletions

View File

@ -17,7 +17,7 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
const { handle, txSignature } = extractData(data.html); const { handle, txSignature } = extractData(data.html);
if (!handle || !txSignature) { if (!handle || !txSignature) {
return NextResponse.json( return NextResponse.json(
{ error: 'Verification failed' }, { error: 'Could not extract tweet data' },
{ status: 500 } { status: 500 }
) )
} }
@ -25,13 +25,14 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
const isSigVerified = await verifySignatureInTweet(txSignature); const isSigVerified = await verifySignatureInTweet(txSignature);
const isHandleCorrect = handle === process.env.NEXT_PUBLIC_ACCOUNT_HANDLE; const isHandleCorrect = handle === process.env.NEXT_PUBLIC_ACCOUNT_HANDLE;
// TODO: Verify dynamic page URL in tweet
const isVerified = isSigVerified && isHandleCorrect; const isVerified = isSigVerified && isHandleCorrect;
if (!isVerified) { if (!isVerified) {
throw new Error('Tweet is not valid'); throw new Error('Tweet is not valid');
} }
const { isFourth } = await saveTweet({ transactionSignature: txSignature }); const { isFourthUser } = await saveTweet({ transactionSignature: txSignature });
if (isFourth) { if (isFourthUser) {
createTokenLockForRecipient(); createTokenLockForRecipient();
} }
@ -61,6 +62,7 @@ const extractData = (tweet: string | object) => {
}; };
}; };
// TODO: Implement function to create lock for a recipient
const createTokenLockForRecipient = () => { const createTokenLockForRecipient = () => {
console.log('Lock created'); console.log('Lock created');
} }

View File

@ -17,8 +17,6 @@ export async function generateMetadata(
const meme = getMeme(params.id); const meme = getMeme(params.id);
return { return {
title: '',
description: '',
metadataBase: new URL(baseUrl), metadataBase: new URL(baseUrl),
openGraph: { openGraph: {
type: 'website', type: 'website',
@ -42,7 +40,7 @@ export default function MemePage({ params }: Props) {
<div className="relative w-full max-w-2xl aspect-square"> <div className="relative w-full max-w-2xl aspect-square">
<img <img
src={meme} src={meme}
alt='Generated image' alt='Generated meme'
className="object-contain rounded-lg w-full h-full" className="object-contain rounded-lg w-full h-full"
/> />
</div> </div>

View File

@ -5,8 +5,6 @@ import BN from 'bn.js';
import Big from 'big.js'; import Big from 'big.js';
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
import TweetUrlForm from './TweetForm';
interface AIServiceCardProps { interface AIServiceCardProps {
title: string title: string
description: string description: string

View File

@ -5,7 +5,7 @@ import React, { useState } from 'react'
const TweetUrlForm: React.FC = () => { const TweetUrlForm: React.FC = () => {
const [inputText, setInputText] = useState<string>('') const [inputText, setInputText] = useState<string>('')
const handleGenerate = async (): Promise<void> => { const handleVerify = async (): Promise<void> => {
try { try {
const response = await fetch('/api/tweet', { const response = await fetch('/api/tweet', {
method: 'POST', method: 'POST',
@ -43,7 +43,7 @@ const TweetUrlForm: React.FC = () => {
rows={4} rows={4}
/> />
<button <button
onClick={handleGenerate} onClick={handleVerify}
className="w-full bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 className="w-full bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600
hover:to-emerald-600 text-white font-semibold py-4 px-6 rounded-xl hover:to-emerald-600 text-white font-semibold py-4 px-6 rounded-xl
transition-all duration-200 shadow-lg hover:shadow-green-500/25 transition-all duration-200 shadow-lg hover:shadow-green-500/25

View File

@ -6,13 +6,13 @@ export async function verifySignatureInTweet(transactionSignature: string): Prom
const paymentRepository = AppDataSource.getRepository(Payment); const paymentRepository = AppDataSource.getRepository(Payment);
const payment = await paymentRepository.findOneBy({ transactionSignature }); const payment = await paymentRepository.findOneBy({ transactionSignature });
const tweetRepository = AppDataSource.getRepository(Tweet);
const tweet = await tweetRepository.findOneBy({ transactionSignature });
if (!payment) { if (!payment) {
return false; return false;
} }
const tweetRepository = AppDataSource.getRepository(Tweet);
const tweet = await tweetRepository.findOneBy({ transactionSignature });
if (tweet) { if (tweet) {
return false; return false;
} }
@ -20,14 +20,14 @@ export async function verifySignatureInTweet(transactionSignature: string): Prom
return true; return true;
} }
export async function saveTweet(data: Partial<Tweet>): Promise<{ isFourth: boolean }> { export async function saveTweet(data: Partial<Tweet>): Promise<{ isFourthUser: boolean }> {
return await AppDataSource.transaction(async (transactionalEntityManager) => { return await AppDataSource.transaction(async (transactionalEntityManager) => {
const tweetRepository = transactionalEntityManager.getRepository(Tweet); const tweetRepository = transactionalEntityManager.getRepository(Tweet);
const tweet = await tweetRepository.save(data); const tweet = await tweetRepository.save(data);
return { return {
isFourth: tweet.id % 4 === 0 isFourthUser: tweet.id % 4 === 0
}; };
}); });
} }