Update Site source

This commit is contained in:
Meghdad committed 2026-10-12 23:37:40 +03:30
1 parent 4a6b4fe92e
commit 3144a675e6
8 files changed
+93 -6

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
import { ledgerSnapshot } from '../../../lib/share';
import { readLedger, isAdmin } from '../../../lib/server';
export const dynamic='force-dynamic';
export async function GET(){try{return Response.json({rows:await readLedger(),admin:await isAdmin()},{headers:{'Cache-Control':'no-store'}});}catch{return Response.json({error:'بارگذاری خزانه ممکن نشد. دوباره تلاش کنید.'},{status:503});}}
export async function GET(){try{const rows=await readLedger();const snapshot=await ledgerSnapshot(rows);return Response.json({rows,shareUrl:snapshot.shareUrl,admin:await isAdmin()},{headers:{'Cache-Control':'no-store'}});}catch{return Response.json({error:'بارگذاری خزانه ممکن نشد. دوباره تلاش کنید.'},{status:503});}}
+17
View File
@@ -0,0 +1,17 @@
import { ImageResponse } from 'next/og';
import { createElement } from 'react';
import { readLedger } from '../../../lib/server';
import { ledgerSnapshot } from '../../../lib/share';
import { ShareCard } from '../../../lib/share-card';
export const dynamic = 'force-dynamic';
export async function GET() {
try {
const data = await ledgerSnapshot(await readLedger());
return new ImageResponse(createElement(ShareCard, {data}), {
width:1200,height:630,
headers:{'Cache-Control':'no-store, max-age=0','X-Ledger-Revision':data.revision},
});
} catch {
return new Response('Live vault image is temporarily unavailable.',{status:503,headers:{'Cache-Control':'no-store'}});
}
}