GDPS improvements, comment jumping, + more
- Improved param building for GDPS'es - Changed /profile/ to /u/ - Removed "most disliked" comment sort - Added ability to jump to last page of comments - Added page number and other small improvements to comment page
This commit is contained in:
parent
b407f0498c
commit
1884d58e46
32 changed files with 120 additions and 158 deletions
|
@ -30,7 +30,7 @@ module.exports = async (app, req, res) => {
|
|||
idArray.forEach((x, y) => {
|
||||
|
||||
request.post(app.endpoint + 'getGJUserInfo20.php', {
|
||||
form: {targetAccountID: x, secret: app.secret}
|
||||
form: app.gdParams({targetAccountID: x})
|
||||
}, function (err, resp, body) {
|
||||
if (err || !body || body == '-1') return res.send([])
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const pako = require('pako')
|
||||
const pako = require('zlib')
|
||||
const properties = require('../misc/objectProperties.json')
|
||||
const init = require('../misc/initialProperties.json')
|
||||
const colorStuff = require('../misc/colorProperties.json')
|
||||
|
@ -16,7 +16,7 @@ if (unencrypted) rawData = level.data
|
|||
|
||||
else {
|
||||
let buffer;
|
||||
try { buffer = pako.inflate(levelString, {to:"string"}) }
|
||||
try { buffer = zlib.gzipSync(levelString).toString() }
|
||||
catch(e) { return res.send("-1") }
|
||||
rawData = buffer.toString('utf8')
|
||||
}
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
const request = require('request')
|
||||
|
||||
module.exports = async (app, req, res, worstPage) => {
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
if (app.offline) return res.send("-1")
|
||||
|
||||
let count = +req.query.count || 10
|
||||
if (count > 1000) count = 1000
|
||||
if (+req.query.worstPage) worstPage = +req.query.worstPage
|
||||
|
||||
let params = {
|
||||
let params = app.gdParams({
|
||||
userID : req.params.id,
|
||||
accountID : req.params.id,
|
||||
levelID: req.params.id,
|
||||
page: worstPage ? worstPage - (+req.query.page || 0) - 1 : +req.query.page || 0,
|
||||
secret: app.secret,
|
||||
page: +req.query.page || 0,
|
||||
count,
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
mode: worstPage || req.query.hasOwnProperty("top") ? "1" : "0",
|
||||
}
|
||||
mode: req.query.hasOwnProperty("top") ? "1" : "0",
|
||||
})
|
||||
|
||||
let path = "getGJComments21"
|
||||
if (req.query.type == "commentHistory") path = "getGJCommentHistory"
|
||||
|
@ -38,11 +34,9 @@ module.exports = async (app, req, res, worstPage) => {
|
|||
|
||||
let pages = body.split('#')[1].split(":")
|
||||
let lastPage = +Math.ceil(+pages[0] / +pages[2]);
|
||||
if (path == "getGJComments21" && !worstPage && req.query.hasOwnProperty("worst")) return app.run.comments(app, req, res, lastPage)
|
||||
|
||||
let commentArray = []
|
||||
|
||||
if (worstPage) comments.reverse()
|
||||
comments.forEach((c, i) => {
|
||||
|
||||
var x = c[0] //comment info
|
||||
|
@ -74,7 +68,7 @@ module.exports = async (app, req, res, worstPage) => {
|
|||
if (i == 0 && req.query.type != "commentHistory") {
|
||||
comment.results = +pages[0];
|
||||
comment.pages = lastPage;
|
||||
comment.range = `${+pages[1] + 1} of ${Math.min(+pages[0], +pages[1] + +pages[2])}`
|
||||
comment.range = `${+pages[1] + 1} to ${Math.min(+pages[0], +pages[1] + +pages[2])}`
|
||||
}
|
||||
|
||||
commentArray.push(comment)
|
||||
|
|
|
@ -15,12 +15,7 @@ module.exports = async (app, req, res, api, ID, analyze) => {
|
|||
else levelID = levelID.replace(/[^0-9]/g, "")
|
||||
|
||||
request.post(app.endpoint + 'downloadGJLevel22.php', {
|
||||
form: {
|
||||
levelID,
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
secret: app.secret
|
||||
}
|
||||
form: app.gdParams({ levelID })
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (err || !body || body == '-1' || body.startsWith("<!")) {
|
||||
|
@ -33,11 +28,11 @@ module.exports = async (app, req, res, api, ID, analyze) => {
|
|||
let level = new Level(levelInfo)
|
||||
|
||||
request.post(app.endpoint + 'getGJUsers20.php', {
|
||||
form: { str: level.authorID, secret: app.secret }
|
||||
form: app.gdParams({ str: level.authorID })
|
||||
}, function (err1, res1, b1) {
|
||||
let gdSearchResult = app.parseResponse(b1)
|
||||
request.post(app.endpoint + 'getGJUserInfo20.php', {
|
||||
form: { targetAccountID: gdSearchResult[16], secret: app.secret }
|
||||
form: app.gdParams({ targetAccountID: gdSearchResult[16] })
|
||||
}, function (err2, res2, b2) {
|
||||
if (b2 != '-1') {
|
||||
let account = app.parseResponse(b2)
|
||||
|
@ -51,10 +46,7 @@ module.exports = async (app, req, res, api, ID, analyze) => {
|
|||
}
|
||||
|
||||
request.post(app.endpoint + 'getGJSongInfo.php', {
|
||||
form: {
|
||||
songID: level.customSong,
|
||||
secret: app.secret
|
||||
}
|
||||
form: app.gdParams({ songID: level.customSong })
|
||||
}, async function (err, resp, songRes) {
|
||||
|
||||
if (songRes != '-1') {
|
||||
|
|
10
api/icon.js
10
api/icon.js
|
@ -361,19 +361,13 @@ module.exports = async (app, req, res) => {
|
|||
res.contentType('image/png');
|
||||
|
||||
request.post(app.endpoint + 'getGJUsers20.php', {
|
||||
form: {
|
||||
str: username,
|
||||
secret: app.secret
|
||||
}
|
||||
form: app.gdParams({ str: username })
|
||||
}, function (err1, res1, body1) {
|
||||
if (err1 || !body1 || body1 == "-1") return buildIcon()
|
||||
else result = app.parseResponse(body1);
|
||||
|
||||
request.post(app.endpoint + 'getGJUserInfo20.php', {
|
||||
form: {
|
||||
targetAccountID: result[16],
|
||||
secret: app.secret
|
||||
}
|
||||
form: app.gdParams({ targetAccountID: result[16] })
|
||||
}, function (err2, res2, body2) {
|
||||
|
||||
if (!err2 && body2 && body2 != '-1') return buildIcon(app.parseResponse(body2));
|
||||
|
|
|
@ -11,13 +11,10 @@ module.exports = async (app, req, res) => {
|
|||
else amount = count;
|
||||
}
|
||||
|
||||
let params = {
|
||||
let params = app.gdParams({
|
||||
count: amount,
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
secret: app.secret,
|
||||
type: (req.query.hasOwnProperty("creator") || req.query.hasOwnProperty("creators")) ? "creators" : "top",
|
||||
}
|
||||
})
|
||||
|
||||
request.post(app.endpoint + 'getGJScores20.php', {
|
||||
form : params}, async function(err, resp, body) {
|
||||
|
|
|
@ -11,13 +11,12 @@ module.exports = async (app, req, res) => {
|
|||
else amount = count;
|
||||
}
|
||||
|
||||
let params = {
|
||||
let params = app.gdParams({
|
||||
levelID: req.params.id,
|
||||
secret: app.secret,
|
||||
accountID: app.id,
|
||||
gjp: app.gjp,
|
||||
type: req.query.hasOwnProperty("week") ? "2" : "1",
|
||||
}
|
||||
})
|
||||
|
||||
request.post(app.endpoint + 'getGJLevelScores211.php', {
|
||||
form : params, headers: {'x-forwarded-for': req.headers['x-real-ip']}}, async function(err, resp, body) {
|
||||
|
|
|
@ -23,11 +23,10 @@ module.exports = async (app, req, res, api, analyze) => {
|
|||
if (analyze || req.query.hasOwnProperty("download")) return app.run.download(app, req, res, api, levelID, analyze)
|
||||
|
||||
request.post(app.endpoint + 'getGJLevels21.php', {
|
||||
form: {
|
||||
form: app.gdParams({
|
||||
str: levelID,
|
||||
secret: app.secret,
|
||||
type: 0
|
||||
}
|
||||
})
|
||||
}, async function (err, resp, body) {
|
||||
|
||||
if (err || !body || body == '-1' || body.startsWith("<!")) {
|
||||
|
|
|
@ -7,14 +7,11 @@ 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 = {
|
||||
let params = app.gdParams({
|
||||
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,
|
||||
|
|
|
@ -8,12 +8,11 @@ module.exports = async (app, req, res, api) => {
|
|||
if (!req.body.password) return res.status(400).send("No password provided!")
|
||||
if (!req.body.id) return res.status(400).send("No message ID(s) provided!")
|
||||
|
||||
let params = {
|
||||
let params = app.gdParams({
|
||||
accountID: req.body.accountID,
|
||||
gjp: xor.encrypt(req.body.password, 37526),
|
||||
messages: Array.isArray(req.body.id) ? req.body.id.map(x => x.trim()).join(",") : req.body.id,
|
||||
secret: app.secret,
|
||||
}
|
||||
})
|
||||
|
||||
let deleted = params.messages.split(",").length
|
||||
|
||||
|
|
|
@ -7,12 +7,11 @@ module.exports = async (app, req, res, api) => {
|
|||
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 = {
|
||||
let params = app.gdParams({
|
||||
accountID: req.body.accountID,
|
||||
gjp: xor.encrypt(req.body.password, 37526),
|
||||
messageID: req.params.id,
|
||||
secret: app.secret,
|
||||
}
|
||||
})
|
||||
|
||||
request.post(app.endpoint + 'downloadGJMessage20.php', {
|
||||
form: params,
|
||||
|
|
|
@ -8,15 +8,12 @@ module.exports = async (app, req, res, api) => {
|
|||
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 = {
|
||||
let params = app.gdParams({
|
||||
accountID: req.body.accountID,
|
||||
gjp: xor.encrypt(req.body.password, 37526),
|
||||
page: req.body.page || 0,
|
||||
secret: app.secret,
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
getSent: req.query.sent ? 1 : 0
|
||||
}
|
||||
})
|
||||
|
||||
request.post(app.endpoint + 'getGJMessages20.php', {
|
||||
form: params,
|
||||
|
|
|
@ -12,13 +12,12 @@ module.exports = async (app, req, res, api) => {
|
|||
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 body = xor.encrypt(req.body.message.slice(0, 300), 14251)
|
||||
|
||||
let params = {
|
||||
let params = app.gdParams({
|
||||
accountID: req.body.accountID,
|
||||
gjp: xor.encrypt(req.body.password, 37526),
|
||||
toAccountID: req.body.targetID,
|
||||
subject, body,
|
||||
secret: app.secret,
|
||||
}
|
||||
})
|
||||
|
||||
request.post(app.endpoint + 'uploadGJMessage20.php', {
|
||||
form: params,
|
||||
|
|
|
@ -13,14 +13,11 @@ module.exports = async (app, req, res) => {
|
|||
if (!req.body.type) return res.status(400).send("No type provided! (1=level, 2=comment, 3=profile")
|
||||
if (!req.body.extraID) return res.status(400).send("No extra ID provided! (this should be a level ID, account ID, or '0' for levels")
|
||||
|
||||
let params = {
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
secret: app.secret,
|
||||
let params = app.gdParams({
|
||||
udid: '0',
|
||||
uuid: '0',
|
||||
rs: '8f0l0ClAN1'
|
||||
}
|
||||
})
|
||||
|
||||
params.itemID = req.body.ID.toString()
|
||||
params.gjp = xor.encrypt(req.body.password, 37526)
|
||||
|
|
|
@ -24,12 +24,9 @@ module.exports = async (app, req, res) => {
|
|||
|
||||
if (rateLimit[req.body.username]) return res.status(400).send(`Please wait ${getTime(rateLimit[req.body.username] + cooldown - Date.now())} seconds before posting another comment!`)
|
||||
|
||||
let params = {
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
secret: app.secret,
|
||||
let params = app.gdParams({
|
||||
percent: 0
|
||||
}
|
||||
})
|
||||
|
||||
params.comment = Buffer.from(req.body.comment + (req.body.color ? "☆" : "")).toString('base64').replace(/\//g, '_').replace(/\+/g, "-")
|
||||
params.gjp = xor.encrypt(req.body.password, 37526)
|
||||
|
|
|
@ -13,12 +13,9 @@ module.exports = async (app, req, res) => {
|
|||
|
||||
if (req.body.comment.includes('\n')) return res.status(400).send("Profile posts cannot contain line breaks!")
|
||||
|
||||
let params = {
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
secret: app.secret,
|
||||
let params = app.gdParams({
|
||||
cType: '1'
|
||||
}
|
||||
})
|
||||
|
||||
params.comment = Buffer.from(req.body.comment.slice(0, 190) + (req.body.color ? "☆" : "")).toString('base64').replace(/\//g, '_').replace(/\+/g, "-")
|
||||
params.gjp = xor.encrypt(req.body.password, 37526)
|
||||
|
|
|
@ -6,19 +6,13 @@ module.exports = async (app, req, res, api, getLevels) => {
|
|||
if (app.offline) return res.send("-1")
|
||||
|
||||
request.post(app.endpoint + 'getGJUsers20.php', {
|
||||
form: {
|
||||
str: getLevels || req.params.id,
|
||||
secret: app.secret,
|
||||
}
|
||||
form: app.gdParams({ str: getLevels || req.params.id })
|
||||
}, function (err1, res1, b1) {
|
||||
|
||||
let searchResult = (req.query.hasOwnProperty("account") || err1 || b1 == '-1' || b1.startsWith("<!") || !b1) ? req.params.id : app.parseResponse(b1)[16]
|
||||
|
||||
request.post(app.endpoint + 'getGJUserInfo20.php', {
|
||||
form: {
|
||||
targetAccountID: searchResult,
|
||||
secret: app.secret
|
||||
}
|
||||
form: app.gdParams({ targetAccountID: searchResult })
|
||||
}, function (err2, res2, body) {
|
||||
|
||||
if (err2 || body == '-1' || !body) {
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = async (app, req, res) => {
|
|||
else amount = count;
|
||||
}
|
||||
|
||||
let filters = {
|
||||
let filters = app.gdParams({
|
||||
str: req.params.text,
|
||||
|
||||
diff: req.query.diff,
|
||||
|
@ -35,10 +35,7 @@ module.exports = async (app, req, res) => {
|
|||
customSong: req.query.hasOwnProperty("customSong") ? 1 : 0,
|
||||
|
||||
type: req.query.type || 0,
|
||||
gameVersion: app.gameVersion,
|
||||
binaryVersion: app.binaryVersion,
|
||||
secret: app.secret
|
||||
}
|
||||
})
|
||||
|
||||
let foundPack = mapPacks[req.params.text.toLowerCase()]
|
||||
if (foundPack) filters.str = `${foundPack[0]},${foundPack[1]},${foundPack[2]}`;
|
||||
|
@ -73,7 +70,7 @@ module.exports = async (app, req, res) => {
|
|||
|
||||
request.post(app.endpoint + 'getGJLevels21.php', {
|
||||
form : filters}, async function(err, resp, body) {
|
||||
|
||||
|
||||
if (err || !body || body == '-1' || body.startsWith("<!")) return res.send("-1")
|
||||
let splitBody = body.split('#')
|
||||
let preRes = splitBody[0].split('|', 10)
|
||||
|
|
BIN
assets/double-arrow.png
Normal file
BIN
assets/double-arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
|
@ -423,12 +423,10 @@
|
|||
<p>Returns up to 10 comments or profile posts</p>
|
||||
|
||||
<br>
|
||||
<p class="reveal" onclick="$('#params-comment').slideToggle(100)"><b>Parameters (5)</b></p>
|
||||
<p class="reveal" onclick="$('#params-comment').slideToggle(100)"><b>Parameters (4)</b></p>
|
||||
<div class="subdiv" id="params-comment">
|
||||
<p>page: The page of the search</p>
|
||||
<p>top: Whether or not to sort by most liked (comments only)</p>
|
||||
<p>worst: Whether or not to sort by most disliked (comments only)</p>
|
||||
<p>worstPage: The total number of pages, if you already know what it is. Optional, but speeds up disliked sorting</p>
|
||||
<p>count: The number of comments/posts to list (default is 10, max is 1000)</p>
|
||||
<p>type: The type of comments to fetch. Instead of a level ID, they require a player and account ID, respectively.</p>
|
||||
<p class="indent">• commentHistory - All the comments from a player, if public on their profile</p>
|
||||
|
|
|
@ -59,12 +59,24 @@
|
|||
<img class="cornerPiece" src="../assets/corner.png" width=7%; style="transform: scaleX(-1)">
|
||||
</div>
|
||||
|
||||
<div class="brownBox center supercenter" style="width: 135vh; height: 82%; margin-top: -0.7%">
|
||||
<div style="text-align: right; position:absolute; top: 1%; right: 1.25%">
|
||||
<h2 class="smallGold" id="pagenum"></h2>
|
||||
</div>
|
||||
|
||||
<div class="brownBox center supercenter" style="width: 135vh; height: 82%; margin-top: -0.25%">
|
||||
|
||||
<div class="lightBox center dragscroll" id="commentBox" style="margin: 4.5% auto; width: 115vh; height: 86%; background-color: #934E27"></div>
|
||||
|
||||
<div class="supercenter" style="left: 97%; top: 25%; height: 10%">
|
||||
<img class="gdButton" id="refresh" src="../assets/refresh.png" height="90%">
|
||||
<div class="supercenter" style="left: 97%; top: 15.5%; height: 8.5%">
|
||||
<img class="gdButton" id="lastPage" src="../assets/double-arrow.png" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" id="firstPage" style="left: 97%; top: 27.5%; height: 8.5%; display: none;">
|
||||
<img class="gdButton refreshBtn" src="../assets/double-arrow.png" style="transform: scaleX(-1);" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" id="refreshButton" style="left: 97%; top: 27.5%; height: 10%">
|
||||
<img class="gdButton refreshBtn" src="../assets/refresh.png" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" style="left: 3%; top: 15%; height: 10%">
|
||||
|
@ -72,19 +84,15 @@
|
|||
</div>
|
||||
|
||||
<div class="supercenter" style="left: 3%; top: 25.5%; height: 10%">
|
||||
<img class="gdButton" id="worstSort" src="../assets/sort-dislikes.png" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" style="left: 3%; top: 36.5%; height: 10%">
|
||||
<img class="gdButton" id="timeSort" src="../assets/sort-time.png" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" style="left: 3%; top: 63%; height: 10%">
|
||||
<div class="supercenter" style="left: 3%; top: 36%; height: 10%">
|
||||
<img class="gdButton" id="compactMode" src="../assets/compact-off.png" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" style="left: 3%; top: 75%; height: 11%">
|
||||
<img class="gdButton" id="autoMode" src="../assets/playButton.png" height="90%">
|
||||
<div class="supercenter" style="left: 3%; top: 63%; height: 11%">
|
||||
<img class="gdButton" id="autoMode" src="../assets/playbutton.png" height="90%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" id="pageDown" style="left: 3%; top: 50%; height: 10%; display: none;">
|
||||
|
@ -95,13 +103,13 @@
|
|||
<img class="gdButton" src="../assets/arrow-right.png" height="95%">
|
||||
</div>
|
||||
|
||||
<div class="supercenter" id="pageUp" style="top: 4.8%; height: 10%; width: 100%;">
|
||||
<div class="supercenter" style="top: 4.8%; height: 10%; width: 100%;">
|
||||
<h2 class="smallGold inline" id="liveText" style="display: none; font-size: 4vh; color:red; margin: 0.4vh 3vh 0 0">[LIVE]</h2>
|
||||
<h1 class="smaller inline" id="levelName"></h1>
|
||||
<a id="authorLink"><h2 class="smallGold inline gdButton" id="levelAuthor" style="margin: 0.8vh 0 0 3vh"></h2></a>
|
||||
</div>
|
||||
|
||||
<div class="supercenter" id="pageUp" style="top: 100%; height: 10%; width: 100%;">
|
||||
<div class="supercenter" style="top: 100%; height: 10%; width: 100%;">
|
||||
<h2 class="smallGold inline" id="levelVersion"></h2>
|
||||
<a id="levelLink"><h2 class="smallGold inline gdButton" id="levelID" style="margin-left: 6vh"></h2></a>
|
||||
</div>
|
||||
|
@ -134,7 +142,7 @@ let history = false
|
|||
let page = 0
|
||||
let loadingComments = true
|
||||
let like = true
|
||||
let worstPage = 0
|
||||
let lastPage = 0
|
||||
let auto = false
|
||||
let interval = null
|
||||
|
||||
|
@ -143,8 +151,7 @@ if (lvlID > 999999999 || lvlID < -999999999) window.location.href = window.locat
|
|||
if (!Number.isInteger(+lvlID)) {history = true; target = `../api/profile/${lvlID}`}
|
||||
else lvlID = Math.round(+lvlID)
|
||||
|
||||
if (mode == "top" || (history && mode == "worst")) { mode = "top"; $('#topSort').attr('src', "../assets/sort-likes-on.png") }
|
||||
else if (mode == "worst") $('#worstSort').attr('src', "../assets/sort-dislikes-on.png")
|
||||
if (mode == "top") { mode = "top"; $('#topSort').attr('src', "../assets/sort-likes-on.png") }
|
||||
else $('#timeSort').attr('src', "../assets/sort-time-on.png")
|
||||
|
||||
function clean(text) {return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/=/g, "=").replace(/"/g, """).replace(/'/g, "'")}
|
||||
|
@ -156,7 +163,6 @@ fetch(target).then(res => res.json()).then(lvl => {
|
|||
if (history) {
|
||||
|
||||
$('#autoMode').remove()
|
||||
$('#worstSort').addClass('disabled')
|
||||
|
||||
if (!lvl.username) return window.location.href = window.location.href.replace("comments", "search")
|
||||
|
||||
|
@ -174,7 +180,7 @@ fetch(target).then(res => res.json()).then(lvl => {
|
|||
$('#levelAuthor').addClass("green").addClass("unregistered")
|
||||
$('#authorLink').attr('href', '../search/' + lvl.authorID + "?user")
|
||||
}
|
||||
else $('#authorLink').attr('href', '../profile/' + lvl.author)
|
||||
else $('#authorLink').attr('href', '../u/' + lvl.author)
|
||||
$('#levelName').text(lvl.name || ("Nonexistent level " + lvlID))
|
||||
if (!lvl.name) $('#leaveComment').hide()
|
||||
$('#levelAuthor').text("By " + (lvl.author || "-"))
|
||||
|
@ -198,10 +204,18 @@ else loadingComments = true;
|
|||
|
||||
if (!auto) $('#commentBox').html(`<div class="supercenter" id="loading" style="height: 12%;"><img class="spin noSelect" src="../assets/loading.png" height="105%"></div>`)
|
||||
|
||||
if (page == 0) $('#pageDown').hide()
|
||||
else $('#pageDown').show()
|
||||
if (page == 0) {
|
||||
$('#pageDown').hide()
|
||||
$('#firstPage').hide()
|
||||
$('#refreshButton').show()
|
||||
}
|
||||
else {
|
||||
$('#pageDown').show()
|
||||
$('#firstPage').show()
|
||||
$('#refreshButton').hide()
|
||||
}
|
||||
|
||||
fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID}?count=${compact && !auto ? 20 : 10}&page=${page}${history ? "&type=commentHistory" : ""}&${mode}${mode == "worst" && worstPage ? "&worstPage=" + worstPage : ""}`).then(res => res.json()).then(res => {
|
||||
fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID}?count=${compact && !auto ? 20 : 10}&page=${page}${history ? "&type=commentHistory" : ""}&${mode}`).then(res => res.json()).then(res => {
|
||||
|
||||
if (history && lvl.commentHistory != "all") $('#pageUp').hide()
|
||||
|
||||
|
@ -223,8 +237,9 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
|
|||
let modNumber = x.moderator || lvl.moderator
|
||||
|
||||
if (x.pages) {
|
||||
worstPage = x.pages
|
||||
if (page >= x.pages) $('#pageUp').hide()
|
||||
lastPage = x.pages
|
||||
$('#pagenum').html(`Page ${page+1} of ${x.pages}`)
|
||||
if (page+1 >= x.pages) $('#pageUp').hide()
|
||||
else $('#pageUp').show()
|
||||
}
|
||||
|
||||
|
@ -234,7 +249,7 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
|
|||
<div class="commentBG ${bgCol}">
|
||||
<div class="comment" commentID="${x.ID}">
|
||||
<img class="inline" src="../icon/${userLink}?form=${x.form}" height=21% style="margin-right: 0.8%">
|
||||
<a href=../${x.accountID == "0" ? `search/${x.playerID}?user` : `../profile/${userLink}`}>
|
||||
<a href=../${x.accountID == "0" ? `search/${x.playerID}?user` : `../u/${userLink}`}>
|
||||
<h2 class="inline gdButton ${x.accountID == "0" ? "green unregistered" : ""}">${userName}</h2></a>
|
||||
${modNumber > 0 ? `<img class="inline" src="../assets/mod${modNumber == 2 ? "-elder" : ""}.png" height=18% style="margin-left: 0.6%;">` : ""}
|
||||
<p class="commentPercent inline">${x.percent ? x.percent + "%" : ""}</p>
|
||||
|
@ -259,7 +274,7 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
|
|||
<div class="commentBG compactBG ${bgCol}">
|
||||
<div class="comment compact" commentID="${x.ID}">
|
||||
<img class="inline" src="../icon/${userLink}?form=${x.form}" height=21% style="margin-right: 0.8%">
|
||||
<a href=../${x.accountID == "0" ? `search/${x.playerID}?user` : `../profile/${userLink}`}>
|
||||
<a href=../${x.accountID == "0" ? `search/${x.playerID}?user` : `../u/${userLink}`}>
|
||||
<h2 class="inline gdButton ${x.accountID == "0" ? "green unregistered" : ""}">${userName}</h2></a>
|
||||
${modNumber > 0 ? `<img class="inline" src="../assets/mod${modNumber == 2 ? "-elder" : ""}.png" height=18% style="margin-left: 0.6%;">` : ""}
|
||||
<p class="commentPercent inline">${x.percent ? x.percent + "%" : ""}</p>
|
||||
|
@ -284,9 +299,9 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
|
|||
})
|
||||
|
||||
$('.commentText').each(function() {
|
||||
if ($(this).text().length > 100) {
|
||||
let overflow = ($(this).text().length - 100) * 0.01
|
||||
$(this).css('font-size', (3.5 - (overflow)) + 'vh')
|
||||
if ($(this).text().length > 100) {
|
||||
let overflow = ($(this).text().length - 100) * 0.01
|
||||
$(this).css('font-size', (3.5 - (overflow)) + 'vh')
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -301,6 +316,7 @@ appendComments()
|
|||
|
||||
$('#pageUp').click(function() {if (loadingComments) return; page += 1; appendComments()})
|
||||
$('#pageDown').click(function() {if (loadingComments) return; page -= 1; appendComments()})
|
||||
$('#lastPage').click(function() {if (loadingComments || auto) return; page = lastPage - 1; appendComments()})
|
||||
|
||||
function resetSort() {
|
||||
page = 0
|
||||
|
@ -316,7 +332,6 @@ $('#topSort').click(function() {
|
|||
mode = "top";
|
||||
$('#timeSort').attr('src', "../assets/sort-time.png")
|
||||
$('#topSort').attr('src', "../assets/sort-likes-on.png")
|
||||
$('#worstSort').attr('src', "../assets/sort-dislikes.png")
|
||||
appendComments()
|
||||
})
|
||||
|
||||
|
@ -326,24 +341,13 @@ $('#timeSort').click(function() {
|
|||
mode = "time";
|
||||
$('#timeSort').attr('src', "../assets/sort-time-on.png")
|
||||
$('#topSort').attr('src', "../assets/sort-likes.png")
|
||||
$('#worstSort').attr('src', "../assets/sort-dislikes.png")
|
||||
appendComments()
|
||||
})
|
||||
|
||||
$('#worstSort').click(function() {
|
||||
if (mode == "worst" || loadingComments) return;
|
||||
resetSort()
|
||||
mode = "worst";
|
||||
$('#timeSort').attr('src', "../assets/sort-time.png")
|
||||
$('#topSort').attr('src', "../assets/sort-likes.png")
|
||||
$('#worstSort').attr('src', "../assets/sort-dislikes-on.png")
|
||||
appendComments()
|
||||
})
|
||||
|
||||
$('#compactMode').click(function() {
|
||||
if (loadingComments) return;
|
||||
compact = !compact
|
||||
worstPage = 0;
|
||||
lastPage = 0;
|
||||
page = 0;
|
||||
$('#compactMode').attr('src', `../assets/compact-${compact ? "on" : "off"}.png`)
|
||||
appendComments()
|
||||
|
@ -356,13 +360,15 @@ $('#autoMode').click(function() {
|
|||
page = 0;
|
||||
$('#timeSort').attr('src', "../assets/sort-time-on.png")
|
||||
$('#topSort').attr('src', "../assets/sort-likes.png")
|
||||
$('#worstSort').attr('src', "../assets/sort-dislikes.png")
|
||||
|
||||
if (auto) {
|
||||
document.title = "[LIVE] " + document.title
|
||||
$('#liveText').show()
|
||||
$('#autoMode').attr('src', `../assets/stopbutton.png`)
|
||||
interval = setInterval(function() { appendComments(true) }, 2000)
|
||||
}
|
||||
else {
|
||||
document.title = document.title.slice(6)
|
||||
$('#liveText').hide()
|
||||
$('#autoMode').attr('src', `../assets/playbutton.png`)
|
||||
clearInterval(interval)
|
||||
|
@ -370,9 +376,9 @@ $('#autoMode').click(function() {
|
|||
appendComments(true)
|
||||
})
|
||||
|
||||
$('#refresh').click(function() {
|
||||
$(document).on('click', '.refreshBtn', function () {
|
||||
if (loadingComments) return
|
||||
worstPage = 0;
|
||||
lastPage = 0;
|
||||
page = 0;
|
||||
appendComments()
|
||||
})
|
||||
|
|
|
@ -117,7 +117,7 @@ let demonMode = false;
|
|||
|
||||
$('#userSearch').click(function() {
|
||||
let query = encodeURIComponent($('#levelName').val())
|
||||
if (query) window.location.href = "./profile/" + query
|
||||
if (query) window.location.href = "./u/" + query
|
||||
})
|
||||
|
||||
$('.levelSearch').click(function() {
|
||||
|
|
|
@ -91,7 +91,7 @@ fetch(`./api/credits`).then(res => res.json()).then(res => {
|
|||
$('#credits').append(`<div id="credits${y+1}" class="subCredits" style="display: none;">
|
||||
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
|
||||
<h1>${x.header}</h1><br>
|
||||
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/${x.ign || x.name}">${x.name}</h2></a>
|
||||
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./u/${x.ign || x.name}">${x.name}</h2></a>
|
||||
<img src="./icon/${x.ign || x.name}" height=30%; style="margin-bottom: 7%"><br>
|
||||
<a target=_blank href="${x.youtube[0]}"><img src="../assets/${x.youtube[1]}.png" width="11%" class="gdButton"></a>
|
||||
<a target=_blank href="${x.twitter[0]}"><img src="../assets/${x.twitter[1]}.png" width="11%" class="sideSpace gdButton"></a>
|
||||
|
@ -112,7 +112,7 @@ fetch(`./api/credits`).then(res => res.json()).then(res => {
|
|||
|
||||
res.specialThanks.forEach((x, y) => {
|
||||
$('#specialthanks').append(`<div class="specialThanks">
|
||||
<h2 class="gdButton smaller"><a href="./profile/${x}">${x}</h2></a>
|
||||
<h2 class="gdButton smaller"><a href="./u/${x}">${x}</h2></a>
|
||||
<img src="./icon/${x}" height=85%><br>
|
||||
</div>`)
|
||||
})
|
||||
|
|
|
@ -111,7 +111,7 @@ function leaderboard(val) {
|
|||
if (val == type && res != -1) res.forEach((x, y) => {
|
||||
|
||||
$('#searchBox').append(`<div class="searchresult leaderboardSlot">
|
||||
<h2 class="small inline gdButton" style="margin-top: 1.5%"><a href="../profile/${x.username}">${x.username}</a></h2>
|
||||
<h2 class="small inline gdButton" style="margin-top: 1.5%"><a href="../u/${x.username}">${x.username}</a></h2>
|
||||
<h3 class="inline sideSpace${x.stars >= 100000 ? " yellow" : ""}" style="font-size: 4.5vh">${x.stars} <img class="valign" src="../assets/star.png"
|
||||
style="cursor: help; height: 19%; transform: translate(-25%, -10%);" title="Stars"></h3>
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
</div>
|
||||
|
||||
<div class="center" style="position:absolute; top: 9%; left: 0%; right: 0%; height: 5%;">
|
||||
<h2 class="inline slightlySmaller normalCursor gdButton" id="authorName"><a class="linkButton" id="authorLink" href="../profile/[[AUTHOR]]">By [[AUTHOR]]</a></h2>
|
||||
<h2 class="inline slightlySmaller normalCursor gdButton" id="authorName"><a class="linkButton" id="authorLink" href="../u/[[AUTHOR]]">By [[AUTHOR]]</a></h2>
|
||||
<h2 class="inline slightlySmaller normalCursor sideSpaceC">
|
||||
<img class="inline valign" id="copiedBadge" style="height: 60%; cursor:help" src="../assets/copied.png" title="Level is a copy or a collaboration">
|
||||
<img class="inline valign" id="largeBadge" style="height: 60%; margin-left: -7%; cursor:help" src="../assets/large.png" title="Contains more than 40,000 objects"></h2>
|
||||
|
|
|
@ -97,7 +97,7 @@ function leaderboard() {
|
|||
let shift = x.rank >= 100 ? [0.4, 50] : x.rank >= 10 ? [0.2, 25] : [0, 10]
|
||||
|
||||
$('#searchBox').append(`<div class="searchresult leaderboardSlot" style="padding-left: 25.5vh; height: 15%">
|
||||
<h2 class="small inline gdButton" style="margin-top: 1.5%; font-size: 6.5vh; margin-right: 3%;"><a href="../profile/${x.username}">${x.username}</a></h2>
|
||||
<h2 class="small inline gdButton" style="margin-top: 1.5%; font-size: 6.5vh; margin-right: 3%;"><a href="../u/${x.username}">${x.username}</a></h2>
|
||||
|
||||
<h3 class="inline lessSpaced leaderboardStats" style="transform:translateY(-10%)">
|
||||
${x.percent}%
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
$('#msgList').append(`
|
||||
<div messageID=${x.id} authorID="${x.accountID}" ${x.browserColor ? 'browserColor="true" ' : ""}class="commentBG gdMessage">
|
||||
<h3 style="color: ${x.browserColor ? 'rgb(120, 200, 255)' : 'white'}; font-size: ${x.subject.length > 35 ? "3" : x.subject.length > 30 ? "3.5" : x.subject.length > 25 ? "3.75" : "4"}vh">${x.subject}${x.unread ? " <span style='color:#00E600'>!</span>" : ""}</h3>
|
||||
<h3 class="gold gdButton msgAuthor hitbox fit"><a href="../profile/${x.author}" target="_blank">From: ${x.author}</a></h3>
|
||||
<h3 class="gold gdButton msgAuthor hitbox fit"><a href="../u/${x.author}" target="_blank">From: ${x.author}</a></h3>
|
||||
<p class="msgDate">${x.date}</p>
|
||||
<div class="labelButton hitbox">
|
||||
<input id="message-${y}" type="checkbox" class="chk" messageID=${x.id}>
|
||||
|
@ -285,7 +285,7 @@
|
|||
targetUser = decodeURIComponent(targetUser[1])
|
||||
fetch(`../api/profile/${targetUser}`).then(res => res.json()).then(res => {
|
||||
if (res == "-1" || !res) return;
|
||||
$('#replyAuthor').html(`<a href="../profile/${res.username}" target="_blank">To: ${res.username}</a>`)
|
||||
$('#replyAuthor').html(`<a href="../u/${res.username}" target="_blank">To: ${res.username}</a>`)
|
||||
messageStatus[res.accountID] = [res.messages, res.username]
|
||||
authorID = res.accountID
|
||||
if (res.messages == "all") $('#messageStatus').html(`<span style="color:yellow">${res.username}</span> has messages <span style="color:lime">enabled</span>`)
|
||||
|
|
|
@ -180,7 +180,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>
|
||||
<h2 class="lessSpaced smaller inline gdButton ${hasAuthor ? "" : "green unregistered"}">${hasAuthor ? `<a href="../u/${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.replace(/[^ -~]/g, "")}</h3>
|
||||
<h3 class="lessSpaced">
|
||||
<img class="valign" src="../assets/time.png" height="14%"> ${x.length}
|
||||
|
|
20
index.js
20
index.js
|
@ -9,11 +9,15 @@ let useRateLimiting = true
|
|||
|
||||
const app = express();
|
||||
app.offline = false // set to true to go into "offline" mode (in case of ip ban from rob)
|
||||
app.secret = 'Wmfd2893gb7'
|
||||
app.gameVersion = '21'
|
||||
app.binaryVersion = '35'
|
||||
app.endpoint = 'http://boomlings.com/database/'
|
||||
app.secret = "Wmfd2893gb7" // lol
|
||||
|
||||
app.config = require('./misc/gdpsConfig') // tweak settings in this file if you're using a GDPS
|
||||
app.endpoint = app.config.endpoint // boomlings.com/database/
|
||||
|
||||
app.gdParams = function(obj={}) {
|
||||
Object.keys(app.config.params).forEach(x => { if (!obj[x]) obj[x] = app.config.params[x] })
|
||||
return obj
|
||||
}
|
||||
|
||||
const RL = rateLimit({
|
||||
windowMs: useRateLimiting ? 5 * 60 * 1000 : 0,
|
||||
|
@ -137,23 +141,21 @@ app.get("/api/search/:text", function(req, res) { app.run.search(app, req, res)
|
|||
app.get("/icon", function(req, res) { res.redirect('/iconkit') })
|
||||
app.get("/iconkit/:text", function(req, res) { res.redirect('/icon/' + req.params.text) })
|
||||
app.get("/leaderboards/:id", function(req, res) { res.redirect('/leaderboard/' + req.params.id) })
|
||||
app.get("/profile/:id", function(req, res) { res.redirect('/u/' + req.params.id) })
|
||||
app.get("/p/:id", function(req, res) { res.redirect('/u/' + req.params.id) })
|
||||
app.get("/l/:id", function(req, res) { res.redirect('/leaderboard/' + req.params.id) })
|
||||
app.get("/a/:id", function(req, res) { res.redirect('/analyze/' + req.params.id) })
|
||||
app.get("/c/:id", function(req, res) { res.redirect('/comments/' + req.params.id) })
|
||||
app.get("/u/:id", function(req, res) { res.redirect('/profile/' + req.params.id) })
|
||||
app.get("/p/:id", function(req, res) { res.redirect('/profile/' + req.params.id) })
|
||||
|
||||
|
||||
// API AND HTML
|
||||
|
||||
app.get("/profile/:id", function(req, res) { app.run.profile(app, req, res) })
|
||||
app.get("/u/:id", function(req, res) { app.run.profile(app, req, res) })
|
||||
app.get("/:id", function(req, res) { app.run.level(app, req, res) })
|
||||
|
||||
|
||||
// MISC
|
||||
|
||||
|
||||
|
||||
app.get("/assets/sizecheck.js", function(req, res) { res.sendFile(__dirname + "/misc/sizecheck.js") })
|
||||
app.get("/icon/:text", function(req, res) { app.run.icon(app, req, res) })
|
||||
app.get('/api/icons', function(req, res) {
|
||||
|
|
|
@ -4,6 +4,14 @@
|
|||
|
||||
module.exports = {
|
||||
|
||||
endpoint: "http://boomlings.com/database/", // Server endpoint to send requests to
|
||||
|
||||
params: { // Always send this stuff to the servers
|
||||
secret: 'Wmfd2893gb7',
|
||||
gameVersion: '21',
|
||||
binaryVersion: '35',
|
||||
},
|
||||
|
||||
base64descriptions: true, // Are level descriptions encoded in Base64?
|
||||
xorPasswords: true, // Are level passwords XOR encrypted?
|
||||
timestampSuffix: " ago", // Suffix to add after timestamps, if any.
|
||||
|
|
Loading…
Reference in a new issue