Skip to content

Commit

Permalink
Fixed Bug and performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
rizwansoaib authored Nov 3, 2024
1 parent 1f80117 commit fadcdc2
Show file tree
Hide file tree
Showing 11 changed files with 11,106 additions and 33 deletions.
40 changes: 40 additions & 0 deletions Chrome-Extension/WhatsApp Monitor/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// background.js

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

// Store the value using chrome.storage API if needed
chrome.storage.local.set({ serverUrl });
});

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;
}
});
*/
Loading

0 comments on commit fadcdc2

Please sign in to comment.