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() {
|
async getMullvadInfo() {
|
||||||
console.log("getMullvadInfo");
|
|
||||||
const amIMullvadPath = "https://am.i.mullvad.net/json";
|
const amIMullvadPath = "https://am.i.mullvad.net/json";
|
||||||
console.log(`fetching ${amIMullvadPath}`);
|
|
||||||
const response = await fetch("https://am.i.mullvad.net/json", {
|
// TODO: Add some sort of error catching
|
||||||
"credentials": "omit",
|
const mullvadFetchData = await fetch(amIMullvadPath)
|
||||||
"headers": {
|
.then((response) => response.json())
|
||||||
"Accept": "application/json",
|
.then(data => {
|
||||||
"Accept-Encoding": "gzip, deflate, br",
|
return data;
|
||||||
"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}`);
|
return await mullvadFetchData;
|
||||||
const responseJson = await response.json();
|
|
||||||
console.log(`responseJson: ${responseJson}`);
|
|
||||||
return responseJson;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getMullvadServers() {
|
async getMullvadServers() {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"proxy",
|
"proxy",
|
||||||
|
|
||||||
"https://am.i.mullvad.net/*"
|
"https://am.i.mullvad.net/json"
|
||||||
],
|
],
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"bookmarks"
|
"bookmarks"
|
||||||
|
|
Loading…
Add table
Reference in a new issue