jhghlkjdhfoysdnlsiafhoyushfsidf
This commit is contained in:
parent
8db624459b
commit
2eaa3ee88b
22 changed files with 30 additions and 77 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ module.exports = async (app, req, res) => {
|
|||
|
||||
})
|
||||
|
||||
return res.status(200).send(commentArray)
|
||||
return res.send(commentArray)
|
||||
|
||||
})
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
})
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
})
|
||||
}
|
|
@ -37,7 +37,7 @@ module.exports = async (app, req, res) => {
|
|||
users.push(user)
|
||||
})
|
||||
|
||||
return res.status(200).send(users)
|
||||
return res.send(users)
|
||||
|
||||
})
|
||||
}
|
|
@ -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))
|
||||
|
||||
})
|
||||
}
|
|
@ -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))
|
||||
})
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = async (app, req, res) => {
|
|||
msg.browserColor = true
|
||||
}
|
||||
|
||||
return res.status(200).send(msg)
|
||||
return res.send(msg)
|
||||
})
|
||||
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
|
||||
|
|
|
@ -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)")
|
||||
})
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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}`)
|
||||
})
|
||||
}
|
|
@ -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)
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
@ -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)
|
||||
|
||||
})
|
||||
}
|
50
api/song.js
50
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("<br>")) 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)
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
} */
|
||||
}
|
|
@ -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 ],
|
||||
|
|
Loading…
Reference in a new issue