-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
31 lines (26 loc) · 826 Bytes
/
main.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
30
31
const creds_url = chrome.runtime.getURL('creds.json');
var url;
function construct_url(json) {
url = "https://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=236850&key="
+ json.key
+ "&steamid="
+ json.steamid
+ "&l=english"
}
fetch(creds_url)
.then((response) => response.json())
.then((json) => construct_url(json));
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.contentScriptQuery == "queryAchievements") {
fetch(url)
.then(response => response.json())
.then(json => {
console.log(json)
sendResponse(json)
})
.catch(error => console.error(error))
return true; // Will respond asynchronously.
}
}
);