diff --git a/api/analyze.js b/api/analyze.js index 5be9fe3..1b97b25 100644 --- a/api/analyze.js +++ b/api/analyze.js @@ -21,14 +21,14 @@ module.exports = async (app, req, res, level) => { const raw_data = level.data; const response_data = analyze_level(level, raw_data); - return res.status(200).send(response_data); + return res.send(response_data); } else { zlib.unzip(levelString, (err, buffer) => { if (err) { return res.status(500).send("-2"); } const raw_data = buffer.toString(); const response_data = analyze_level(level, raw_data); - return res.status(200).send(response_data); + return res.send(response_data); }); } } diff --git a/api/comments.js b/api/comments.js index 0569a2f..f48f6e1 100644 --- a/api/comments.js +++ b/api/comments.js @@ -76,7 +76,7 @@ module.exports = async (app, req, res) => { }) - return res.status(200).send(commentArray) + return res.send(commentArray) }) } \ No newline at end of file diff --git a/api/download.js b/api/download.js index 0b4fa11..0c577a2 100644 --- a/api/download.js +++ b/api/download.js @@ -69,7 +69,7 @@ module.exports = async (app, req, res, api, ID, analyze) => { if (analyze) return app.run.analyze(app, req, res, level) function sendLevel() { - if (api) return res.status(200).send(level) + if (api) return res.send(level) else return fs.readFile('./html/level.html', 'utf8', function (err, data) { let html = data; @@ -78,7 +78,7 @@ module.exports = async (app, req, res, api, ID, analyze) => { let regex = new RegExp(`\\[\\[${x.toUpperCase()}\\]\\]`, "g") html = html.replace(regex, app.clean(level[x])) }) - return res.status(200).send(html) + return res.send(html) }) } diff --git a/api/gauntlets.js b/api/gauntlets.js index bd48ba4..d0661f3 100644 --- a/api/gauntlets.js +++ b/api/gauntlets.js @@ -6,7 +6,7 @@ module.exports = async (app, req, res) => { if (req.offline) return res.sendError() let cached = cache[req.id] - if (app.config.cacheGauntlets && cached && cached.data && cached.indexed + 2000000 > Date.now()) return res.status(200).send(cached.data) // half hour cache + if (app.config.cacheGauntlets && cached && cached.data && cached.indexed + 2000000 > Date.now()) return res.send(cached.data) // half hour cache req.gdRequest('getGJGauntlets21', {}, function (err, resp, body) { @@ -15,7 +15,7 @@ module.exports = async (app, req, res) => { let gauntletList = gauntlets.map(x => ({ id: +x[1], name: gauntletNames[+x[1] - 1] || "Unknown", levels: x[3].split(",") })) if (app.config.cacheGauntlets) cache[req.id] = {data: gauntletList, indexed: Date.now()} - res.status(200).send(gauntletList) + res.send(gauntletList) }) diff --git a/api/leaderboards/accurate.js b/api/leaderboards/accurate.js index 5cce0e6..cfea414 100644 --- a/api/leaderboards/accurate.js +++ b/api/leaderboards/accurate.js @@ -19,7 +19,7 @@ module.exports = async (app, req, res, post) => { let type = req.query.type ? req.query.type.toLowerCase() : 'stars' if (type == "usercoins") type = "coins" if (!indexes.includes(type)) type = "stars" - if (lastIndex[modMode ? 1 : 0][type] + 600000 > Date.now() && cache[type]) return res.status(200).send(gdMode ? cache[type] : JSON.parse(cache[type])) // 10 min cache + if (lastIndex[modMode ? 1 : 0][type] + 600000 > Date.now() && cache[type]) return res.send(gdMode ? cache[type] : JSON.parse(cache[type])) // 10 min cache sheet.useApiKey(app.sheetsKey) sheet.loadInfo().then(async () => { @@ -41,7 +41,7 @@ module.exports = async (app, req, res, post) => { caches[modMode ? 1 : 0][type] = JSON.stringify(leaderboard) caches[2][type] = gdFormatting lastIndex[modMode ? 1 : 0][type] = Date.now() - return res.status(200).send(gdMode ? gdFormatting : leaderboard) + return res.send(gdMode ? gdFormatting : leaderboard) }) } \ No newline at end of file diff --git a/api/leaderboards/boomlings.js b/api/leaderboards/boomlings.js index 5715e2a..cb0e182 100644 --- a/api/leaderboards/boomlings.js +++ b/api/leaderboards/boomlings.js @@ -37,7 +37,7 @@ module.exports = async (app, req, res) => { users.push(user) }) - return res.status(200).send(users) + return res.send(users) }) } \ No newline at end of file diff --git a/api/leaderboards/leaderboardLevel.js b/api/leaderboards/leaderboardLevel.js index 39f7915..e3b1471 100644 --- a/api/leaderboards/leaderboardLevel.js +++ b/api/leaderboards/leaderboardLevel.js @@ -47,7 +47,7 @@ module.exports = async (app, req, res) => { app.userCache(req.id, x.accountID, x.playerID, x.username) }) - return res.status(200).send(scores.slice(0, amount)) + return res.send(scores.slice(0, amount)) }) } \ No newline at end of file diff --git a/api/leaderboards/scores.js b/api/leaderboards/scores.js index 3656b8e..3a5baa3 100644 --- a/api/leaderboards/scores.js +++ b/api/leaderboards/scores.js @@ -28,6 +28,6 @@ module.exports = async (app, req, res) => { scores = scores.map(x => new Player(x)) scores.forEach(x => app.userCache(req.id, x.accountID, x.playerID, x.username)) - return res.status(200).send(scores.slice(0, amount)) + return res.send(scores.slice(0, amount)) }) } \ No newline at end of file diff --git a/api/level.js b/api/level.js index f0303ac..b5ea7eb 100644 --- a/api/level.js +++ b/api/level.js @@ -37,7 +37,7 @@ module.exports = async (app, req, res, api, analyze) => { function sendLevel() { - if (api) return res.status(200).send(level) + if (api) return res.send(level) else return fs.readFile('./html/level.html', 'utf8', function (err, data) { let html = data; @@ -50,7 +50,7 @@ module.exports = async (app, req, res, api, analyze) => { }) if (req.server.downloadsDisabled) html = html.replace('id="additional" class="', 'id="additional" class="downloadDisabled ') .replace('analyzeBtn"', 'analyzeBtn" style="filter: opacity(30%)"') - return res.status(200).send(html) + return res.send(html) }) } diff --git a/api/mappacks.js b/api/mappacks.js index e746730..5b4a6d3 100644 --- a/api/mappacks.js +++ b/api/mappacks.js @@ -6,7 +6,7 @@ module.exports = async (app, req, res) => { if (req.offline) return res.sendError() let cached = cache[req.id] - if (app.config.cacheMapPacks && cached && cached.data && cached.indexed + 5000000 > Date.now()) return res.status(200).send(cached.data) // 1.5 hour cache + if (app.config.cacheMapPacks && cached && cached.data && cached.indexed + 5000000 > Date.now()) return res.send(cached.data) // 1.5 hour cache let params = { count: 250, page: 0 } let packs = [] @@ -36,7 +36,7 @@ module.exports = async (app, req, res) => { })) if (app.config.cacheMapPacks) cache[req.id] = {data: mappacks, indexed: Date.now()} - return res.status(200).send(mappacks) + return res.send(mappacks) }) } mapPackLoop() diff --git a/api/messages/countMessages.js b/api/messages/countMessages.js index e075895..717457b 100644 --- a/api/messages/countMessages.js +++ b/api/messages/countMessages.js @@ -17,7 +17,7 @@ module.exports = async (app, req, res) => { else app.trackSuccess(req.id) let count = app.parseResponse(body)[38] if (!count) return res.status(400).send("Error fetching unread messages!") - else res.status(200).send(count) + else res.send(count) }) } \ No newline at end of file diff --git a/api/messages/deleteMessage.js b/api/messages/deleteMessage.js index 87ac65c..8b6cc26 100644 --- a/api/messages/deleteMessage.js +++ b/api/messages/deleteMessage.js @@ -17,7 +17,7 @@ module.exports = async (app, req, res) => { req.gdRequest('deleteGJMessages20', params, function (err, resp, body) { if (body != 1) return res.status(400).send(`The Geometry Dash servers refused to delete the message! Try again later, or make sure your username and password are entered correctly. Last worked: ${app.timeSince(req.id)} ago.`) - else res.status(200).send(`${deleted == 1 ? "1 message" : `${deleted} messages`} deleted!`) + else res.send(`${deleted == 1 ? "1 message" : `${deleted} messages`} deleted!`) app.trackSuccess(req.id) }) diff --git a/api/messages/fetchMessage.js b/api/messages/fetchMessage.js index 86d5c57..edb871e 100644 --- a/api/messages/fetchMessage.js +++ b/api/messages/fetchMessage.js @@ -31,7 +31,7 @@ module.exports = async (app, req, res) => { msg.browserColor = true } - return res.status(200).send(msg) + return res.send(msg) }) } \ No newline at end of file diff --git a/api/messages/getMessages.js b/api/messages/getMessages.js index ce4c5f6..40da8a3 100644 --- a/api/messages/getMessages.js +++ b/api/messages/getMessages.js @@ -39,7 +39,7 @@ module.exports = async (app, req, res) => { app.userCache(req.id, msg.accountID, msg.playerID, msg.author) messageArray.push(msg) }) - return res.status(200).send(messageArray) + return res.send(messageArray) }) } \ No newline at end of file diff --git a/api/messages/sendMessage.js b/api/messages/sendMessage.js index 2bccb33..36bb9c6 100644 --- a/api/messages/sendMessage.js +++ b/api/messages/sendMessage.js @@ -19,7 +19,7 @@ module.exports = async (app, req, res) => { req.gdRequest('uploadGJMessage20', params, function (err, resp, body) { if (body != 1) return res.status(400).send(`The Geometry Dash servers refused to send the message! Try again later, or make sure your username and password are entered correctly. Last worked: ${app.timeSince(req.id)} ago.`) - else res.status(200).send('Message sent!') + else res.send('Message sent!') app.trackSuccess(req.id) }) diff --git a/api/post/like.js b/api/post/like.js index 75f7946..0997238 100644 --- a/api/post/like.js +++ b/api/post/like.js @@ -34,6 +34,6 @@ module.exports = async (app, req, res) => { req.gdRequest('likeGJItem211', params, function (err, resp, body) { if (err) return res.status(400).send(`The Geometry Dash servers rejected your vote! Try again later, or make sure your username and password are entered correctly. Last worked: ${app.timeSince(req.id)} ago.`) else app.trackSuccess(req.id) - res.status(200).send((params.like == 1 ? 'Successfully liked!' : 'Successfully disliked!') + " (this will only take effect if this is your first time doing so)") + res.send((params.like == 1 ? 'Successfully liked!' : 'Successfully disliked!') + " (this will only take effect if this is your first time doing so)") }) } \ No newline at end of file diff --git a/api/post/postComment.js b/api/post/postComment.js index 3a5e8ad..5027efc 100644 --- a/api/post/postComment.js +++ b/api/post/postComment.js @@ -46,7 +46,7 @@ module.exports = async (app, req, res) => { return res.status(400).send(`You have been banned from commenting for ${(parseInt(banStuff[1]) / 86400).toFixed(0)} days. Reason: ${banStuff[2] || "None"}`) } - res.status(200).send(`Comment posted to level ${params.levelID} with ID ${body}`) + res.send(`Comment posted to level ${params.levelID} with ID ${body}`) app.trackSuccess(req.id) rateLimit[req.body.username] = Date.now(); setTimeout(() => {delete rateLimit[req.body.username]; }, cooldown); diff --git a/api/post/postProfileComment.js b/api/post/postProfileComment.js index e4efef4..b9d0ae3 100644 --- a/api/post/postProfileComment.js +++ b/api/post/postProfileComment.js @@ -31,6 +31,6 @@ module.exports = async (app, req, res) => { return res.status(400).send(`You have been banned from commenting for ${(parseInt(banStuff[1]) / 86400).toFixed(0)} days. Reason: ${banStuff[2] || "None"}`) } else app.trackSuccess(req.id) - res.status(200).send(`Comment posted to ${params.userName} with ID ${body}`) + res.send(`Comment posted to ${params.userName} with ID ${body}`) }) } \ No newline at end of file diff --git a/api/profile.js b/api/profile.js index 2291217..15a9587 100644 --- a/api/profile.js +++ b/api/profile.js @@ -50,7 +50,7 @@ module.exports = async (app, req, res, api, getLevels) => { let userData = new Player(account) - if (api) return res.status(200).send(userData) + if (api) return res.send(userData) else fs.readFile('./html/profile.html', 'utf8', function(err, data) { let html = data; @@ -59,7 +59,7 @@ module.exports = async (app, req, res, api, getLevels) => { let regex = new RegExp(`\\[\\[${x.toUpperCase()}\\]\\]`, "g") html = html.replace(regex, app.clean(userData[x])) }) - return res.status(200).send(html) + return res.send(html) }) }) diff --git a/api/search.js b/api/search.js index 08039cb..86e7ff3 100644 --- a/api/search.js +++ b/api/search.js @@ -156,7 +156,7 @@ module.exports = async (app, req, res) => { }) if (filters.type == 10) parsedLevels = parsedLevels.slice((+filters.page) * amount, (+filters.page + 1) * amount) - return res.status(200).send(parsedLevels) + return res.send(parsedLevels) }) } \ No newline at end of file diff --git a/api/song.js b/api/song.js index 97c2144..1439318 100644 --- a/api/song.js +++ b/api/song.js @@ -1,56 +1,10 @@ -const request = require('request') - module.exports = async (app, req, res) => { - // temporary solution until song api is re-enabled - if (req.offline) return res.sendError() let songID = req.params.song req.gdRequest('getGJSongInfo', {songID: songID}, function(err, resp, body) { if (err) return res.sendError(400) - else if (body < 0) return res.send(false) - request.get('https://www.newgrounds.com/audio/listen/' + songID, function(err2, resp2, song) { - console.log(resp2.statusCode) - return res.status(200).send(resp2.statusCode == 200) - }) + return res.send(!body.startsWith("-") && body.length > 10) }) -} - - - //////////////////////////////////////////////////// - // RobTop disabled his song checking page soo.... // - //////////////////////////////////////////////////// - - /* let info = {error: true, exists: false, artist: { name: "", scouted: false, whitelisted: false }, song: { name: "", externalUse: false, allowed: false } } - - if (req.offline) return res.send(info) - - let songID = req.params.song - let testError = false - - request.post('http://boomlings.com/database/testSong.php?songID=' + songID, req.gdParams(), function(err, resp, body) { - if (err || !body || body == '-1' || body.startsWith("<")) return res.send(info) - else if (!body.includes("
")) testError = true - - req.gdRequest('getGJSongInfo', {songID: songID}, function(err2, resp, songAllowed) { - if (err2 || !songAllowed || songAllowed < 0 || body.startsWith("<")) return res.send(info) - - info.song.allowed = songAllowed.length > 15 - if (testError) return res.send(info) - - let artistInfo = body.split(/<\/?br>/) - info.artist.name = artistInfo[0].split(": ")[1] - info.exists = info.artist.name.length > 0 - info.artist.scouted = artistInfo[2].split("is NOT").length == 1 - info.artist.whitelisted = artistInfo[1].split("is NOT").length == 1 - info.song.name = artistInfo[4].split(": ")[1] - info.song.externalUse = artistInfo[5].split("API NOT").length == 1 - - delete info.error - res.send(info) - - }) - }) - -} */ \ No newline at end of file +} \ No newline at end of file diff --git a/misc/sampleIcons.json b/misc/sampleIcons.json index 116e6cb..0252726 100644 --- a/misc/sampleIcons.json +++ b/misc/sampleIcons.json @@ -11,8 +11,7 @@ [ "Missing Source", 23, 7, 15, 0 ], [ "AeonAir", 109, 29, 3, 0 ], - [ "AmorAltra", 12, 11, 4, 1 ], - [ "COLON", 60, 18, 10, 1 ], + [ "Colon", 60, 18, 10, 1 ], [ "Colon2ndAccount", 42, 15, 10, 1 ], [ "Cyclic", 30, 3, 12, 0 ], [ "DanZmeN", 104, 34, 12, 1 ],