tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

service-worker.js (541B)


      1 self.addEventListener("fetch", async e => {
      2    if (e.request.url.endsWith("ping"))
      3        e.respondWith(new Response('pong'));
      4    else if (e.request.url.endsWith("client")) {
      5        e.respondWith((async () => {
      6            const client = await clients.get(e.clientId);
      7            const clientInfo = client ? {id: e.clientId, visibilityState: client.visibilityState, focused: client.focused} : null;
      8            return new Response(JSON.stringify({clientInfo}), {headers: {'Content-Type': 'application/json'}});
      9        })());
     10    }
     11 });