Add relative time to post cards; add Dispatch now button for manual testing

- View cards now show "2026-06-04 14:30 (in 2h)" next to the scheduled time
- New "Dispatch now" button runs dispatch-social.php immediately and shows
  output inline (useful for diagnosing why cron isn't sending posts)
- dispatch action added to /api/social

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-06-04 20:49:56 +03:00
parent e52f90445b
commit 629f2515e9
3 changed files with 31 additions and 1 deletions

View file

@ -192,5 +192,15 @@ if ($action === 'retry') {
exit;
}
// ── DISPATCH NOW ──────────────────────────────────────────────────────────────
if ($action === 'dispatch') {
$script = ROOT . '/bin/dispatch-social.php';
$output = [];
$code = 0;
exec('/usr/bin/php ' . escapeshellarg($script) . ' 2>&1', $output, $code);
echo json_encode(['ok' => true, 'output' => implode("\n", $output), 'exit' => $code]);
exit;
}
http_response_code(400);
echo json_encode(['error' => 'Unknown action']);