Add files via upload
This commit is contained in:
parent
2eb29e64e3
commit
b06944cb77
5 changed files with 23 additions and 19 deletions
|
@ -1,3 +1,4 @@
|
|||
"use strict";
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (req.method !== 'POST') return res.status(405).send("Method not allowed.")
|
||||
|
@ -14,10 +15,10 @@ module.exports = async (app, req, res) => {
|
|||
req.gdRequest('getGJUserInfo20', params, function (err, resp, body) {
|
||||
|
||||
if (err) return res.status(400).send(`Error counting messages! Messages get blocked a lot so 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)
|
||||
app.trackSuccess(req.id)
|
||||
let count = app.parseResponse(body)[38]
|
||||
if (!count) return res.status(400).send("Error fetching unread messages!")
|
||||
else res.send(count)
|
||||
res.send(count)
|
||||
})
|
||||
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
"use strict";
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (req.method !== 'POST') return res.status(405).send("Method not allowed.")
|
||||
|
@ -9,15 +10,16 @@ module.exports = async (app, req, res) => {
|
|||
let params = {
|
||||
accountID: req.body.accountID,
|
||||
gjp: app.xor.encrypt(req.body.password, 37526),
|
||||
// serialize to CSV if needed
|
||||
messages: Array.isArray(req.body.id) ? req.body.id.map(x => x.trim()).join(",") : req.body.id,
|
||||
}
|
||||
|
||||
let deleted = params.messages.split(",").length
|
||||
let deleted = params.messages.split(",").length // CSV record count
|
||||
|
||||
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.send(`${deleted == 1 ? "1 message" : `${deleted} messages`} deleted!`)
|
||||
res.send(`${deleted} message${deleted == 1 ? "" : "s"} deleted!`)
|
||||
app.trackSuccess(req.id)
|
||||
})
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
"use strict";
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (req.method !== 'POST') return res.status(405).send("Method not allowed.")
|
||||
|
@ -14,23 +15,22 @@ module.exports = async (app, req, res) => {
|
|||
req.gdRequest('downloadGJMessage20', params, function (err, resp, body) {
|
||||
|
||||
if (err) return res.status(400).send(`Error fetching message! 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)
|
||||
app.trackSuccess(req.id)
|
||||
|
||||
let x = app.parseResponse(body)
|
||||
let msg = {}
|
||||
msg.id = x[1];
|
||||
msg.id = x[1]
|
||||
msg.playerID = x[3]
|
||||
msg.accountID = x[2]
|
||||
msg.author = x[6]
|
||||
msg.subject = Buffer.from(x[4], "base64").toString().replace(/^Re: ☆/, "Re: ")
|
||||
msg.content = app.xor.decrypt(x[5], 14251)
|
||||
msg.date = x[7] + req.timestampSuffix
|
||||
if (msg.subject.endsWith("☆") || msg.subject.startsWith("☆")) {
|
||||
if (msg.subject.endsWith("☆")) msg.subject = msg.subject.slice(0, -1)
|
||||
else msg.subject = msg.subject.slice(1)
|
||||
msg.browserColor = true
|
||||
}
|
||||
|
||||
if (/^☆|☆$/.test(msg.subject)) {
|
||||
msg.subject = msg.subject.slice(...(msg.subject.endsWith("☆") ? [0, -1] : [1]))
|
||||
msg.browserColor = true
|
||||
}
|
||||
|
||||
return res.send(msg)
|
||||
})
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
"use strict";
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (req.method !== 'POST') return res.status(405).send("Method not allowed.")
|
||||
|
@ -23,17 +24,16 @@ module.exports = async (app, req, res) => {
|
|||
messages.forEach(x => {
|
||||
let msg = {}
|
||||
|
||||
msg.id = x[1];
|
||||
msg.id = x[1]
|
||||
msg.playerID = x[3]
|
||||
msg.accountID = x[2]
|
||||
msg.author = x[6]
|
||||
msg.subject = Buffer.from(x[4], "base64").toString().replace(/^Re: ☆/, "Re: ")
|
||||
msg.date = x[7] + req.timestampSuffix
|
||||
msg.unread = x[8] != "1"
|
||||
if (msg.subject.endsWith("☆") || msg.subject.startsWith("☆")) {
|
||||
if (msg.subject.endsWith("☆")) msg.subject = msg.subject.slice(0, -1)
|
||||
else msg.subject = msg.subject.slice(1)
|
||||
msg.browserColor = true
|
||||
if (/^☆|☆$/.test(msg.subject)) {
|
||||
msg.subject = msg.subject.slice(...(msg.subject.endsWith("☆") ? [0, -1] : [1]))
|
||||
msg.browserColor = true
|
||||
}
|
||||
|
||||
app.userCache(req.id, msg.accountID, msg.playerID, msg.author)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
"use strict";
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (req.method !== 'POST') return res.status(405).send("Method not allowed.")
|
||||
|
@ -7,7 +8,7 @@ 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 subject = Buffer.from(req.body.subject ? (req.body.color ? "☆" : "") + (req.body.subject.slice(0, 50)) : (req.body.color ? "☆" : "") + "No subject").toString('base64').replace(/\//g, '_').replace(/\+/g, "-")
|
||||
let subject = Buffer.from((req.body.color ? "☆" : "") + (req.body.subject ? req.body.subject.slice(0, 50) : "No subject")).toString('base64').replace('/', '_').replace('+', '-')
|
||||
let body = app.xor.encrypt(req.body.message.slice(0, 300), 14251)
|
||||
|
||||
let params = req.gdParams({
|
||||
|
@ -19,7 +20,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.send('Message sent!')
|
||||
res.send('Message sent!')
|
||||
app.trackSuccess(req.id)
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue