diff --git a/api/analyze.js b/api/analyze.js index 57d3d70..a51d009 100644 --- a/api/analyze.js +++ b/api/analyze.js @@ -16,7 +16,7 @@ module.exports = async (app, req, res, level) => { return res.send(response_data); } else { zlib.unzip(levelString, (err, buffer) => { - if (err) { return res.send("-1"); } + if (err) { return res.send("-2"); } const raw_data = buffer.toString(); const response_data = analyze_level(level, raw_data); diff --git a/api/download.js b/api/download.js index dd6a3b2..f60c89f 100644 --- a/api/download.js +++ b/api/download.js @@ -18,8 +18,9 @@ module.exports = async (app, req, res, api, ID, analyze) => { req.gdRequest('downloadGJLevel22', { levelID }, function (err, resp, body) { if (err || !body || body == '-1' || body.startsWith("<")) { - if (!api && levelID < 0) return res.redirect(`/?daily=${levelID * -1}`) - if (!api) return res.redirect('search/' + req.params.id) + if (api && analyze) return res.send("-3") + else if (!api && levelID < 0) return res.redirect(`/?daily=${levelID * -1}`) + else if (!api) return res.redirect('search/' + req.params.id) else return res.send("-1") } diff --git a/api/level.js b/api/level.js index 62d960e..23ac442 100644 --- a/api/level.js +++ b/api/level.js @@ -32,7 +32,7 @@ module.exports = async (app, req, res, api, analyze) => { let song = '~' + body.split('#')[2]; song = app.parseResponse(song, '~|~') - let levelInfo = app.parseResponse(preRes[0]) + let levelInfo = app.parseResponse(preRes.find(x => x.startsWith(`1:${levelID}`)) || preRes[0]) let level = new Level(levelInfo, req.server, false, author).getSongInfo(song) if (req.isGDPS) level.gdps = (req.onePointNine ? "1.9/" : "") + req.endpoint diff --git a/api/search.js b/api/search.js index cb3610a..f8b755f 100644 --- a/api/search.js +++ b/api/search.js @@ -108,7 +108,7 @@ module.exports = async (app, req, res) => { let arr = x.split(':') authorList[arr[0]] = [arr[1], arr[2]]}) - let levelArray = preRes.map(x => app.parseResponse(x)).filter(x => x[2]) + let levelArray = preRes.map(x => app.parseResponse(x)).filter(x => x[1]) let parsedLevels = [] levelArray.forEach((x, y) => { diff --git a/assets/btn-back.png b/assets/btn-back.png new file mode 100644 index 0000000..e8a825d Binary files /dev/null and b/assets/btn-back.png differ diff --git a/assets/discord.png b/assets/discord.png new file mode 100644 index 0000000..d771f19 Binary files /dev/null and b/assets/discord.png differ diff --git a/assets/gdps/silvrps_icon.png b/assets/gdps/silvrps_icon.png new file mode 100644 index 0000000..fe267dd Binary files /dev/null and b/assets/gdps/silvrps_icon.png differ diff --git a/assets/gdps/silvrps_logo.png b/assets/gdps/silvrps_logo.png new file mode 100644 index 0000000..3f94331 Binary files /dev/null and b/assets/gdps/silvrps_logo.png differ diff --git a/classes/Level.js b/classes/Level.js index b2597f1..48fd4bc 100644 --- a/classes/Level.js +++ b/classes/Level.js @@ -8,7 +8,7 @@ let demonTypes = { 3: "Easy", 4: "Medium", 5: "Insane", 6: "Extreme" } class Level { constructor(levelInfo, server, download, author = []) { - if (!levelInfo[2]) return; + if (!levelInfo[1]) return; this.name = levelInfo[2]; this.id = levelInfo[1]; this.description = Buffer.from((levelInfo[3] || ""), "base64").toString() || "(No description provided)"; @@ -37,11 +37,11 @@ class Level { this.customSong = +levelInfo[35] || 0 this.coins = +levelInfo[37] this.verifiedCoins = levelInfo[38] > 0 - this.starsRequested = +levelInfo[39] + this.starsRequested = +levelInfo[39] || 0 this.ldm = levelInfo[40] > 0 if (+levelInfo[41] > 100000) this.weekly = true if (+levelInfo[41]) { this.dailyNumber = (+levelInfo[41] > 100000 ? +levelInfo[41] - 100000 : +levelInfo[41]); this.nextDaily = null; this.nextDailyTimestamp = null } - this.objects = +levelInfo[45] + this.objects = +levelInfo[45] || 0 this.large = levelInfo[45] > 40000; this.cp = Number((this.stars > 0) + this.featured + this.epic) diff --git a/html/analyze.html b/html/analyze.html index 920e577..c2cf54a 100644 --- a/html/analyze.html +++ b/html/analyze.html @@ -15,9 +15,17 @@