diff options
author | Christian Cleberg <hello@cleberg.net> | 2025-06-04 13:24:22 -0500 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2025-06-04 13:24:22 -0500 |
commit | 8bbac67df8450b021914725a756a029667b8f585 (patch) | |
tree | 1e5f13a29e6a4542fb5976dc74b15db2e89b2a32 /crumb_extension | |
download | crumb-8bbac67df8450b021914725a756a029667b8f585.tar.gz crumb-8bbac67df8450b021914725a756a029667b8f585.tar.bz2 crumb-8bbac67df8450b021914725a756a029667b8f585.zip |
feat: initial commit
Diffstat (limited to 'crumb_extension')
-rw-r--r-- | crumb_extension/background.js | 26 | ||||
-rw-r--r-- | crumb_extension/manifest.json | 10 |
2 files changed, 36 insertions, 0 deletions
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 diff --git a/crumb_extension/manifest.json b/crumb_extension/manifest.json new file mode 100644 index 0000000..1895b57 --- /dev/null +++ b/crumb_extension/manifest.json @@ -0,0 +1,10 @@ +{ + "manifest_version": 3, + "name": "Crumb", + "version": "0.1", + "description": "Local history tracker that sends visit logs to a local server.", + "permissions": ["tabs", "history"], + "background": { + "service_worker": "background.js" + } +}
\ No newline at end of file |