Use IP for all GJP requests (requested by rob)
This commit is contained in:
parent
27730bfcea
commit
2bae5a5a3c
11 changed files with 18 additions and 9 deletions
|
@ -19,7 +19,7 @@ module.exports = async (app, req, res) => {
|
|||
}
|
||||
|
||||
request.post(app.endpoint + 'getGJLevelScores211.php', {
|
||||
form : params}, async function(err, resp, body) {
|
||||
form : params, headers: {'x-forwarded-for': req.headers['x-real-ip']}}, async function(err, resp, body) {
|
||||
|
||||
if (err || body == '-1' || !body) return res.send("-1")
|
||||
scores = body.split('|').map(x => app.parseResponse(x))
|
||||
|
|
|
@ -58,6 +58,7 @@ module.exports = async (app, req, res, api, analyze) => {
|
|||
|
||||
else return fs.readFile('./html/level.html', 'utf8', function (err, data) {
|
||||
let html = data;
|
||||
level.songName = level.songName.replace(/[^ -~]/g, "") // strip off unsupported characters
|
||||
let variables = Object.keys(level)
|
||||
variables.forEach(x => {
|
||||
let regex = new RegExp(`\\[\\[${x.toUpperCase()}\\]\\]`, "g")
|
||||
|
|
|
@ -17,7 +17,8 @@ module.exports = async (app, req, res) => {
|
|||
}
|
||||
|
||||
request.post(app.endpoint + 'getGJUserInfo20.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (err || body == '-1' || body == '-2' || !body) return res.status(400).send("Error fetching profile! Make sure your username and password are entered correctly.")
|
||||
|
|
|
@ -18,7 +18,8 @@ module.exports = async (app, req, res, api) => {
|
|||
let deleted = params.messages.split(",").length
|
||||
|
||||
request.post(app.endpoint + 'deleteGJMessages20.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (body != 1) return res.status(400).send("The Geometry Dash servers refused to delete the message! Make sure your username and password are entered correctly.")
|
||||
|
|
|
@ -15,7 +15,8 @@ module.exports = async (app, req, res, api) => {
|
|||
}
|
||||
|
||||
request.post(app.endpoint + 'downloadGJMessage20.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (err || body == '-1' || !body) return res.status(400).send("Error fetching message!")
|
||||
|
|
|
@ -19,7 +19,8 @@ module.exports = async (app, req, res, api) => {
|
|||
}
|
||||
|
||||
request.post(app.endpoint + 'getGJMessages20.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (err || body == '-1' || body == '-2' || !body) return res.status(400).send("Error fetching messages!")
|
||||
|
|
|
@ -21,7 +21,8 @@ module.exports = async (app, req, res, api) => {
|
|||
}
|
||||
|
||||
request.post(app.endpoint + 'uploadGJMessage20.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (body != 1) return res.status(400).send("The Geometry Dash servers refused to send the message! Make sure your username and password are entered correctly.")
|
||||
|
|
|
@ -36,7 +36,8 @@ module.exports = async (app, req, res) => {
|
|||
params.chk = chk
|
||||
|
||||
request.post(app.endpoint + 'likeGJItem211.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, function (err, resp, body) {
|
||||
if (err) return res.status(400).send("The Geometry Dash servers returned an error! Perhaps they're down for maintenance")
|
||||
if (!body || body == "-1") return res.status(400).send("The Geometry Dash servers rejected your vote! Make sure your username and password are entered correctly.")
|
||||
|
|
|
@ -31,7 +31,8 @@ module.exports = async (app, req, res) => {
|
|||
params.chk = chk
|
||||
|
||||
request.post(app.endpoint + 'uploadGJAccComment20.php', {
|
||||
form: params
|
||||
form: params,
|
||||
headers: {'x-forwarded-for': req.headers['x-real-ip']}
|
||||
}, function (err, resp, body) {
|
||||
if (err) return res.status(400).send("The Geometry Dash servers returned an error! Perhaps they're down for maintenance")
|
||||
if (!body || body == "-1") return res.status(400).send("The Geometry Dash servers rejected your profile post! Try again later, or make sure your username and password are entered correctly.")
|
||||
|
|
|
@ -163,6 +163,7 @@ fetch(target).then(res => res.json()).then(lvl => {
|
|||
}
|
||||
else $('#authorLink').attr('href', '../profile/' + lvl.author)
|
||||
$('#levelName').text(lvl.name || ("Nonexistent level " + lvlID))
|
||||
if (!lvl.name) $('#leaveComment').hide()
|
||||
$('#levelAuthor').text("By " + (lvl.author || "-"))
|
||||
$('#levelID').text("ID: " + lvlID)
|
||||
if (lvl.accountID && lvl.author != "-")
|
||||
|
|
|
@ -181,7 +181,7 @@ function Append(firstLoad) {
|
|||
$('#searchBox').append(`<div class="searchresult">
|
||||
<h1 class="lessspaced">${x.name}</h1>
|
||||
<h2 class="lessSpaced smaller inline gdButton ${hasAuthor ? "" : "green unregistered"}">${hasAuthor ? `<a href="../profile/${x.author}">By ${x.author}</a>` : `<a href="../search/${x.authorID}?user">By ${x.author}</a>`}</h2><h2 class="inline" style="margin-left: 1.5%; transform:translateY(30%)"> ${x.copiedID == '0' ? "" : '<img class="valign sideSpace" src="../assets/copied.png" height="12%">'}${x.large ? '<img class="valign sideSpaceD" src="../assets/large.png" height="12%">' : ''}</h2>
|
||||
<h3 class="lessSpaced ${x.customSong == 0 ? "blue" : "whatIfItWasPurple"}" style="overflow: hidden;">${x.songName}</h3>
|
||||
<h3 class="lessSpaced ${x.customSong == 0 ? "blue" : "whatIfItWasPurple"}" style="overflow: hidden;">${x.songName.replace(/[^ -~]/g, "")}</h3>
|
||||
<h3 class="lessSpaced">
|
||||
<img class="valign" src="../assets/time.png" height="14%"> ${x.length}
|
||||
<img class="valign" src="../assets/download.png" height="14%"> ${x.downloads}
|
||||
|
|
Loading…
Reference in a new issue