From 8bbac67df8450b021914725a756a029667b8f585 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 4 Jun 2025 13:24:22 -0500 Subject: feat: initial commit --- crumb_extension/background.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 crumb_extension/background.js (limited to 'crumb_extension/background.js') diff --git a/crumb_extension/background.js b/crumb_extension/background.js new file mode 100644 index 0000000..c916c95 --- /dev/null +++ b/crumb_extension/background.js @@ -0,0 +1,26 @@ +chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { + if (changeInfo.status !== 'complete' || !tab.url.startsWith("http")) return; + + const url = new URL(tab.url); + + const payload = { + title: tab.title, + url: tab.url, + hostname: url.hostname, + path: url.pathname, + query: url.search, + tabId: tab.id, + windowId: tab.windowId, + favIconUrl: tab.favIconUrl || null + }; + + console.log("Crumb: Sending payload", payload); + + fetch("http://localhost:3555", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(payload) + }).catch(err => { + console.error("Crumb: Failed to reach server", err); + }); +}); \ No newline at end of file -- cgit v1.2.3