From c4b807906968269f6be4bd9994b3302389b7949c Mon Sep 17 00:00:00 2001 From: RIZWAN AHMAD Date: Sun, 10 Nov 2024 12:31:22 +0530 Subject: [PATCH] #216 #145 v3.3 Fixed bug and improvements --- .../WhatsApp Monitor/background.js | 72 +++++----- .../images/icons/csv_download.jpg | Bin 9117 -> 1362 bytes .../WhatsApp Monitor/inject_wp.js | 15 ++- .../WhatsApp Monitor/js/server.js | 2 +- Chrome-Extension/WhatsApp Monitor/main.js | 2 +- .../WhatsApp Monitor/manifest.json | 8 +- Chrome-Extension/WhatsApp Monitor/online.js | 126 +++++++++++++----- Chrome-Extension/WhatsApp Monitor/popup.html | 77 +---------- Chrome-Extension/WhatsApp Monitor/popup.js | 8 +- Chrome-Extension/WhatsApp Monitor/protobuf.js | 19 ++- Chrome-Extension/WhatsApp Monitor/wapi.js | 30 +++-- .../WhatsApp Monitor/websocket.js | 11 +- 12 files changed, 188 insertions(+), 182 deletions(-) diff --git a/Chrome-Extension/WhatsApp Monitor/background.js b/Chrome-Extension/WhatsApp Monitor/background.js index 60aea32..08b6f3e 100644 --- a/Chrome-Extension/WhatsApp Monitor/background.js +++ b/Chrome-Extension/WhatsApp Monitor/background.js @@ -1,40 +1,44 @@ - // background.js +// background.js +chrome.runtime.onInstalled.addListener(() => { - chrome.runtime.onInstalled.addListener(() => { - console.log("Extension installed and background script running."); - const manifest = chrome.runtime.getManifest(); - const serverUrl = manifest.SERVER_URL; // Access your custom field - console.log('Server URL:', serverUrl); // Outputs: https://example.com/api + chrome.tabs.create({ url: 'https://github.com/rizwansoaib/whatsapp-monitor/tree/master' }); - // Store the value using chrome.storage API if needed - chrome.storage.local.set({ serverUrl }); + chrome.notifications.create('notificationId', { + type: 'basic', + iconUrl: 'images/icons/128.png', + title: 'TrackWapp Notification', + message: 'Notification are Enabled and Working', + priority: 2 }); +}); - chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { - if (message.action === "open_popup") { - chrome.action.setPopup({popup: "popup.html"}, () => { - chrome.action.openPopup(); - }); - } - }); - /* - - chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { - if (changeInfo.status === 'complete' && tab.url.includes("*://web.whatsapp.com/*")) { - chrome.scripting.executeScript( - { - target: {tabId: tab.id}, - files: ['websocket.js'], - // function: () => {}, // files or function, both do not work. - }); - } - }); - // Load the server URL if present - chrome.storage.local.get(['serverUrl'], (result) => { - if (result.serverUrl) { - document.getElementById('serverUrl').value = result.serverUrl; - } - }); +chrome.power.requestKeepAwake('system'); +chrome.power.requestKeepAwake('display'); + + +chrome.runtime.setUninstallURL('https://htmlpreview.github.io/?https://github.com/rizwansoaib/whatsapp-monitor/blob/master/Chrome-Extension/uninstall.html'); + +chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.action === "open_popup") { + chrome.action.setPopup({popup: "popup.html"}, () => { + chrome.action.openPopup(); + }); + } else if (message.action === 'showNotification') { + + + chrome.notifications.create('notificationId', { + type: 'basic', + iconUrl: 'images/icons/128.png', + title: 'TrackWapp Notification', + message: `📱${message.user} is Online in WhatsApp`, + priority: 2 + }); + + // Automatically delete the notification after 30 seconds + setTimeout(() => { + chrome.notifications.clear('notificationId'); + }, 10000); - */ \ No newline at end of file + } +}); diff --git a/Chrome-Extension/WhatsApp Monitor/images/icons/csv_download.jpg b/Chrome-Extension/WhatsApp Monitor/images/icons/csv_download.jpg index e6dca6429be6e29b04a0e45c1b22fa91208c7d50..0fc078e7adbd7779297c543b4c6314e6e1dfdfba 100644 GIT binary patch delta 1217 zcmV;y1U~znN74$A6_Hhse?S000|6oc0uccN5dr_i02}}S0R;g80RR910000000007 z00IL91_c2K|HJ?}5C8!J0|N*M1p@^D00000009C600a>Q1`-DoAtEtBQDGDn7gceT zvC&g+ zuU@0nAR7UulM}l$e;sTDAoibZd}RFu!tFlU_{sVSf%bA1aw*4G;prbbXCr@-$JhNr(gKbW97!Co*VG8Qg?fole*$g^wz5dl;TT&zo|!m?i6Jy9RX7OSWqnv}=RRit0EA&IX~aufN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0-3mj5!+V9Vp{f~cPt!%{xQ}w&`*FTGtZ&4IlqBq3E(~uE zDe*pawg5Eyr1YA#B(^)MXa!|hMdbf%vF@L_#(o;D@OVxMaI z2f|>djvMRLDs;XoZskE)iqSCWXRP{Ge8Z>r*U$De?ZVJryG5MsN0$ j1XTsfjW(me`uFeVcazpRaf { + chrome.scripting.executeScript( + { + target: {tabId: tab.id}, + files: ['websocket.js'], + // function: () => {}, // files or function, both do not work. + }) +}) + + +chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => { + chrome.scripting.executeScript( + { + target: {tabId: tab.id}, + files: ['protobuf.js'], + // function: () => {}, // files or function, both do not work. + }) +}) + + + + +chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => { + chrome.scripting.executeScript( + { + target: {tabId: tab.id}, + files: ['main.js'], + // function: () => {}, // files or function, both do not work. + }) +}) +} + +//setTimeout(run_script_delay,20000); @@ -334,40 +424,10 @@ chrome.storage.sync.get('numarray', function (data) { -/* -chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => { - chrome.scripting.executeScript( - { - target: {tabId: tab.id}, - files: ['websocket.js'], - // function: () => {}, // files or function, both do not work. - }) -}) - - -chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => { - chrome.scripting.executeScript( - { - target: {tabId: tab.id}, - files: ['protobuf.js'], - // function: () => {}, // files or function, both do not work. - }) -}) - - -chrome.tabs.query({active: true, currentWindow: true}).then(([tab]) => { - chrome.scripting.executeScript( - { - target: {tabId: tab.id}, - files: ['main.js'], - // function: () => {}, // files or function, both do not work. - }) -}) - */ diff --git a/Chrome-Extension/WhatsApp Monitor/popup.html b/Chrome-Extension/WhatsApp Monitor/popup.html index c0be597..e1a7227 100644 --- a/Chrome-Extension/WhatsApp Monitor/popup.html +++ b/Chrome-Extension/WhatsApp Monitor/popup.html @@ -2,78 +2,7 @@ - Online Monitor @@ -110,7 +39,7 @@ - +

Please Open Chat on WhatsApp Web at least once to start monitoring

@@ -193,7 +122,7 @@

-
+


@@ -239,7 +168,7 @@

diff --git a/Chrome-Extension/WhatsApp Monitor/popup.js b/Chrome-Extension/WhatsApp Monitor/popup.js index 34a5113..cdfd72f 100644 --- a/Chrome-Extension/WhatsApp Monitor/popup.js +++ b/Chrome-Extension/WhatsApp Monitor/popup.js @@ -48,10 +48,10 @@ update_numarrray(); function start(mnkey,save_interval) { - b.innerText='Cancel'; + //b.innerText='Cancel'; //console.log(b.innerText); - b.className="btn-danger"; + //b.className="btn-danger"; //alert("stop set"); @@ -201,8 +201,8 @@ function get() //alert(b.innerText); console.log("nkey val popup.js",mnkey); - if(b.innerText=='OK'){start(mnkey,save_interval);} - else{stop();b.innerText='OK';b.className="btn-success";} + if(b.innerText=='save'){start(mnkey,save_interval);} + else{stop();b.innerText='save';b.className="btn-success";} } diff --git a/Chrome-Extension/WhatsApp Monitor/protobuf.js b/Chrome-Extension/WhatsApp Monitor/protobuf.js index 2ae3e2a..1d088b6 100644 --- a/Chrome-Extension/WhatsApp Monitor/protobuf.js +++ b/Chrome-Extension/WhatsApp Monitor/protobuf.js @@ -1,22 +1,19 @@ -var os = document.createElement('script'); - //s.src = chrome.extension.getURL('pagescript.js'); - os.src = chrome.runtime.getURL('inject_wp.js'); - /* -window.onload = function() { - setTimeout(function() { - os.src = chrome.runtime.getURL('inject_wp.js'); - }, 10000); // 10000 milliseconds = 10 seconds -}; -*/ +setTimeout(function(){ + var os = document.createElement('script'); + + os.src = chrome.runtime.getURL('inject_wp.js'); (document.head || document.documentElement).appendChild(os); + console.log("Protobuf connecting"); + +},20000); -console.log("Protobuf connecting") + diff --git a/Chrome-Extension/WhatsApp Monitor/wapi.js b/Chrome-Extension/WhatsApp Monitor/wapi.js index 99d0c6f..bfcf107 100644 --- a/Chrome-Extension/WhatsApp Monitor/wapi.js +++ b/Chrome-Extension/WhatsApp Monitor/wapi.js @@ -1,5 +1,5 @@ //Version_JS;Version_TInjectMin;Version_CEF4Min; -//3.0.1.0;1.0.0.9;78.3.0 +//3.0.2.0;1.0.0.9;78.3.0 function getAllGroupContacts(Contacts) { SetConsoleMessage("GetAllGroupContacts", JSON.stringify(Contacts)); @@ -157,7 +157,7 @@ const newMakeStore = () => { { id: "State", conditions: (module) => (module.STATE && module.STREAM) ? module : null }, { id: "_Presence", conditions: (module) => (module.setPresenceAvailable && module.setPresenceUnavailable) ? module : null }, { id: "WapDelete", conditions: (module) => (module.sendConversationDelete && module.sendConversationDelete.length == 2) ? module : null }, - { id: 'FindChat', conditions: (module) => (module && module.findChat) ? module : null}, + { id: 'FindChat', conditions: (module) => (module && module.findOrCreateLatestChat) ? module : null}, { id: "WapQuery", conditions: (module) => (module.queryExist) ? module : ((module.default && module.default.queryExist) ? module.default : null) },//Mike 28/10/2022 { id: "WapQueryMD", conditions: (module) => (module.queryExists && module.queryPhoneExists) || (module.queryWidExists && module.queryPhoneExists) ? module : null}, //MD Mike 09/11/2021 { id: 'Perfil', conditions: (module) => module.__esModule === true && module.setPushname && !module.getComposeContents ? module : null}, @@ -304,7 +304,7 @@ const oldMakeStore = () => { { id: "State", conditions: (module) => (module.STATE && module.STREAM) ? module : null }, { id: "_Presence", conditions: (module) => (module.setPresenceAvailable && module.setPresenceUnavailable) ? module : null }, { id: "WapDelete", conditions: (module) => (module.sendConversationDelete && module.sendConversationDelete.length == 2) ? module : null }, - { id: 'FindChat', conditions: (module) => (module && module.findChat) ? module : null}, + { id: 'FindChat', conditions: (module) => (module && module.findOrCreateLatestChat) ? module : null}, { id: "WapQuery", conditions: (module) => (module.queryExist) ? module : ((module.default && module.default.queryExist) ? module.default : null) },//Mike 28/10/2022 { id: "WapQueryMD", conditions: (module) => (module.queryExists && module.queryPhoneExists) || (module.queryWidExists && module.queryPhoneExists) ? module : null}, //MD Mike 09/11/2021 { id: 'Perfil', conditions: (module) => module.__esModule === true && module.setPushname && !module.getComposeContents ? module : null}, @@ -451,14 +451,20 @@ const oldMakeStore = () => { const chooseFunction = () => { - versionString = (Debug || {}).VERSION; + versionString = (Debug || {}).VERSION; versionNumber = parseFloat(versionString); comparisonNumber = 2.3; return (versionNumber >= comparisonNumber) ? newMakeStore() : oldMakeStore() } + + + chooseFunction(); - + + + + window.WAPI = {}; window._WAPI = {}; @@ -844,7 +850,7 @@ window.WAPI.getChat = function (id) { } window.WAPI.getChatByName = function(name, done) { - const found = window.Store.FindChat.findChat((chat) => chat.name === name); + const found = window.Store.FindChat.findOrCreateLatestChat((chat) => chat.name === name); if (done !== undefined) done(found); return found; }; @@ -906,7 +912,7 @@ window.WAPI.sendLinkWithAutoPreview = async function (chatId, url, text) { const linkPreview = await Store.WapQuery.queryLinkPreview(url) let queue = await Store.Contact.get(chatId); - const contact = await Store.FindChat.findChat(idUser) + const contact = await Store.FindChat.findOrCreateLatestChat(idUser) const newChat = await Object.assign(queue, contact); @@ -1780,7 +1786,7 @@ window.WAPI.sendImage = function(imgBase64, chatid, filename, caption) { }); - return Store.FindChat.findChat(idUser).then((chat) => { + return Store.FindChat.findOrCreateLatestChat(idUser).then((chat) => { var mediaBlob = window.WAPI.base64ImageToFile(imgBase64, filename); var mc = new Store.MediaCollection(chat); @@ -1801,7 +1807,7 @@ window.WAPI.sendMessageToID = function(chatid, msgText) { console.log(idUser) - const teste = Store.FindChat.findChat(idUser) + const teste = Store.FindChat.findOrCreateLatestChat(idUser) .then(chatid => { console.log(teste) var mc = new Store.SendTextMsgToChat(chatid, msgText); @@ -1927,7 +1933,7 @@ window.WAPI.sendVCard = async function (chatId, contactNumber, contactName) { let queue = Store.Chat.get(chatId) - const chat = await Store.FindChat.findChat(idUser) + const chat = await Store.FindChat.findOrCreateLatestChat(idUser) const newchat = Object.assign(chat, queue); @@ -2058,7 +2064,7 @@ window.WAPI.sendMessageToID2 = function(id, msgText) { window.Store.WapQuery.queryExist(id).then(function(e) { if (e.status === 200) { - window.Store.FindChat.findChat(e.jid).then((chat) => { + window.Store.FindChat.findOrCreateLatestChat(e.jid).then((chat) => { try { window.Store.SendTextMsgToChat(chat, msgText); return true; @@ -2300,7 +2306,7 @@ window.WAPI.sendMessageOptions = async function (chatId, content, options = {}) let queue = Store.Chat.get(chatId) - const newChat = await Store.FindChat.findChat(idUser) + const newChat = await Store.FindChat.findOrCreateLatestChat(idUser) const chat = Object.assign(newChat, queue); diff --git a/Chrome-Extension/WhatsApp Monitor/websocket.js b/Chrome-Extension/WhatsApp Monitor/websocket.js index b70e568..e0b3ad6 100644 --- a/Chrome-Extension/WhatsApp Monitor/websocket.js +++ b/Chrome-Extension/WhatsApp Monitor/websocket.js @@ -1,26 +1,29 @@ - if(document.head != null) { + + + setTimeout(function(){if(document.head != null) { //clearInterval(clear) var s = document.createElement('script'); s.src = chrome.runtime.getURL('wapi.js'); - + s.onload = function() { //this.remove(); }; (document.head || document.documentElement).appendChild(s); - } + console.log("websockets started"); + }},20000); + -console.log("websockets started")