Skip to content

Commit

Permalink
fixes + basic script start
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon1320 committed Nov 3, 2018
1 parent 3b52bc9 commit 567bd37
Show file tree
Hide file tree
Showing 6 changed files with 354 additions and 47 deletions.
7 changes: 5 additions & 2 deletions src/web/routes/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ const defaultValue = (param, def) => {

router.route("/").get(authUser, (req, res) => {

// + cond discord data
const extended = req.query.extended === "true" ? true : req.query.extended === "false" ? false : undefined;

const current = req.query.extended === "true" ? true : req.query.extended === "false" ? false : false;

const sort_dir = req.query.reversed === "true" ? 1 : req.query.reversed === "false" ? -1 : -1;
const sort = {
...( req.query.order === undefined ? {} : { [req.query.order]: sort_dir } )
...( req.query.order === undefined ? { [req.query.order]: -1 } : { [req.query.order]: sort_dir } )
}

// Parse the amount of scripts that the api will return.
Expand Down Expand Up @@ -129,7 +132,7 @@ router.route("/@me").get(authUser, (req, res) => {

apiLogger.error(error);
return res.json({ status: 500 });
})
});
});

router.route("/:discord_id").get(authUser, (req, res) => {
Expand Down
11 changes: 9 additions & 2 deletions src/web/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,16 @@ router.get("/api/v3/stats", async (req, res) => {
// latest update
cachedStats.stats.latest_update = "latest update text";

await Promise.all(promises);
await Promise.all(promises).then(() => {

cachedStats.expire = Date.now() + statsCacheTime;
cachedStats.expire = Date.now() + statsCacheTime;
}).catch(error => {

apiLogger.error(error);

cachedStats.stats = { error };
cachedStats.expire = Date.now();
});
}

return res.json({ stats: cachedStats.stats });
Expand Down
16 changes: 8 additions & 8 deletions src/web/routes/json/credits.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "168690518899949569",
"name": "Dragon1320",
"role": "BACKEND_DEV",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/462725985356218368/Gai2.png",
"caption": "i want to die",
"image": "https://media.discordapp.net/attachments/379432139856412682/508019608704253963/321866.png",
"caption": "Javascript sucks dick, and so do I.",
"socials": [{
"fa": "github",
"ic": "git",
Expand All @@ -27,7 +27,7 @@
"name": "Mattheous",
"role": "FRONTEND_DEV",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/462726578783256578/yaboi.jpg",
"caption": "i want to die",
"caption": "< yeah but who is the dom?",
"socials": [{
"fa": "github",
"ic": "git",
Expand Down Expand Up @@ -97,7 +97,7 @@
"id": "281033556833206272",
"name": "Phinbella Flynn",
"role": "AWESOMO_PORTRAIT",
"image": "https://pbs.twimg.com/profile_images/1030449167745859584/AHFSCVai.jpg",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/508019347818545154/5beb2f328d115e775301df5f09f80d5d.png",
"caption": "Hey! My name is Phinbella Flynn but for short you can just call me Phin",
"socials": [{
"fa": "deviantart",
Expand Down Expand Up @@ -237,7 +237,7 @@
"id": "281033556833206272",
"name": "Phinbella Flynn",
"role": "POLISH_TRANSLATION",
"image": "https://pbs.twimg.com/profile_images/1030449167745859584/AHFSCVai.jpg",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/508019347818545154/5beb2f328d115e775301df5f09f80d5d.png",
"caption": "Cze艣膰! Nazywam si臋 Phinbella Flynn ale w skr贸cie mo偶ecie m贸wi膰 na mnie po prostu Phin",
"socials": [{
"fa": "deviantart",
Expand Down Expand Up @@ -283,7 +283,7 @@
"id": "161573813379792899",
"name": "Kamui",
"role": "GERMAN_TRANSLATION",
"image": "https://pbs.twimg.com/profile_images/1031746391134162945/kib2YvoZ.jpg",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/508019481642270740/a_ecc5cdc51043b5b3810c923e8075411e.gif",
"caption": "50% Homosexuell, 200% fabelhaft, stumm aber s眉脽",
"socials": [{
"fa": "twitter",
Expand All @@ -306,8 +306,8 @@
"id": "190914446774763520",
"name": "Mattheous",
"role": "SPANISH_TRANSLATION",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/462726578783256578/yaboi.jpg",
"caption": "lol i can't speak spanish",
"image": "https://cdn.discordapp.com/attachments/379432139856412682/508018322089181195/unknown.png",
"caption": "3 horas en alcohol y chill y te da este vista",
"socials": [{
"fa": "github",
"ic": "git",
Expand Down
12 changes: 9 additions & 3 deletions src/web/templates/dashboard/leaderboards.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@
</div>
</div>

<div class="view gradient-card-header z-depth-0 mt-4" style="height:60vh">
<canvas id="activitybar"></canvas>
</div>
<!--/Card image-->

<!--Card content-->
Expand Down Expand Up @@ -303,6 +300,15 @@
</script>

<script>
const leaderboard = new XMLHttpRequest();
leaderboard.open("GET", `/api/v3/users?limit=20&order=xp`, false);
leaderboard.send();
const leaderboardahhh = JSON.parse(leaderboard.response);
const leaderboardYay = leaderboardahhh.users;
console.log(leaderboardYay)
const container = document.getElementById("scroll-container");
const row = document.getElementById("rawrxd");
const container2 = document.getElementById("shit-container");
Expand Down

0 comments on commit 567bd37

Please sign in to comment.