Add player profile pages with transaction history and social share cards

This commit is contained in:
Meghdad committed 2026-10-27 02:46:37 +03:30
1 parent e6e5d9cb13
commit acffaa9e76
45 files changed
+30767 -7

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import {ImageResponse} from 'next/og';
import {createElement} from 'react';
import {readLedger} from '../../../lib/server';
import {playerSnapshot} from '../../../lib/player.mjs';
import {PlayerCard,playerCardWidth,playerCardHeight} from '../../../lib/player-card';
import {socialFonts} from '../../../lib/social-fonts';
export const dynamic='force-dynamic';
export async function GET(request:Request){
const name=new URL(request.url).searchParams.get('player');
if(!name||name.length>64)return new Response('Player not found',{status:404});
try{
const data=playerSnapshot(await readLedger(),name);
if(!data)return new Response('Player not found',{status:404});
return new ImageResponse(createElement(PlayerCard,{data}),{width:playerCardWidth,height:playerCardHeight,fonts:[...socialFonts],headers:{'Cache-Control':'no-store'}});
}catch{return new Response('تصویر حساب موقتاً در دسترس نیست.',{status:503,headers:{'Cache-Control':'no-store'}});}
}