forked from mito-systems/sol-mem-gen
Remove title and description from page metadata
This commit is contained in:
parent
20b4fe3182
commit
0107137271
@ -17,7 +17,7 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
const { handle, txSignature } = extractData(data.html);
|
||||
if (!handle || !txSignature) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Verification failed' },
|
||||
{ error: 'Could not extract tweet data' },
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
@ -25,13 +25,14 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
||||
const isSigVerified = await verifySignatureInTweet(txSignature);
|
||||
const isHandleCorrect = handle === process.env.NEXT_PUBLIC_ACCOUNT_HANDLE;
|
||||
|
||||
// TODO: Verify dynamic page URL in tweet
|
||||
const isVerified = isSigVerified && isHandleCorrect;
|
||||
if (!isVerified) {
|
||||
throw new Error('Tweet is not valid');
|
||||
}
|
||||
|
||||
const { isFourth } = await saveTweet({ transactionSignature: txSignature });
|
||||
if (isFourth) {
|
||||
const { isFourthUser } = await saveTweet({ transactionSignature: txSignature });
|
||||
if (isFourthUser) {
|
||||
createTokenLockForRecipient();
|
||||
}
|
||||
|
||||
@ -61,6 +62,7 @@ const extractData = (tweet: string | object) => {
|
||||
};
|
||||
};
|
||||
|
||||
// TODO: Implement function to create lock for a recipient
|
||||
const createTokenLockForRecipient = () => {
|
||||
console.log('Lock created');
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ export async function generateMetadata(
|
||||
const meme = getMeme(params.id);
|
||||
|
||||
return {
|
||||
title: '',
|
||||
description: '',
|
||||
metadataBase: new URL(baseUrl),
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
@ -42,7 +40,7 @@ export default function MemePage({ params }: Props) {
|
||||
<div className="relative w-full max-w-2xl aspect-square">
|
||||
<img
|
||||
src={meme}
|
||||
alt='Generated image'
|
||||
alt='Generated meme'
|
||||
className="object-contain rounded-lg w-full h-full"
|
||||
/>
|
||||
</div>
|
||||
|
@ -5,8 +5,6 @@ import BN from 'bn.js';
|
||||
import Big from 'big.js';
|
||||
import dynamic from 'next/dynamic'
|
||||
|
||||
import TweetUrlForm from './TweetForm';
|
||||
|
||||
interface AIServiceCardProps {
|
||||
title: string
|
||||
description: string
|
||||
|
@ -5,7 +5,7 @@ import React, { useState } from 'react'
|
||||
const TweetUrlForm: React.FC = () => {
|
||||
const [inputText, setInputText] = useState<string>('')
|
||||
|
||||
const handleGenerate = async (): Promise<void> => {
|
||||
const handleVerify = async (): Promise<void> => {
|
||||
try {
|
||||
const response = await fetch('/api/tweet', {
|
||||
method: 'POST',
|
||||
@ -43,7 +43,7 @@ const TweetUrlForm: React.FC = () => {
|
||||
rows={4}
|
||||
/>
|
||||
<button
|
||||
onClick={handleGenerate}
|
||||
onClick={handleVerify}
|
||||
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
|
||||
transition-all duration-200 shadow-lg hover:shadow-green-500/25
|
||||
|
@ -6,13 +6,13 @@ export async function verifySignatureInTweet(transactionSignature: string): Prom
|
||||
const paymentRepository = AppDataSource.getRepository(Payment);
|
||||
const payment = await paymentRepository.findOneBy({ transactionSignature });
|
||||
|
||||
const tweetRepository = AppDataSource.getRepository(Tweet);
|
||||
const tweet = await tweetRepository.findOneBy({ transactionSignature });
|
||||
|
||||
if (!payment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const tweetRepository = AppDataSource.getRepository(Tweet);
|
||||
const tweet = await tweetRepository.findOneBy({ transactionSignature });
|
||||
|
||||
if (tweet) {
|
||||
return false;
|
||||
}
|
||||
@ -20,14 +20,14 @@ export async function verifySignatureInTweet(transactionSignature: string): Prom
|
||||
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) => {
|
||||
const tweetRepository = transactionalEntityManager.getRepository(Tweet);
|
||||
|
||||
const tweet = await tweetRepository.save(data);
|
||||
|
||||
return {
|
||||
isFourth: tweet.id % 4 === 0
|
||||
isFourthUser: tweet.id % 4 === 0
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user