report slop to server and check ddg search results

This commit is contained in:
Jack Case
2025-10-21 19:45:11 -04:00
parent e961faec29
commit 8cea8a7785
2 changed files with 20 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ async function get_slop_store(readwrite) {
return await slop_store_promise
}
function insert_slop(domain, path) {
async function insert_slop(domain, path) {
let db
const db_request = window.indexedDB.open("SlopDB", 1)
@@ -82,6 +82,10 @@ function insert_slop(domain, path) {
}
}
}
const report_url = new URL("/report", API_URL)
const request = new Request(report_url, {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({slop_urls: [new URL(path, "http://"+domain).toString()]})})
fetch(request)
}
async function check_local_slop(url) {
@@ -175,7 +179,7 @@ async function message_listener(message, sender) {
await Promise.all(check_promises)
remote_slop = await check_remote_slop(not_found_local)
let remote_slop = await check_remote_slop(not_found_local)
remote_slop.forEach((result) => {
browser.tabs.sendMessage(tabid, { type: "check_result", url: result.url, result: result })
})