Make media links open in a new tab, removed some logs.
This commit is contained in:
parent
5cfd51fdb6
commit
e388e185ba
4 changed files with 5 additions and 7 deletions
6
app.js
6
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;
|
||||
|
|
|
|||
1
ui.js
1
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);
|
||||
|
|
|
|||
3
utils.js
3
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"));
|
||||
};
|
||||
|
||||
|
|
|
|||
2
waha.js
2
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 });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue