Add full Mullvad JSON URL to manifest, retool fetch request
This commit is contained in:
parent
fbb1a07f4e
commit
f451bff6e7
2 changed files with 10 additions and 19 deletions
|
@ -29,25 +29,16 @@ const backgroundLogic = {
|
|||
},
|
||||
|
||||
async getMullvadInfo() {
|
||||
console.log("getMullvadInfo");
|
||||
const amIMullvadPath = "https://am.i.mullvad.net/json";
|
||||
console.log(`fetching ${amIMullvadPath}`);
|
||||
const response = await fetch("https://am.i.mullvad.net/json", {
|
||||
"credentials": "omit",
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Host": "am.i.mullvad.net",
|
||||
},
|
||||
"method": "GET",
|
||||
"mode": "cors"
|
||||
});
|
||||
// const response = await fetch(amIMullvadPath);
|
||||
console.log(`response: ${response}`);
|
||||
const responseJson = await response.json();
|
||||
console.log(`responseJson: ${responseJson}`);
|
||||
return responseJson;
|
||||
|
||||
// TODO: Add some sort of error catching
|
||||
const mullvadFetchData = await fetch(amIMullvadPath)
|
||||
.then((response) => response.json())
|
||||
.then(data => {
|
||||
return data;
|
||||
});
|
||||
|
||||
return await mullvadFetchData;
|
||||
},
|
||||
|
||||
async getMullvadServers() {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"webRequest",
|
||||
"proxy",
|
||||
|
||||
"https://am.i.mullvad.net/*"
|
||||
"https://am.i.mullvad.net/json"
|
||||
],
|
||||
"optional_permissions": [
|
||||
"bookmarks"
|
||||
|
|
Loading…
Add table
Reference in a new issue