Skip to content

Commit fadcdc2

Browse files
authored
Fixed Bug and performance improvement
1 parent 1f80117 commit fadcdc2

File tree

11 files changed

+11106
-33
lines changed

11 files changed

+11106
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// background.js
2+
3+
chrome.runtime.onInstalled.addListener(() => {
4+
console.log("Extension installed and background script running.");
5+
const manifest = chrome.runtime.getManifest();
6+
const serverUrl = manifest.SERVER_URL; // Access your custom field
7+
console.log('Server URL:', serverUrl); // Outputs: https://example.com/api
8+
9+
// Store the value using chrome.storage API if needed
10+
chrome.storage.local.set({ serverUrl });
11+
});
12+
13+
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
14+
if (message.action === "open_popup") {
15+
chrome.action.setPopup({popup: "popup.html"}, () => {
16+
chrome.action.openPopup();
17+
});
18+
}
19+
});
20+
/*
21+
22+
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
23+
if (changeInfo.status === 'complete' && tab.url.includes("*://web.whatsapp.com/*")) {
24+
chrome.scripting.executeScript(
25+
{
26+
target: {tabId: tab.id},
27+
files: ['websocket.js'],
28+
// function: () => {}, // files or function, both do not work.
29+
});
30+
}
31+
});
32+
33+
// Load the server URL if present
34+
chrome.storage.local.get(['serverUrl'], (result) => {
35+
if (result.serverUrl) {
36+
document.getElementById('serverUrl').value = result.serverUrl;
37+
}
38+
});
39+
40+
*/

0 commit comments

Comments
 (0)