Add a P2P panel to the admin page

This commit is contained in:
Claude
2026-09-30 08:02:52 +00:00
parent c55cf1f651
commit 84cd00368d
5 changed files with 80 additions and 1 deletions

View File

@@ -268,3 +268,14 @@ export async function findMediaByCid(cid) {
});
return rowsOf(r)[0] || null;
}
// Admin panel (plan 019): newest verified/revoked files with their holder counts.
export async function recentContent(limit = 30) {
const r = await db.execute({
sql: `SELECT c.cid, c.video_id, c.size, c.height, c.vcodec, c.origin, c.status, c.scan, c.verified_at, c.meta,
(SELECT COUNT(*) FROM p2p_holders h WHERE h.cid = c.cid AND h.status = 'active') AS holders
FROM p2p_content c ORDER BY c.verified_at DESC LIMIT ?`,
args: [limit],
});
return rowsOf(r).map((x) => ({ ...x, holders: Number(x.holders) || 0 }));
}