wip level uploading
This commit is contained in:
parent
53a38f977b
commit
e35272b282
|
@ -23,6 +23,7 @@ dbClient.connect((err) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
require('./getGJLevels21')(app, db);
|
require('./getGJLevels21')(app, db);
|
||||||
|
require('./uploadGJLevel21')(app, db);
|
||||||
|
|
||||||
app.get('*', (req, res) => res.status(404).send('wrong page dumbass'));
|
app.get('*', (req, res) => res.status(404).send('wrong page dumbass'));
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
module.exports = (app, db): void => {
|
||||||
|
app.post('/aa/database/uploadGJLevel21.php', async (req, res) => {
|
||||||
|
let levelID = await db.collection('levels').find({}).count() + 1;
|
||||||
|
|
||||||
|
console.log(req.body);
|
||||||
|
|
||||||
|
let udid = req.body.udid;
|
||||||
|
/*
|
||||||
|
if (udid != undefined && !isNaN(Number(udid)))
|
||||||
|
return res.status(200).send('-1');
|
||||||
|
*/
|
||||||
|
|
||||||
|
db.collection('levels').insertOne({
|
||||||
|
'name': req.body.levelName,
|
||||||
|
'id': levelID,
|
||||||
|
'level_data': req.body.levelString,
|
||||||
|
'extra_data': req.body.extraString || '29_29_29_40_29_29_29_29_29_29_29_29_29_29_29_29',
|
||||||
|
'level_info': req.body.levelInfo || 0,
|
||||||
|
'timestamp': Date.now(),
|
||||||
|
'description': req.body.levelDesc,
|
||||||
|
'game_version': req.body.gameVersion || 0,
|
||||||
|
'binary_version': req.body.binaryVersion || 0,
|
||||||
|
'username': req.body.userName,
|
||||||
|
'version': req.body.levelVersion,
|
||||||
|
'length': req.body.levelLength,
|
||||||
|
// difference between audio_track and song_id is
|
||||||
|
// audio_track is official songs and song_id is newgrounds aka custom songs
|
||||||
|
'audio_track': req.body.audioTrack,
|
||||||
|
'song_id': req.body.songID,
|
||||||
|
'auto': Number(req.body.auto || 0),
|
||||||
|
'password': Number(req.body.password || 0),
|
||||||
|
'original': req.body.original || 0,
|
||||||
|
'two_player': Number(req.body.twoPlayer || 0),
|
||||||
|
'objects': req.body.objects || 0,
|
||||||
|
'coins': req.body.coins || 0,
|
||||||
|
'requested_stars': req.body.requestedStars || 0,
|
||||||
|
'secret': req.body.secret,
|
||||||
|
'user_id': -1, // no user_id yet
|
||||||
|
'udid': udid, // ??? i have no idea what this is
|
||||||
|
'unlisted': req.body.unlisted || 0,
|
||||||
|
'ldm': req.body.ldm || 0,
|
||||||
|
// online stuff
|
||||||
|
'downloads': 0,
|
||||||
|
'likes': 0,
|
||||||
|
'difficulty': 0, // 0 = N/A 10 = EASY 20 = NORMAL 30 = HARD 40 = HARDER 50 = INSANE 50 = AUTO 50 = DEMON
|
||||||
|
'stars': 0,
|
||||||
|
'featured': 0,
|
||||||
|
'epic': 0
|
||||||
|
});
|
||||||
|
|
||||||
|
res.status(200).send(String(levelID));
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue