PageSourceSearch

https://www.mgp.fr/sw.js

js mgp.fr collected 2026-10-05 19:07:33 UTC 1,053 bytes, 32 lines download raw bytes

1let token = '';
2
3self.addEventListener('install', function(event) {
4    event.waitUntil(self.skipWaiting()); // Activate worker immediately
5});
6
7self.addEventListener('activate', function(event) {
8    event.waitUntil(self.clients.claim()); // Become available to all pages
9});
10
11self.addEventListener('message', (event) => {
12    if(event.data.token) {
13        token=event.data.token;
14    }
15});
16
17self.addEventListener('fetch', event => {
18    if(event.request.url.endsWith(".do") && token != '') {
19        if(!event.request.headers.has('CSRFTOKEN')) {
20            const newHeader = new Headers();
21            for (const [header, value] of event.request.headers) {
22                newHeader.append(header, value);
23            }
24            newHeader.append('CSRFTOKEN', token);
25            newHeader.append('X-Requested-With', 'XMLHttpRequest');
26            let newRequest = new Request(event.request, {
27                headers: newHeader
28            });
29            event.respondWith(fetch(newRequest));
30        }
31    }
32});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.