-
Notifications
You must be signed in to change notification settings - Fork 1
/
background.js
29 lines (27 loc) · 1.18 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
let locations = [{ code: "FR/NAN" }]
/*
fetch('https://intra.epitech.eu/user/filter/location?format=json').then(r => r.text()).then(result => {
locations = JSON.parse(result)
console.log(locations)
})
*/
var browser = browser || chrome
browser.webRequest.onBeforeRequest.addListener(
function (request) {
const url = new URL(request.url);
if (request.method === "GET" && url.pathname.includes("/user/filter/user")) {
url.searchParams.set('nolimit', true)
return { redirectUrl: url.toString() };
}
if (request.method === "GET" && url.pathname.includes("/ressources/userpicture//file/userprofil/icon/")) {
url.pathname = url.pathname.replace('/ressources/userpicture/', '');
return { redirectUrl: url.toString() };
}
if (request.method === "GET" && url.pathname.startsWith("/planning/load")) {
url.searchParams.set("location", locations.map((l) => l.code).join('|'));
return { redirectUrl: url.toString() };
}
return { cancel: false };
},
{ urls: ["*://intra.epitech.eu/*"], types: ["xmlhttprequest", "script", "main_frame", "image"] },
["blocking"]);