GDBrowser/api/messages/countMessages.js
GDColon 451c933301 ADDED MESSAGES!!!
You can now read, write, and delete messages through GDBrowser!

Blocking and viewing sent messages have not been done yet.

Also, a message now appears if you're comment banned
2019-12-29 18:59:29 -05:00

29 lines
No EOL
1,002 B
JavaScript

const request = require('request')
const XOR = require('../../classes/XOR.js');
const xor = new XOR();
module.exports = async (app, req, res) => {
if (!req.body.accountID) return res.status(400).send("No account ID provided!")
if (!req.body.password) return res.status(400).send("No password provided!")
let params = {
accountID: req.body.accountID,
targetAccountID: req.body.accountID,
gjp: xor.encrypt(req.body.password, 37526),
secret: app.secret,
gameVersion: app.gameVersion,
binaryVersion: app.binaryVersion,
}
request.post(app.endpoint + 'getGJUserInfo20.php', {
form: params
}, 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.")
let count = app.parseResponse(body)[38]
if (!count) return res.status(400).send("Error fetching unread messages!")
else res.status(200).send(count)
})
}