tim plugin, chat bot sync notifications, test fixes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ca47052768
commit
3b7c7cf5ac
21 files changed
+827
-14
No files matched your search
@@ -892,6 +892,28 @@ if (str_starts_with($route, '/api/')) {
|
||||
}
|
||||
$pulled++;
|
||||
|
||||
// Send bot notification back to the sender so their chat shows the
|
||||
// sync confirmation. Best effort — relay may be older and not have
|
||||
// /api/chat/bot; we don't want to fail the poll on it.
|
||||
$senderName = $msg['sender_username'] ?? '';
|
||||
if ($senderName && $senderName !== $relayUser) {
|
||||
$botBody = $relayUser . ' synced: ' . $title;
|
||||
$bch = curl_init(rtrim($relayUrl, '/') . '/api/chat/bot');
|
||||
curl_setopt_array($bch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => json_encode(['recipient' => $senderName, 'body' => $botBody]),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Content-Type: application/json',
|
||||
'X-Relay-User: ' . $relayUser,
|
||||
'X-Relay-Key: ' . $relayKey,
|
||||
],
|
||||
CURLOPT_TIMEOUT => 5,
|
||||
]);
|
||||
curl_exec($bch);
|
||||
curl_close($bch);
|
||||
}
|
||||
|
||||
// Download attachments
|
||||
if ($relayUid) {
|
||||
$ach = curl_init(rtrim($relayUrl, '/') . '/api/attachments?relay_uid=' . urlencode($relayUid));
|
||||
|
||||
Reference in new issue
Block a user