From 4a60edef4eb49266b9c41622251af73aae521464 Mon Sep 17 00:00:00 2001 From: Colon <56617416+GDColon@users.noreply.github.com> Date: Thu, 14 Oct 2021 09:57:19 -0400 Subject: [PATCH] Fixed demon leaderboard page stadust forgot a key feature in v2 of pointercrate's api and is apparently too busy to fix it. two requests it is :pensive: --- html/demon.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/html/demon.html b/html/demon.html index df26d1c..3ac864a 100644 --- a/html/demon.html +++ b/html/demon.html @@ -94,7 +94,11 @@ else $('#pageUp').hide() Fetch(`../api/gdps?current=1`).then(server => { if (illegal || !server.demonList) return $('#loading').hide(); -fetch(`${server.demonList}api/v1/demons/${demonID}/`).then(res => res.json()).then(demonRes => { +fetch(`${server.demonList}api/v2/demons/listed?after=${demonID-1}&before=${demonID+1}`).then(res => res.json()).then(rawDemon => { + + // two requests because stadust is h + if (rawDemon && rawDemon[0]) fetch(`${server.demonList}api/v2/demons/${rawDemon[0].id}`).then(res => res.json()).then(demonRes => { + let demon = demonRes.data if (!demon.id) window.location.href = "../../../" @@ -134,6 +138,7 @@ fetch(`${server.demonList}api/v1/demons/${demonID}/`).then(res => res.json()).th $('#loading').hide(); }).catch(e => $('#loading').hide()) +}).catch(e => $('#loading').hide()) })