Adding steam library get

(currently only hard coded user).
This commit is contained in:
Tristan Roux
2019-03-22 23:03:01 +01:00
parent c0f4cb94d7
commit c21bf2dc32
6 changed files with 39 additions and 48 deletions
+2 -1
View File
@@ -27,7 +27,8 @@
"label": "Watch Typescript",
"type": "shell",
"command": "npx webpack --watch",
"group": "build"
"group": "build",
"problemMatcher": []
}
]
}
+1 -1
View File
@@ -1,4 +1,4 @@
<div class="container">
<p>Steam</p>
<button onClick="steamLogIn()">Steam sign in</button>
<button id="steamLogBtn">Steam sign in</button>
</div>
+2 -2
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -26,6 +26,6 @@
</nav>
</header>
<div id="content" >
<div id="content" />
</body>
</html>
+28 -41
View File
@@ -1,3 +1,9 @@
interface SteamResponse
{
game_count: number;
games: Game[];
}
class Game
{
name: string;
@@ -29,47 +35,28 @@ enum launcher
export function populateGrid()
{
var games: Game[] =
[
new Game("La ligue du sel", "", "https://news-a.akamaihd.net/public/images/misc/GameBox.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, ""),
new Game("Overnetoyé", "", "https://images-na.ssl-images-amazon.com/images/I/51kkc%2BjHrGL.jpg", launcher.LocalOnly, "", false, "")
];
let grid = document.getElementById("library");
for(var i = 0; i < games.length; i++)
{
let game = games[i];
let gridHtml = "<img src='" + game.thumbnail + "'/> <p>" + game.name + "</p>";
let element = document.createElement("div");
element.className = "game";
element.onclick = () => { onGameClick(game); }
element.innerHTML = gridHtml;
if(grid != null)
grid.appendChild(element);
}
$.get("https://api.steampowered.com/IPlayerService/GetOwnedGames/v1/" +
"?key=7C218E8D1347C3CD6CB8117E5ED533BC" +
"&steamid=76561198250223174" +
"&include_appinfo=1" +
"&include_played_free_games=1" +
"&appids_filter=", (data) =>
{
let response: SteamResponse = data.response;
let grid = document.getElementById("library");
for (var i = 0; i < response.game_count; i++)
{
let game = response.games[i];
let gridHtml = "<img src='" + game.thumbnail + "'/> <p>" + game.name + "</p>";
let element = document.createElement("div");
element.className = "game";
element.onclick = () => { onGameClick(game); }
element.innerHTML = gridHtml;
if (grid != null)
grid.appendChild(element);
}
});
}
function onGameClick(gameClicked: Game)
+5 -2
View File
@@ -30,11 +30,14 @@ function openSearch()
function openSettings()
{
$("#content").load("dist/html/settings.html");
$("#content").load("dist/html/settings.html", () =>
{
// document.getElementById("steamLogBtn").onclick = () => { steamLogIn(); };
});
document.getElementById("title").innerHTML = "<i class='icon fas fa-arrow-left'></i> Settings";
}
//Log In
//Log In (not necesary, only need to use public methods for now)
// import Oidc, { UserManagerSettings } from "oidc-client";
// var OidcSettings: UserManagerSettings =