diff --git a/api/version/media-url_debug.log b/api/version/media-url_debug.log index 138174b..48796dd 100644 --- a/api/version/media-url_debug.log +++ b/api/version/media-url_debug.log @@ -260,3 +260,22 @@ [2026-01-28 02:00:25] Request: GET /api/version/media-url.php?url=https%3A%2F%2Flookaside.fbsbx.com%2Fwhatsapp_business%2Fattachments%2F%3Fmid%3D2371342336638440%26source%3Dwebhook%26ext%3D1769575796%26hash%3DARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA GET:{"url":"https:\/\/lookaside.fbsbx.com\/whatsapp_business\/attachments\/?mid=2371342336638440&source=webhook&ext=1769575796&hash=ARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA"} POST:[] [2026-01-28 02:00:26] Resolved media URL from Graph for mid 2371342336638440: https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2371342336638440&source=getMedia&ext=1769583926&hash=ARkwnC8kELAgDSp4Qy8qvU3cY6trphM71K08Ebb3rQDeXg [2026-01-28 02:00:26] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=1217156256734654&source=getMedia&ext=1769583926&hash=ARk42Fz7IB5FhjLHoVW-GF05cM0WjbFZU0NerKLOUo1W9g +[2026-01-28 03:18:05] Request: GET /api/version/media-url.php?id=1217156256734654 GET:{"id":"1217156256734654"} POST:[] +[2026-01-28 03:18:05] Graph API request to https://graph.facebook.com/v22.0/1217156256734654 +[2026-01-28 03:18:05] Request: GET /api/version/media-url.php?url=https%3A%2F%2Flookaside.fbsbx.com%2Fwhatsapp_business%2Fattachments%2F%3Fmid%3D2371342336638440%26source%3Dwebhook%26ext%3D1769575796%26hash%3DARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA GET:{"url":"https:\/\/lookaside.fbsbx.com\/whatsapp_business\/attachments\/?mid=2371342336638440&source=webhook&ext=1769575796&hash=ARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA"} POST:[] +[2026-01-28 03:18:05] Resolved media URL from Graph for mid 2371342336638440: https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2371342336638440&source=getMedia&ext=1769588585&hash=ARkVdjFC3Uu5nQJZXmE5lLktOjWCcPMYzZ61SBauirv_aw +[2026-01-28 03:18:05] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=1217156256734654&source=getMedia&ext=1769588585&hash=ARla4Pa4QEwiV_oieDGmCCLXztCpuE7Lw54OCd4KYs38ww +[2026-01-28 03:18:36] Request: GET /api/version/media-url.php?url=https%3A%2F%2Flookaside.fbsbx.com%2Fwhatsapp_business%2Fattachments%2F%3Fmid%3D2371342336638440%26source%3Dwebhook%26ext%3D1769575796%26hash%3DARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA GET:{"url":"https:\/\/lookaside.fbsbx.com\/whatsapp_business\/attachments\/?mid=2371342336638440&source=webhook&ext=1769575796&hash=ARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA"} POST:[] +[2026-01-28 03:18:36] Request: GET /api/version/media-url.php?id=1217156256734654 GET:{"id":"1217156256734654"} POST:[] +[2026-01-28 03:18:37] Graph API request to https://graph.facebook.com/v22.0/1217156256734654 +[2026-01-28 03:18:37] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=1217156256734654&source=getMedia&ext=1769588617&hash=ARlovSN0qil5sm9qyn2ShTZx9yQntDv12lgRO4QcpzurUg +[2026-01-28 03:18:37] Resolved media URL from Graph for mid 2371342336638440: https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2371342336638440&source=getMedia&ext=1769588617&hash=ARle3IQo63hp1ka0RQJj8T1d5z4NaBDD0eSWOtbjUjJvbg +[2026-01-28 03:18:43] Request: GET /api/version/media-url.php?url=https%3A%2F%2Flookaside.fbsbx.com%2Fwhatsapp_business%2Fattachments%2F%3Fmid%3D2371342336638440%26source%3Dwebhook%26ext%3D1769575796%26hash%3DARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA GET:{"url":"https:\/\/lookaside.fbsbx.com\/whatsapp_business\/attachments\/?mid=2371342336638440&source=webhook&ext=1769575796&hash=ARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA"} POST:[] +[2026-01-28 03:18:43] Resolved media URL from Graph for mid 2371342336638440: https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2371342336638440&source=getMedia&ext=1769588623&hash=ARn5LfU3xlBS_GsoBGqmCBbPH-eRU_EhsN4IcbCbsfna2w +[2026-01-28 03:18:56] Request: GET /api/version/media-url.php?url=https%3A%2F%2Flookaside.fbsbx.com%2Fwhatsapp_business%2Fattachments%2F%3Fmid%3D2371342336638440%26source%3Dwebhook%26ext%3D1769575796%26hash%3DARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA GET:{"url":"https:\/\/lookaside.fbsbx.com\/whatsapp_business\/attachments\/?mid=2371342336638440&source=webhook&ext=1769575796&hash=ARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA"} POST:[] +[2026-01-28 03:18:56] Resolved media URL from Graph for mid 2371342336638440: https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2371342336638440&source=getMedia&ext=1769588636&hash=ARmrR9Bm2eEnJVO6QBtfv7EHt6LDV7rJ82xjq9tb_t41OA +[2026-01-28 03:19:02] Request: GET /api/version/media-url.php?id=1217156256734654 GET:{"id":"1217156256734654"} POST:[] +[2026-01-28 03:19:02] Graph API request to https://graph.facebook.com/v22.0/1217156256734654 +[2026-01-28 03:19:02] Request: GET /api/version/media-url.php?url=https%3A%2F%2Flookaside.fbsbx.com%2Fwhatsapp_business%2Fattachments%2F%3Fmid%3D2371342336638440%26source%3Dwebhook%26ext%3D1769575796%26hash%3DARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA GET:{"url":"https:\/\/lookaside.fbsbx.com\/whatsapp_business\/attachments\/?mid=2371342336638440&source=webhook&ext=1769575796&hash=ARndVKdw1p0CCx3_DpTblR2aOVkb_W5mbTqGFPSOK77cjA"} POST:[] +[2026-01-28 03:19:02] Proxying Facebook media URL with Authorization to https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=1217156256734654&source=getMedia&ext=1769588642&hash=ARkCJbkmByU2tdLOv2EHpSH0F12MJjM_Oqj-hiGgNVSYAg +[2026-01-28 03:19:02] Resolved media URL from Graph for mid 2371342336638440: https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2371342336638440&source=getMedia&ext=1769588642&hash=ARl75SVpu4vAnsH1AXoBGSv5sjftMr7JPocagoN5kIdMWQ diff --git a/conversations.php b/conversations.php index d157c8b..403d3e0 100644 --- a/conversations.php +++ b/conversations.php @@ -889,6 +889,8 @@ if (!isset($_SESSION['user_id'])) {
+ + @@ -1774,6 +1776,25 @@ if (!isset($_SESSION['user_id'])) { this.sendMessage(); }); + // Botón actualizar mensajes + const refreshBtn = document.getElementById('refresh-messages-btn'); + if (refreshBtn) { + refreshBtn.addEventListener('click', async () => { + if (!this.currentUserId) return; + refreshBtn.disabled = true; + refreshBtn.innerHTML = ''; + try { + await this.loadMessages(this.currentUserId, true, true); + console.log('✅ Mensajes actualizados manualmente'); + } catch (e) { + console.error('Error actualizando mensajes:', e); + } finally { + refreshBtn.disabled = false; + refreshBtn.innerHTML = ''; + } + }); + } + // Forward handler: open preview when user chooses to forward an existing message this.forwardMessage = function(messageId) { try { @@ -2778,10 +2799,16 @@ if (!isset($_SESSION['user_id'])) { } const json = await resp.json(); if (json && json.success) { - // SSE actualizará las conversaciones automáticamente - // await this.loadConversations(); - alert('Conversación marcada como NO leída.'); + // Actualizar la conversación local para mostrar badge de no leído + const conv = this.conversations.find(c => String(c.user_id) === String(userId)); + if (conv) { + conv.unread_count = Math.max(1, conv.unread_count || 1); + } + // Refrescar la lista visual + this.renderConversations(); + console.log('✅ Conversación marcada como no leída'); } else { + console.error('Error marcando conversación como no leída:', json); alert('Error marcando conversación como no leída'); } } catch (e) { @@ -5246,10 +5273,5 @@ if (!isset($_SESSION['user_id'])) { - - - \ No newline at end of file