send requests to check for slop on the server

This commit is contained in:
Jack Case
2025-10-20 16:11:18 -04:00
parent a4c6ac4aa7
commit 09247b7cc2
2 changed files with 6 additions and 5 deletions

View File

@@ -8,7 +8,8 @@
"permissions": [
"activeTab",
"storage",
"webNavigation"
"webNavigation",
"*://duckduckgo.com/*"
],
"page_action": {
@@ -31,7 +32,7 @@
"content_scripts": [
{
"matches": ["*://*.duckduckgo.com/*"],
"matches": ["*://duckduckgo.com/*"],
"js": ["scripts/hide-slop.js"]
}
]

View File

@@ -1,4 +1,4 @@
const API_URL = ""
const API_URL = "http://localhost:8000"
function setup_storage_db() {
/* create indexeddb object store to retain objects in the form of
@@ -112,8 +112,8 @@ async function check_local_slop(url) {
}
async function check_remote_slop(urls) {
const check_url = new URL("check", API_URL)
const request = new Request(check_url, {method: "POST", body: JSON.stringify({slop_urls: urls})})
const check_url = new URL("/check", API_URL)
const request = new Request(check_url, {method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({slop_urls: urls})})
const response = await fetch(request)
let domain_objects = await response.json()
domain_objects.foreach((domain) => {insert_slop(domain, "/")})