Add proof of concept adblocker and continue working on refining the use hook.

This commit is contained in:
wearrrrr 2024-06-17 14:30:36 -05:00
parent 6f4f234c82
commit b9f64617dd
5 changed files with 176 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

View file

@ -1 +0,0 @@
console.log("Hello World!");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5,19 +5,16 @@ importScripts("/uv/uv.bundle.js");
importScripts("/uv.config.js");
importScripts(__uv$config.sw);
importScripts("./workerware/workerware.js");
importScripts("./marketplace/adblock/index.js")
const ww = new WorkerWare({
debug: true,
});
function logContext(event) {
console.log("Event:", event);
return undefined;
}
ww.use({
function: logContext,
function: self.adblockExt.filterRequest,
events: ["fetch"],
name: "Adblock"
});
const uv = new UVServiceWorker();
@ -25,7 +22,6 @@ const uv = new UVServiceWorker();
self.addEventListener("fetch", async (event) => {
let mwResponse = await ww.run(event)();
if (mwResponse.includes(null)) {
console.log("Aborting Request!");
return;
}
event.respondWith(