From e388e185ba12fdff2786978d5a7bed666cbd80aa Mon Sep 17 00:00:00 2001 From: Adrian Victor Date: Tue, 14 Jul 2026 18:10:05 -0300 Subject: [PATCH] Make media links open in a new tab, removed some logs. --- app.js | 6 +++--- ui.js | 1 + utils.js | 3 --- waha.js | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 3d0da53..184ac10 100644 --- a/app.js +++ b/app.js @@ -94,7 +94,7 @@ function setupEventListeners() { function initWebSocket() { websocket.connect((data) => { - console.log('[WS] Received event:', data.event, data); + // console.log('[WS] Received event:', data.event, data); const ev = data.event; if (ev === 'message' || ev === 'message.any' || ev === 'message.ack') { handleIncomingMessage(data.payload); @@ -113,7 +113,7 @@ function normalizeChatId(raw) { function handleIncomingMessage(msg) { if (!msg) return; - console.log('[WS] handleIncomingMessage payload:', msg); + // console.log('[WS] handleIncomingMessage payload:', msg); const rawChatId = msg.chatId || msg.from || (msg.chat && msg.chat.id); const msgChatId = normalizeChatId(rawChatId); @@ -122,7 +122,7 @@ function handleIncomingMessage(msg) { return; } - console.log('[WS] Resolved msgChatId:', msgChatId, '| activeChatState:', activeChatState?.id); + // console.log('[WS] Resolved msgChatId:', msgChatId, '| activeChatState:', activeChatState?.id); if (activeChatState && activeChatState.id === msgChatId) { const msgId = normalizeChatId(msg.id) || msg.id; diff --git a/ui.js b/ui.js index 4f8909d..f680961 100644 --- a/ui.js +++ b/ui.js @@ -190,6 +190,7 @@ export const ui = { if (msg.hasMedia) { const a = document.createElement('a'); a.innerText = `[Request media]`; + a.target = "_blank"; const clickListener = async (e) => { a.removeEventListener('click', clickListener); diff --git a/utils.js b/utils.js index e9bea41..2224108 100644 --- a/utils.js +++ b/utils.js @@ -82,8 +82,6 @@ export function compensateMessageOrdering(messages) { export function getBase64(file) { return new Promise((resolve, reject) => { - console.log("Reading file...", file); - const reader = new FileReader(); reader.onload = () => { @@ -96,7 +94,6 @@ export function getBase64(file) { }; reader.onabort = () => { - console.log("Aborted"); reject(new Error("Aborted")); }; diff --git a/waha.js b/waha.js index 15028ea..106d5d5 100644 --- a/waha.js +++ b/waha.js @@ -40,7 +40,7 @@ async function downloadFile(path, options = {}) { if (config.apiKey) headers['X-Api-Key'] = config.apiKey; - console.log(`[WAHA] ${options.method || 'GET'} ${url}`); +// console.log(`[WAHA] ${options.method || 'GET'} ${url}`); const response = await fetch(url, { ...options, headers });