v2.1.29 - Remove SQLite support, hardcode PostgreSQL backend, fix admin API to use first_seen, add pgweb systemd service
This commit is contained in:
+32
-2
@@ -87,8 +87,27 @@ try {
|
||||
$inbox = $pdo->query("SELECT COUNT(*) AS pending, COUNT(*) FILTER (WHERE source_class='live') AS live, COUNT(*) FILTER (WHERE source_class='backfill') AS backfill FROM caching_event_inbox")->fetch() ?: $inbox;
|
||||
} catch (PDOException $e) {}
|
||||
|
||||
// Upstream relay status (per-relay connection state)
|
||||
$upstreamRelays = [];
|
||||
try {
|
||||
$upstreamRelays = $pdo->query("
|
||||
SELECT relay_url, status_code, status_text, updated_at
|
||||
FROM caching_upstream_relays
|
||||
ORDER BY relay_url
|
||||
")->fetchAll();
|
||||
} catch (PDOException $e) {}
|
||||
|
||||
// Follows (paginated, with names from profiles cache + per-relay progress)
|
||||
$page = max(1, (int)($_GET['page'] ?? 1));
|
||||
$perPage = 50;
|
||||
$offset = ($page - 1) * $perPage;
|
||||
|
||||
$follows = [];
|
||||
$totalFollows = 0;
|
||||
try {
|
||||
$totalFollows = (int)$pdo->query("SELECT COUNT(*) FROM caching_followed_pubkeys")->fetchColumn();
|
||||
} catch (PDOException $e) {}
|
||||
|
||||
try {
|
||||
$follows = $pdo->query("
|
||||
SELECT fp.pubkey, fp.is_root, fp.backfill_complete, fp.events_fetched,
|
||||
@@ -99,7 +118,8 @@ try {
|
||||
(SELECT count(*) FROM caching_backfill_relay_progress WHERE author_pubkey = fp.pubkey AND complete = false) AS relay_incomplete
|
||||
FROM caching_followed_pubkeys fp
|
||||
LEFT JOIN profiles p ON p.pubkey = fp.pubkey
|
||||
ORDER BY fp.is_root DESC, fp.events_fetched DESC LIMIT 1000
|
||||
ORDER BY fp.is_root DESC, fp.events_fetched DESC
|
||||
LIMIT $perPage OFFSET $offset
|
||||
")->fetchAll();
|
||||
// Fetch per-relay progress for all followed pubkeys in one query
|
||||
$relayProgress = [];
|
||||
@@ -120,4 +140,14 @@ try {
|
||||
}
|
||||
} catch (PDOException $e) {}
|
||||
|
||||
json_response(['state' => $state, 'active' => $active, 'inbox' => $inbox, 'follows' => $follows, 'config' => $config]);
|
||||
json_response([
|
||||
'state' => $state,
|
||||
'active' => $active,
|
||||
'inbox' => $inbox,
|
||||
'follows' => $follows,
|
||||
'config' => $config,
|
||||
'upstreamRelays' => $upstreamRelays,
|
||||
'totalFollows' => $totalFollows,
|
||||
'page' => $page,
|
||||
'perPage' => $perPage,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user