Profile improvements, level versions, mod badges, oh my!

I'M ALIVE!!!!!

- Added account and player ID to profile page
- You can now search players by account ID. (It should figure it out automatically)
- Moved profile post button to the bottom left of profile page and put the uploaded levels button back where it belongs
- Added GD version to level info
- Added support for regular mod badge in comments ("modColor" is now "moderator" in API)
- IP address is now randomized when posting a comment, because it seems to be the best method
This commit is contained in:
GDColon 2020-02-20 20:09:40 -05:00
parent c01d2466b3
commit 07e66fec26
10 changed files with 32 additions and 28 deletions

View file

@ -55,7 +55,8 @@ module.exports = async (app, req, res) => {
comment.accountID = y[16]
comment.form = ['icon', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider'][Number(y[14])]
if (x[10] > 0) comment.percent = x[10]
if (x[12] && x[12].includes(',')) comment.modColor = true
if (x[12] && x[12].includes(',')) comment.moderator = 1 + (x[12] != "255,255,255")
else comment.moderator = 0
}
commentArray.push(comment)

View file

@ -47,7 +47,7 @@ module.exports = async (app, req, res) => {
request.post(app.endpoint + 'uploadGJComment21.php', {
form: params,
headers: {'x-forwarded-for': req.headers['x-forwarded-for'] || req.connection.remoteAddress } // prevent pesky ip bans
headers: {'x-forwarded-for': (Math.floor(Math.random() * 255) + 1)+"."+(Math.floor(Math.random() * 255) + 0)+"."+(Math.floor(Math.random() * 255) + 0)+"."+(Math.floor(Math.random() * 255) + 0) } // prevent pesky ip bans using a random 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 comment! Try again later, or make sure your username and password are entered correctly.")

View file

@ -10,16 +10,11 @@ module.exports = async (app, req, res, api, getLevels) => {
}
}, function (err1, res1, b1) {
if (err1 || b1 == '-1' || !b1) {
if (!api) return res.redirect('/search/' + req.params.id)
else return res.send("-1")
}
let gdSearchResult = app.parseResponse(b1)
let searchResult = (err1 || b1 == '-1' || !b1) ? req.params.id : app.parseResponse(b1)[16]
request.post(app.endpoint + 'getGJUserInfo20.php', {
form: {
targetAccountID: gdSearchResult[16],
targetAccountID: searchResult,
secret: app.secret
}
}, function (err2, res2, body) {

View file

@ -24,6 +24,7 @@ class Level {
this.diamonds = levelInfo[18] < 2 ? 0 : parseInt(levelInfo[18]) + 2
this.featured = levelInfo[19] > 0
this.epic = levelInfo[42] == 1
this.gameVersion = levelInfo[13] > 17 ? levelInfo[13] / 10 : Number('1.' + (levelInfo[13]-1))
if (levelInfo[28]) this.uploaded = levelInfo[28] + config.timestampSuffix
if (levelInfo[29]) this.updated = levelInfo[29] + config.timestampSuffix
this.version = levelInfo[5];

View file

@ -80,10 +80,10 @@
<p><a href="#levelleaderboard"><u>Level Leaderboards</u></a> <i>/api/leaderboardLevel/levelID</i></p>
<p><a href="#comments"><u>Comments & Posts</u></a> <i>/api/comments/level-or-user-ID</i></p>
<p><a href="#analyze"><u>Level Analysis</u></a> <i>/api/analyze/levelID</i></p>
<p><a href="#commenting"><u>Commenting</u></a> <i>/api/postComment (POST)</i></p>
<p><a href="#profileposting"><u>Profile Posting</u></a> <i>/api/postProfileComment (POST)</i></p>
<p><a href="#commenting"><u>Commenting</u></a> <i>/postComment (POST)</i></p>
<p><a href="#profileposting"><u>Profile Posting</u></a> <i>/postProfileComment (POST)</i></p>
<p><a href="#messages"><u>Messages</u></a> <i>/messages (4 different POSTs)</i></p>
<p><a href="#liking"><u>Liking</u></a> <i>/api/like (POST)</i></p>
<p><a href="#liking"><u>Liking</u></a> <i>/like (POST)</i></p>
<p><a href="#icons"><u>Icons</u></a> <i>/icon/username</i></p>
</quote>
<br>
@ -132,6 +132,7 @@
<p>diamonds: Amount of diamonds received for beating the level (stars + 2)</p>
<p>featured: Whether the level is featured or not</p>
<p>epic: Whether the level has an "epic" rating or not</p>
<p>gameVersion: The version of GD the level was released on (1.9, 2.1, etc)</p>
<p>version: Number of times the level was updated</p>
<p>copiedID: The original level ID, if the level was copied. Otherwise returns 0</p>
<p>officialSong: The level number of the song, if no custom song is used. Otherwise returns 0</p>
@ -442,7 +443,7 @@
<p class="red">accountID: The commenter's account ID</p>
<p class="red">form: The form of the commenter's icon</p>
<p class="red">percent: The commenter's percent on the level, if provided</p>
<p class="red">modColor: If the commenter is an elder mod and gets fancy green text</p>
<p class="red">moderator: If type of moderator the commenter is. Returns 0 (none), 1 (mod) or 2 (elder, green text)</p></p>
</div>
<br>
@ -530,7 +531,7 @@
<p class="reveal" onclick="$('#request-commenting').slideToggle(100)"><b>Example</b></p>
<div class="subdiv" id="request-commenting">
<p><b>Example Request</b></p>
<p>POST /api/postComment<br>
<p>POST /postComment<br>
?comment=This is a nifty comment!<br>
&username=colon<br>
&accountID=106255<br>
@ -549,7 +550,7 @@
<div id="profileposting" class="anchor"></div>
<div class="main-block">
<h1>Profile Posting</h1>
<p>POST: /api/postProfileComment</p>
<p>POST: /postProfileComment</p>
<p>Leaves a profile post. This one is a POST request!</p>
@ -568,7 +569,7 @@
<p class="reveal" onclick="$('#request-profileposting').slideToggle(100)"><b>Example</b></p>
<div class="subdiv" id="request-profileposting">
<p><b>Example Requests</b></p>
<p>POST /api/postProfileComment<br>
<p>POST /postProfileComment<br>
?comment=Update 2.0 is revolution!<br>
&username=viprin<br>
&accountID=2795<br>
@ -586,7 +587,7 @@
<div id="liking" class="anchor"></div>
<div class="main-block">
<h1>Liking</h1>
<p>POST: /api/like</p>
<p>POST: /like</p>
<p>Likes/dislikes level, comment, or post. This one is a POST request!</p>
@ -607,7 +608,7 @@
<div class="subdiv" id="request-liking">
<p><b>Example Request</b></p>
<p>Drop a like on RobTop's popular "can you handle the kappa" comment:</p>
<p>POST /api/like<br>
<p>POST /like<br>
?id=42602304 (ID of the comment)<br>
&like=1 (thumbs up)<br>
&type=2 (liking a comment)<br>
@ -683,7 +684,7 @@
<br>
<p>Send "Hello!" to Tubular9:</p>
<p>POST /deleteMessage<br>
<p>POST /sendMessage<br>
?accountID=106255<br>
&password=KitsuneColon333<br>
&subject=Message for you<br>

View file

@ -200,6 +200,7 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
let userName = !history ? x.username : lvl.username
let userLink = encodeURI(userName)
let modNumber = x.moderator || lvl.moderator
if (!compact) {
////// NORMAL MODE //////
@ -210,11 +211,11 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
<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}`}>
<h2 class="inline gdButton ${x.accountID == "0" ? "green unregistered" : ""}">${userName}</h2></a>
${x.modColor || lvl.moderator == "2" ? `<img class="inline" src="../assets/mod-elder.png" height=18% style="margin-left: 0.6%;">` : ""}
${modNumber ? `<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>
<div class="commentAlign">
<p class="commentText" style="color: rgb(${!history && x.playerID == lvl.authorID ? "255, 255, 75" : x.playerID == "16" ? "50, 255, 255" : x.modColor || lvl.moderator == "2" ? "75, 255, 75" : x.browserColor ? "255, 180, 255" : "255, 255, 255"})">${x.content}</p>
<p class="commentText" style="color: rgb(${!history && x.playerID == lvl.authorID ? "255, 255, 75" : x.playerID == "16" ? "50, 255, 255" : modNumber == 2 ? "75, 255, 75" : x.browserColor ? "255, 180, 255" : "255, 255, 255"})">${x.content}</p>
</div>
</div>
<p class="commentDate">${x.date}</p>
@ -236,11 +237,11 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
<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}`}>
<h2 class="inline gdButton ${x.accountID == "0" ? "green unregistered" : ""}">${userName}</h2></a>
${x.modColor || lvl.moderator == "2" ? `<img class="inline" src="../assets/mod-elder.png" height=18% style="margin-left: 0.6%;">` : ""}
${modNumber ? `<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>
<div class="commentAlign">
<p class="commentText" style="color: rgb(${!history && x.playerID == lvl.authorID ? "255, 255, 75" : x.playerID == "16" ? "50, 255, 255" : x.modColor || lvl.moderator == "2" ? "75, 255, 75" : x.browserColor ? "255, 180, 255" : "255, 255, 255"})">${x.content}</p>
<p class="commentText" style="color: rgb(${!history && x.playerID == lvl.authorID ? "255, 255, 75" : x.playerID == "16" ? "50, 255, 255" : modNumber == "2" ? "75, 255, 75" : x.browserColor ? "255, 180, 255" : "255, 255, 255"})">${x.content}</p>
</div>
</div>
<p class="commentDate compactDate">${x.date}</p>

View file

@ -20,6 +20,7 @@
<span style="color:lime">[[NAME]]</span><br>
ID: <span style="color:yellow">[[ID]]</span>[[ORIGINALINFO]][[LOWDETAIL]][[PASS]][[UPLOAD]][[UPDATE]]
<br>Version: <span style="color:yellow">[[VERSION]]</span>
<br>GD Version: <span style="color:yellow">[[GAMEVERSION]]</span>
[[OBJECTINFO]][[REQUESTED]]
</p>
<img src="../assets/ok.png" width=20%; class="gdButton center closeWindow">

View file

@ -108,12 +108,16 @@
<div class="center" style="margin: 1.5% auto 2.5% auto;">
<a id="msgA" target="_blank"><img src="../assets/messages.png" height="10%" id="msgButton" class="sideSpace gdButton" onclick="$('#settingsDiv').show()"></a>
<img src="../assets/friends.png" height="10%" id="friendButton" class="sideSpace gdButton" onclick="$('#settingsDiv').show()">
<a href="../search/[[USERNAME]]?user"><img height="10%" src="../assets/levels.png" class="sideSpace gdButton"></a>
</div>
<div style="position: absolute; bottom: 0%; left: 5%">
<p style="text-align: left; font-size: 2.2vh; color: rgba(0, 0, 0, 0.5)">Account ID: [[ACCOUNTID]]<br>Player ID: [[PLAYERID]]</p>
</div>
<!-- <img src="../assets/follow-off.png" class="gdButton" style="position: absolute; left: 0.5%; bottom: 1%; width: 6%"> -->
<a id="commentA"><img src="../assets/comments.png" class="gdButton" id="commentButton" style="position: absolute; right: 0.5%; bottom: 50%; width: 6%" onclick="$('#settingsDiv').show()"></a>
<a href="../search/[[USERNAME]]?user"><img src="../assets/levels.png" class="gdButton" style="position: absolute; right: 0.5%; bottom: 1%; width: 6%"></a>
<div style="position: absolute; right: 0.5%; top: 0%; width: 6%">
<a id="youtube" style="display: none" target="_blank" href="https://youtube.com/channel/[[YOUTUBE]]"><img src="../assets/youtube.png" class="gdButton socialButton"></a>
@ -133,7 +137,7 @@
<img class="gdButton" src="../assets/arrow-right.png" height="95%" onclick="page += 1; appendComments()">
</div>
<div id="postButton" style="position:absolute;bottom: 0%;right: 0%;width: 14%;text-align: right;transform: translate(30%, 40%);">
<div id="postButton" style="position:absolute; bottom: 0%; left: 0%; width: 14%; text-align: left; transform: translate(-35%, 40%);">
<img class="gdButton" src="../assets/comment.png" width="60%" onclick="$('#content').trigger('input'); $('#leavePost').show();">
</div>

View file

@ -34,13 +34,13 @@ try {
const secrets = require("./misc/secretStuff.json")
app.id = secrets.id
app.gjp = secrets.gjp
if (app.id == "account id goes here" || app.gjp == "account gjp goes here") console.log("Warning: No account ID and/or GJP has been provided in secretStuff.json! These are required for level leaderboards to work.")
if (app.id == "account id goes here" || app.gjp == "account gjp goes here") console.warn("Warning: No account ID and/or GJP has been provided in secretStuff.json! These are required for level leaderboards to work.")
}
catch(e) {
app.id = 0
app.gjp = 0
console.log("Warning: secretStuff.json has not been created! These are required for level leaderboards to work.")
console.warn("Warning: secretStuff.json has not been created! These are required for level leaderboards to work.")
}
app.parseResponse = function (responseBody, splitter) {

View file

@ -21,7 +21,7 @@
"header": "Level Analyzing Help",
"name": "Alten",
"youtube": ["https://youtube.com/channel/UC9M8hLqh2yZIPSDvpyL7o8g", "youtube"],
"twitter": ["https://twitter.com/gd_alten", "twitter"],
"twitter": ["https://twitter.com/altenhh", "twitter"],
"github": ["https://github.com/Altenhh", "github"]
},