Add a P2P panel to the admin page
This commit is contained in:
@@ -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 }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user