gj-boomlings-api 1.4.6 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.json +1 -10
- package/functions/blockUser.js +8 -2
- package/functions/deleteAccountPost.js +8 -2
- package/functions/deleteLevel.js +7 -1
- package/functions/dlLevel.js +5 -1
- package/functions/dlMessage.js +9 -2
- package/functions/getAccountPosts.js +8 -2
- package/functions/getBlockedList.js +6 -1
- package/functions/getCommentHistory.js +10 -3
- package/functions/getComments.js +9 -2
- package/functions/getCreatorScores.js +6 -2
- package/functions/getDailyLevel.js +3 -0
- package/functions/getFriendsList.js +6 -1
- package/functions/getGauntlets.js +6 -2
- package/functions/getLevelByID.js +153 -10
- package/functions/getLevelScores.js +50 -0
- package/functions/getMapPacks.js +7 -2
- package/functions/getMessages.js +9 -2
- package/functions/getOfficialSongInfo.js +4 -0
- package/functions/getProfile.js +5 -1
- package/functions/getSongInfo.js +5 -1
- package/functions/getTab.js +9 -3
- package/functions/getTop100.js +6 -2
- package/functions/getUserLevels.js +8 -2
- package/functions/getWeeklyDemon.js +5 -2
- package/functions/reportLevel.js +7 -1
- package/functions/searchLevels.js +8 -2
- package/functions/searchUsers.js +7 -2
- package/functions/unblockUser.js +7 -1
- package/functions/updateLevelDesc.js +8 -1
- package/functions/uploadAccountPost.js +7 -1
- package/functions/uploadComment.js +22 -14
- package/functions/uploadMessage.js +9 -1
- package/index.js +1 -35
- package/misc/GJDecode.js +1 -0
- package/misc/colors.json +1 -44
- package/misc/decB64.js +1 -2
- package/misc/encB64.js +1 -3
- package/misc/officialsongs.json +1 -216
- package/misc/rgbToHEX.js +1 -0
- package/package.json +1 -1
- package/misc/decCommentFromHistory.js +0 -38
- package/misc/decMessage.js +0 -34
- package/misc/decMsg.js +0 -30
- package/misc/decScoresUser.js +0 -45
- package/misc/decodeAccountPost.js +0 -23
- package/misc/decodeGJComment.js +0 -36
- package/misc/decodeGJGauntlet.js +0 -43
- package/misc/decodeLevel.js +0 -144
- package/misc/decodeLevelRes.js +0 -118
- package/misc/decodeMapPack.js +0 -54
- package/misc/decodeUserResult.js +0 -41
package/config.json
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"headers": {
|
|
3
|
-
"Content-Type":"application/x-www-form-urlencoded",
|
|
4
|
-
"user-agent":"",
|
|
5
|
-
"Accept-Encoding":"*",
|
|
6
|
-
"Accept":"*/*"
|
|
7
|
-
},
|
|
8
|
-
"server":"http://www.boomlings.com/database/",
|
|
9
|
-
"secret":"Wmfd2893gb7"
|
|
10
|
-
}
|
|
1
|
+
{"headers":{"Content-Type":"application/x-www-form-urlencoded","user-agent":"","Accept-Encoding":"*","Accept":"*/*"},"server":"http://www.boomlings.com/database/","secret":"Wmfd2893gb7"}
|
package/functions/blockUser.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Blocks the specified user.
|
|
4
|
+
* @param {*} target - Target's player ID or username.
|
|
5
|
+
* @param {*} username - Blocking person's player ID or username.
|
|
6
|
+
* @param {*} password - Blocking person's password.
|
|
7
|
+
*/
|
|
2
8
|
blockUser:
|
|
3
9
|
async function(target, username, password) {
|
|
4
10
|
if(!target) throw new Error("Please provide a target's player ID or username!");
|
|
@@ -24,9 +30,9 @@ module.exports = {
|
|
|
24
30
|
let res = await gjReq("blockGJUser20", data);
|
|
25
31
|
if(res.data == -1) throw new Error(-1);
|
|
26
32
|
|
|
27
|
-
if(res.data
|
|
33
|
+
if(res.data == "error code: 1005") res = await gjWReq("blockUser", `${target}?user=${username}&password=${password}`);
|
|
28
34
|
if(res.status == 403) throw new Error(res.data.error);
|
|
29
35
|
|
|
30
|
-
return
|
|
36
|
+
return res.data;
|
|
31
37
|
}
|
|
32
38
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Deletes the account post, specified by its ID (returned by `uploadAccountPost()` function).
|
|
4
|
+
* @param {*} id - The account post ID.
|
|
5
|
+
* @param {*} str - Deleting person's player ID or username.
|
|
6
|
+
* @param {*} password - Deleting person's password.
|
|
7
|
+
*/
|
|
2
8
|
deleteAccountPost:
|
|
3
9
|
async function(id, str, password) {
|
|
4
10
|
if(!id) throw new Error("Please provide an account post ID!");
|
|
@@ -24,9 +30,9 @@ module.exports = {
|
|
|
24
30
|
let res = await gjReq("deleteGJAccComment20", data);
|
|
25
31
|
if(res.data == -1) throw new Error(-1);
|
|
26
32
|
|
|
27
|
-
if(res.data
|
|
33
|
+
if(res.data == "error code: 1005") res = await gjWReq("deleteAccountPost", `?id=${id}&user=${str}&password=${password}`);
|
|
28
34
|
if(res.status == 403) throw new Error(res.data.error);
|
|
29
35
|
|
|
30
|
-
return
|
|
36
|
+
return res.data;
|
|
31
37
|
}
|
|
32
38
|
}
|
package/functions/deleteLevel.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Deletes the specified level.
|
|
4
|
+
* @param {*} lvl - The ID of a level to delete.
|
|
5
|
+
* @param {*} str - The username or player ID of a creator.
|
|
6
|
+
* @param {*} password - The password of a creator.
|
|
7
|
+
*/
|
|
2
8
|
deleteLevel:
|
|
3
9
|
async function(lvl, str, password) {
|
|
4
10
|
if(!lvl) throw new Error("Please provide a level ID!");
|
|
@@ -22,7 +28,7 @@ module.exports = {
|
|
|
22
28
|
let res = await gjReq("deleteGJLevelUser20", data);
|
|
23
29
|
if(res.data == -1) throw new Error(-1);
|
|
24
30
|
|
|
25
|
-
if(res.data
|
|
31
|
+
if(res.data == "error code: 1005") res = await gjWReq("deleteLevel", `${lvl}?user=${str}&password=${password}`);
|
|
26
32
|
if(res.status == 403) throw new Error(res.data.error);
|
|
27
33
|
|
|
28
34
|
return res.data;
|
package/functions/dlLevel.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Downloads the level.
|
|
4
|
+
* @param {*} level - The level ID to download.
|
|
5
|
+
*/
|
|
2
6
|
dlLevel:
|
|
3
7
|
async function(level) {
|
|
4
8
|
const {decB64} = require("../misc/decB64.js");
|
|
@@ -21,7 +25,7 @@ module.exports = {
|
|
|
21
25
|
let res = await gjReq('downloadGJLevel22', data);
|
|
22
26
|
if(res.data == -1) throw new Error("-1 This level is not found.");
|
|
23
27
|
|
|
24
|
-
if(res.data
|
|
28
|
+
if(res.data == "error code: 1005") {
|
|
25
29
|
res = await gjWReq("dlLevel", level);
|
|
26
30
|
if(res.status == 403) throw new Error(res.data.error);
|
|
27
31
|
return res.data;
|
package/functions/dlMessage.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Downloads the message specified by its ID.
|
|
4
|
+
* @param {*} id - The message ID.
|
|
5
|
+
* @param {*} user - The downloading person's player ID or username.
|
|
6
|
+
* @param {*} pass - The downloading person's password.
|
|
7
|
+
*/
|
|
2
8
|
dlMessage:
|
|
3
9
|
async function(id, user, pass) {
|
|
4
10
|
if(!id) throw new Error("Please provide a message ID!");
|
|
@@ -11,7 +17,8 @@ module.exports = {
|
|
|
11
17
|
const {secret} = require("../config.json");
|
|
12
18
|
const { searchUsers } = require("./searchUsers.js");
|
|
13
19
|
const {gjp} = require("../misc/gjp.js");
|
|
14
|
-
|
|
20
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
21
|
+
let {decMessage} = GJDecode();
|
|
15
22
|
|
|
16
23
|
let userObj = await searchUsers(user);
|
|
17
24
|
|
|
@@ -25,7 +32,7 @@ module.exports = {
|
|
|
25
32
|
let res = await gjReq("downloadGJMessage20", data);
|
|
26
33
|
if(res.data == -1) throw new Error(-1);
|
|
27
34
|
|
|
28
|
-
if(res.data
|
|
35
|
+
if(res.data == "error code: 1005") {
|
|
29
36
|
res = await gjWReq("dlMessage", `${id}?user=${user}&password=${pass}`);
|
|
30
37
|
if(res.status == 403) throw new Error(res.data.error);
|
|
31
38
|
return res.data;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the list of account posts of a specified user.
|
|
4
|
+
* @param {*} str - The user's name.
|
|
5
|
+
* @param {*} page - The page.
|
|
6
|
+
*/
|
|
2
7
|
getAccountPosts:
|
|
3
8
|
async function(str, page = 1) {
|
|
4
9
|
if(!str) throw new Error("Please provide a user ID or name!");
|
|
5
|
-
|
|
10
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
11
|
+
const { decodeAccountPost } = new GJDecode();
|
|
6
12
|
const {gjReq} = require("../misc/gjReq.js");
|
|
7
13
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
8
14
|
const { searchUsers } = require("./searchUsers.js");
|
|
@@ -19,7 +25,7 @@ module.exports = {
|
|
|
19
25
|
if(res.data == -1) throw new Error("-1 Not found.");
|
|
20
26
|
if(res.data.startsWith("#")) throw new Error("Whoops! Couldn't find anything!");
|
|
21
27
|
|
|
22
|
-
if(res.data
|
|
28
|
+
if(res.data == "error code: 1005") {
|
|
23
29
|
res = await gjWReq("getAccountPosts", `${str}?page=${page}`);
|
|
24
30
|
if(res.status == 403) throw new Error(res.data.error);
|
|
25
31
|
return res.data;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the list of people blocked by a specified user.
|
|
4
|
+
* @param {*} str - The user's name or player ID.
|
|
5
|
+
* @param {*} pass - The user's pass.
|
|
6
|
+
*/
|
|
2
7
|
getBlockedList:
|
|
3
8
|
async function(str, pass) {
|
|
4
9
|
if(!str) throw new Error("Please provide your player ID or username!");
|
|
@@ -22,7 +27,7 @@ module.exports = {
|
|
|
22
27
|
if(res.data == -1) throw new Error(-1);
|
|
23
28
|
if(res.data == -2) throw new Error("No players have been found in the blocklist.");
|
|
24
29
|
|
|
25
|
-
if(res.data
|
|
30
|
+
if(res.data == "error code: 1005") {
|
|
26
31
|
res = await gjWReq("getBlockedList", `${str}?password=${pass}`);
|
|
27
32
|
if(res.status == 403) throw new Error(res.data.error);
|
|
28
33
|
return res.data;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the comment history of a specified user.
|
|
4
|
+
* @param {*} str - The user's name or player ID.
|
|
5
|
+
* @param {*} page - The page.
|
|
6
|
+
* @param {*} mode - The mode of fetching the history. `0` is for recent, `1` is for most liked.
|
|
7
|
+
*/
|
|
2
8
|
getCommentHistory:
|
|
3
9
|
async function(str, page = 1, mode = 1) {
|
|
4
10
|
if(!str) throw new Error("Please provide a player ID or name!");
|
|
5
11
|
if(page && isNaN(page)) throw new Error("Please provide a page!");
|
|
6
|
-
if(mode && isNaN(mode)) throw new Error("Please provide a mode ID! 0 for recent, 1 for most liked.");
|
|
12
|
+
if(mode && isNaN(mode)) throw new Error("Please provide a valid mode ID! 0 for recent, 1 for most liked.");
|
|
7
13
|
|
|
8
14
|
const {gjReq} = require("../misc/gjReq.js");
|
|
9
15
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
10
|
-
|
|
16
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
17
|
+
const {decCommentFromHistory} = new GJDecode();
|
|
11
18
|
const {getProfile} = require("./getProfile.js");
|
|
12
19
|
|
|
13
20
|
const user = await getProfile(str);
|
|
@@ -23,7 +30,7 @@ module.exports = {
|
|
|
23
30
|
let res = await gjReq("getGJCommentHistory", CHData);
|
|
24
31
|
if(res.data == -1) throw new Error("-1 Not found.");
|
|
25
32
|
|
|
26
|
-
if(res.data
|
|
33
|
+
if(res.data == "error code: 1005") {
|
|
27
34
|
res = await gjWReq("getCommentHistory", `${str}?page=${page}&mode=${mode}`);
|
|
28
35
|
if(res.status == 403) throw new Error(res.data.error);
|
|
29
36
|
return res.data;
|
package/functions/getComments.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the comments from a specified level.
|
|
4
|
+
* @param {*} level - The level ID to get the comments from.
|
|
5
|
+
* @param {*} page - The page.
|
|
6
|
+
* @param {*} mode - The mode of fetching the comments. `0` is for recent, `1` is for most liked.
|
|
7
|
+
*/
|
|
2
8
|
getComments:
|
|
3
9
|
async function(level, page = 1, mode = 1) {
|
|
4
10
|
if(!level) throw new Error("Please provide a level ID!");
|
|
@@ -7,7 +13,8 @@ module.exports = {
|
|
|
7
13
|
|
|
8
14
|
const {gjReq} = require("../misc/gjReq.js");
|
|
9
15
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
10
|
-
|
|
16
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
17
|
+
const { decodeGJComment } = new GJDecode();
|
|
11
18
|
|
|
12
19
|
const data = {
|
|
13
20
|
levelID: level,
|
|
@@ -19,7 +26,7 @@ module.exports = {
|
|
|
19
26
|
let res = await gjReq("getGJComments21", data);
|
|
20
27
|
if(res.data.startsWith("#")) throw new Error("-1 No comments have been found.");
|
|
21
28
|
|
|
22
|
-
if(res.data
|
|
29
|
+
if(res.data == "error code: 1005") {
|
|
23
30
|
res = await gjWReq("getComments", `${level}?page=${page}&mode=${mode}`);
|
|
24
31
|
if(res.status == 403) throw new Error(res.data.error);
|
|
25
32
|
return res.data;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the top creators leaderboard.
|
|
4
|
+
*/
|
|
2
5
|
getCreatorScores:
|
|
3
6
|
async function() {
|
|
4
|
-
|
|
7
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
8
|
+
const { decScoresUser } = new GJDecode();
|
|
5
9
|
const {gjReq} = require("../misc/gjReq.js");
|
|
6
10
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
7
11
|
const { secret } = require("../config.json");
|
|
@@ -13,7 +17,7 @@ module.exports = {
|
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
let res = await gjReq("getGJScores20", data);
|
|
16
|
-
if(res.data
|
|
20
|
+
if(res.data == "error code: 1005") {
|
|
17
21
|
res = await gjWReq("getCreatorScores");
|
|
18
22
|
return res.data;
|
|
19
23
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the list of specified user's friends.
|
|
4
|
+
* @param {*} str - The user's name or player ID.
|
|
5
|
+
* @param {*} pass - The user's pass.
|
|
6
|
+
*/
|
|
2
7
|
getFriendsList:
|
|
3
8
|
async function(str, pass) {
|
|
4
9
|
if(!str) throw new Error("Please provide your player ID or username!");
|
|
@@ -21,7 +26,7 @@ module.exports = {
|
|
|
21
26
|
if(res.data == -1) throw new Error(-1);
|
|
22
27
|
if(res.data == -2) throw new Error("No players have been found in the friends list.");
|
|
23
28
|
|
|
24
|
-
if(res.data
|
|
29
|
+
if(res.data == "error code: 1005") {
|
|
25
30
|
res = await gjWReq("getFriendsList", `${str}?password=${pass}`);
|
|
26
31
|
if(res.status == 403) throw new Error(res.data.error);
|
|
27
32
|
return res.data;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the gauntlets.
|
|
4
|
+
*/
|
|
2
5
|
getGauntlets:
|
|
3
6
|
async function() {
|
|
4
7
|
const {gjReq} = require("../misc/gjReq.js");
|
|
5
8
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
6
|
-
|
|
9
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
10
|
+
const { decodeGJGauntlet } = new GJDecode();
|
|
7
11
|
|
|
8
12
|
const data = {
|
|
9
13
|
secret: "Wmfd2893gb7"
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
let res = await gjReq("getGJGauntlets21", data)
|
|
13
|
-
if(res.data
|
|
17
|
+
if(res.data == "error code: 1005") {
|
|
14
18
|
res = await gjWReq("getGauntlets");
|
|
15
19
|
return res.data;
|
|
16
20
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the basic level info by its ID.
|
|
4
|
+
*
|
|
5
|
+
* It's the same as dlLevel(), but it works faster and doesn't provide the password, update date, upload date, the info about LDM and an accurate object counter.
|
|
6
|
+
*
|
|
7
|
+
* By the way, GD uses this for search results.
|
|
8
|
+
* @param {*} id - The level ID.
|
|
9
|
+
*/
|
|
2
10
|
getLevelByID:
|
|
3
|
-
async function(id) {
|
|
4
|
-
if(!id) throw new Error("Please provide a level ID!");
|
|
5
|
-
if(isNaN(id)) throw new Error("The level ID should be a number!");
|
|
11
|
+
async function (id) {
|
|
12
|
+
if (!id) throw new Error("Please provide a level ID!");
|
|
13
|
+
if (isNaN(id)) throw new Error("The level ID should be a number!");
|
|
6
14
|
|
|
7
|
-
const {
|
|
8
|
-
const {
|
|
9
|
-
const {
|
|
10
|
-
const {
|
|
15
|
+
const { gjReq } = require("../misc/gjReq.js");
|
|
16
|
+
const { gjWReq } = require("../misc/gjWReq.js");
|
|
17
|
+
const { secret } = require("../config.json");
|
|
18
|
+
const { decB64 } = require("../misc/decB64.js");
|
|
11
19
|
|
|
12
20
|
const data = {
|
|
13
21
|
secret: secret,
|
|
@@ -16,14 +24,149 @@ module.exports = {
|
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
let res = await gjReq("getGJLevels21", data);
|
|
19
|
-
if(res.data == -1) throw new Error("-1 Not found.");
|
|
27
|
+
if (res.data == -1) throw new Error("-1 Not found.");
|
|
20
28
|
|
|
21
|
-
if(res.data
|
|
29
|
+
if (res.data == "error code: 1005") {
|
|
22
30
|
res = await gjWReq("getLevelByID", id);
|
|
23
|
-
if(res.status == 403) throw new Error(res.data.error);
|
|
31
|
+
if (res.status == 403) throw new Error(res.data.error);
|
|
24
32
|
return res.data;
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
async function decodeLevel(l) {
|
|
36
|
+
let spl = l.split(':');
|
|
37
|
+
let lInfo = [];
|
|
38
|
+
for (let i = 0; i < spl.length; i++) {
|
|
39
|
+
if (i % 2 != 0) {
|
|
40
|
+
lInfo.push(spl[i - 1] + `:` + spl[i]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let id = lInfo[0].split("1:")[1];
|
|
45
|
+
let name = lInfo[1].split("2:")[1];
|
|
46
|
+
let version = lInfo[2].split("5:")[1];
|
|
47
|
+
let difficulty = lInfo[5].split("9:")[1];
|
|
48
|
+
let downloads = lInfo[6].split("10:")[1];
|
|
49
|
+
let officialSong = lInfo[7].split("12:")[1];
|
|
50
|
+
let gameVersion = lInfo[8].split("13:")[1];
|
|
51
|
+
let likes = lInfo[9].split("14:")[1];
|
|
52
|
+
let demonBool = lInfo[10].split("17:")[1];
|
|
53
|
+
let stars = lInfo[13].split("18:")[1];
|
|
54
|
+
let ftrd = lInfo[14].split("19:")[1];
|
|
55
|
+
let epic = lInfo[15].split("42:")[1];
|
|
56
|
+
let objs = lInfo[16].split("45:")[1];
|
|
57
|
+
let desc = lInfo[17].split("3:")[1];
|
|
58
|
+
let length = lInfo[18].split("15:")[1];
|
|
59
|
+
let copiedID = lInfo[19].split("30:")[1];
|
|
60
|
+
let twoPlayer = lInfo[20].split("31:")[1];
|
|
61
|
+
let coins = lInfo[21].split("37:")[1];
|
|
62
|
+
let verifiedCoins = lInfo[22].split("38:")[1];
|
|
63
|
+
let starsRequested = lInfo[23].split("39:")[1];
|
|
64
|
+
let customSong = lInfo[26].split("35:")[1].split("#")[0];
|
|
65
|
+
let author = lInfo.length == 29 ? lInfo[27].split(":")[0] : "-";
|
|
66
|
+
|
|
67
|
+
let disliked = likes.includes("-") ? true : false;
|
|
68
|
+
|
|
69
|
+
if (desc.includes("/")) desc = desc.split("/")[0];
|
|
70
|
+
if (decB64(desc) == '') desc = "KE5vIGRlc2NyaXB0aW9uIHByb3ZpZGVkKQ=="
|
|
71
|
+
|
|
72
|
+
let featured = Boolean(Number(ftrd));
|
|
73
|
+
|
|
74
|
+
let difficultyDecoding = {
|
|
75
|
+
"-10": "Auto",
|
|
76
|
+
"0": "Unrated",
|
|
77
|
+
"10": "Easy",
|
|
78
|
+
"20": "Normal",
|
|
79
|
+
"30": "Hard",
|
|
80
|
+
"40": "Harder",
|
|
81
|
+
"50": "Insane"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (Boolean(Number(demonBool))) {
|
|
85
|
+
difficultyDecoding = {
|
|
86
|
+
"10": "Easy Demon",
|
|
87
|
+
"20": "Medium Demon",
|
|
88
|
+
"30": "Hard Demon",
|
|
89
|
+
"40": "Insane Demon",
|
|
90
|
+
"50": "Extreme Demon"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const lengthDecoding = {
|
|
95
|
+
"0": "Tiny",
|
|
96
|
+
"1": "Short",
|
|
97
|
+
"2": "Medium",
|
|
98
|
+
"3": "Long",
|
|
99
|
+
"4": "XL"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const decodeGameVersion = {
|
|
103
|
+
"10": "1.7",
|
|
104
|
+
"18": "1.8",
|
|
105
|
+
"19": "1.9",
|
|
106
|
+
"20": "2.0",
|
|
107
|
+
"21": "2.1",
|
|
108
|
+
undefined: "Pre-1.7"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const { getOfficialSongInfo } = require("../functions/getOfficialSongInfo.js");
|
|
112
|
+
|
|
113
|
+
let song;
|
|
114
|
+
if (Number(officialSong) > 0) song = getOfficialSongInfo(Number(officialSong) + 1);
|
|
115
|
+
if (Number(officialSong) == 0 && Number(customSong) == 0) song = getOfficialSongInfo(1);
|
|
116
|
+
if (Number(customSong) > 0) {
|
|
117
|
+
let songName = l.split("~|~2~|~")[1].split("~|~3~|~")[0]
|
|
118
|
+
let songId = Number(l.split("#1~|~")[1].split("~|~2~|~")[0])
|
|
119
|
+
let artist = l.split("~|~4~|~")[1].split("~|~5~|~")[0]
|
|
120
|
+
let artistId = Number(l.split("~|~3~|~")[1].split("~|~4~|~")[0])
|
|
121
|
+
let size = `${l.split("~|~5~|~")[1].split("~|~6~|~")[0]} MB`
|
|
122
|
+
let link = decodeURIComponent(l.split("~|~10~|~")[1].split("~|~7~|~")[0])
|
|
123
|
+
|
|
124
|
+
let songinfo = {
|
|
125
|
+
"name": songName,
|
|
126
|
+
"id": songId,
|
|
127
|
+
"artist": artist,
|
|
128
|
+
"artistId": artistId,
|
|
129
|
+
"fileSize": size,
|
|
130
|
+
"link": link
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
song = songinfo;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let result = {
|
|
137
|
+
id: Number(id),
|
|
138
|
+
name: name,
|
|
139
|
+
description: decB64(desc),
|
|
140
|
+
creator: author,
|
|
141
|
+
level_version: Number(version),
|
|
142
|
+
difficulty: difficultyDecoding[difficulty],
|
|
143
|
+
stars: Number(stars),
|
|
144
|
+
downloads: Number(downloads),
|
|
145
|
+
likes: Number(likes),
|
|
146
|
+
disliked: disliked,
|
|
147
|
+
length: lengthDecoding[length],
|
|
148
|
+
demon: Boolean(Number(demonBool)),
|
|
149
|
+
featured: featured,
|
|
150
|
+
epic: Boolean(Number(epic)),
|
|
151
|
+
objects: Number(objs),
|
|
152
|
+
stars_requested: Number(starsRequested),
|
|
153
|
+
game_version: decodeGameVersion[gameVersion],
|
|
154
|
+
copied: Number(copiedID),
|
|
155
|
+
large: Number(objs) > 40000 ? true : false,
|
|
156
|
+
two_p: Boolean(Number(twoPlayer)),
|
|
157
|
+
coins: Number(coins),
|
|
158
|
+
verified_coins: Boolean(Number(verifiedCoins)),
|
|
159
|
+
song: song
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (["Extreme Demon", "Insane Demon"].includes(difficultyDecoding[difficulty])) {
|
|
163
|
+
const { demonlist } = require("../misc/demonlist.js");
|
|
164
|
+
const dlist = await demonlist(name.trim());
|
|
165
|
+
if (dlist != null) result.pointercrate = dlist;
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
|
|
27
170
|
return await decodeLevel(res.data);
|
|
28
171
|
}
|
|
29
172
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the leaderboard on a level.
|
|
4
|
+
*
|
|
5
|
+
* For some reason, Geometry Dash API requires the login information.
|
|
6
|
+
* @param {*} lvl - The level ID.
|
|
7
|
+
* @param {*} type - The leaderboard type. Possible types: `"week"`, `"top"`, `"friends"`.
|
|
8
|
+
* @param {*} str - The username or a player ID.
|
|
9
|
+
* @param {*} pass - The password.
|
|
10
|
+
*/
|
|
11
|
+
getLevelScores:
|
|
12
|
+
async function(lvl, type, str, pass){
|
|
13
|
+
let types = {"week":"2","top":"1","friends":"0"}
|
|
14
|
+
if(!lvl) throw new Error("Please provide a level ID!");
|
|
15
|
+
if(!types[type.toLowerCase()]) throw new Error("Please provide a valid leaderboard type! Possible types: \"week\", \"top\", \"friends\".")
|
|
16
|
+
if(!str) throw new Error("Please provide a username or a Player ID!");
|
|
17
|
+
if(!pass) throw new Error("Please provide a password!");
|
|
18
|
+
|
|
19
|
+
const {gjReq} = require("../misc/gjReq.js");
|
|
20
|
+
const {gjWReq} = require("../misc/gjWReq.js");
|
|
21
|
+
const { secret } = require("../config.json");
|
|
22
|
+
|
|
23
|
+
const { searchUsers } = require("./searchUsers.js");
|
|
24
|
+
let user = await searchUsers(str);
|
|
25
|
+
|
|
26
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
27
|
+
const {gjp} = require("../misc/gjp.js");
|
|
28
|
+
|
|
29
|
+
let {decodeScore} = new GJDecode();
|
|
30
|
+
|
|
31
|
+
const data = {
|
|
32
|
+
accountID: user.accountID,
|
|
33
|
+
gjp: gjp(pass),
|
|
34
|
+
levelID: lvl,
|
|
35
|
+
secret: secret,
|
|
36
|
+
type: types[type.toLowerCase()]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let res = await gjReq("getGJLevelScores211", data);
|
|
40
|
+
|
|
41
|
+
let scores = res.data.split("|");
|
|
42
|
+
let result = [];
|
|
43
|
+
|
|
44
|
+
scores.forEach(s =>{
|
|
45
|
+
result.push(decodeScore(s));
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
}
|
package/functions/getMapPacks.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the map pack list.
|
|
4
|
+
* @param {*} page - The page.
|
|
5
|
+
*/
|
|
2
6
|
getMapPacks:
|
|
3
7
|
async function(page = 1) {
|
|
4
|
-
|
|
8
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
9
|
+
const { decodeMapPack } = new GJDecode();
|
|
5
10
|
|
|
6
11
|
const {gjReq} = require("../misc/gjReq.js");
|
|
7
12
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
@@ -13,7 +18,7 @@ module.exports = {
|
|
|
13
18
|
let res = await gjReq("getGJMapPacks21", data);
|
|
14
19
|
if(res.data.startsWith("#")) throw new Error("-1 Not found.");
|
|
15
20
|
|
|
16
|
-
if(res.data
|
|
21
|
+
if(res.data == "error code: 1005") {
|
|
17
22
|
res = await gjWReq("getMapPacks", page);
|
|
18
23
|
if(res.status == 403) throw new Error(res.data.error);
|
|
19
24
|
return res.data;
|
package/functions/getMessages.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets user's messages.
|
|
4
|
+
* @param {*} user - The player ID or username.
|
|
5
|
+
* @param {*} pass - The password.
|
|
6
|
+
* @param {*} page - The page.
|
|
7
|
+
*/
|
|
2
8
|
getMessages:
|
|
3
9
|
async function(user, pass, page = 1) {
|
|
4
10
|
if(!user) throw new Error("Please provide your player ID or username!");
|
|
@@ -9,7 +15,8 @@ module.exports = {
|
|
|
9
15
|
const {gjWReq} = require("../misc/gjWReq.js");
|
|
10
16
|
const {secret} = require("../config.json");
|
|
11
17
|
const {gjp} = require("../misc/gjp.js");
|
|
12
|
-
|
|
18
|
+
let GJDecode = require("../misc/GJDecode.js");
|
|
19
|
+
const {decMsg} = new GJDecode();
|
|
13
20
|
const { searchUsers } = require("./searchUsers.js");
|
|
14
21
|
|
|
15
22
|
let userObj = await searchUsers(user);
|
|
@@ -24,7 +31,7 @@ module.exports = {
|
|
|
24
31
|
let res = await gjReq("getGJMessages20", data);
|
|
25
32
|
if(res.data == -1) throw new Error(-1);
|
|
26
33
|
|
|
27
|
-
if(res.data
|
|
34
|
+
if(res.data == "error code: 1005") {
|
|
28
35
|
res = await gjWReq("getMessages", `${user}?password=${pass}&page=${page}`);
|
|
29
36
|
if(res.status == 403) throw new Error(res.data.error);
|
|
30
37
|
return res.data;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets the info about an official song by its ID.
|
|
4
|
+
* @param {*} song - The song ID. 1-21 is main GD, 22-24 is GD Meltdown, 25 is Random Song 06 (The Challenge), 26-35 is GD World.
|
|
5
|
+
*/
|
|
2
6
|
getOfficialSongInfo:
|
|
3
7
|
function(song) {
|
|
4
8
|
if(!song) throw new Error("Please provide a song ID.");
|
package/functions/getProfile.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets a user's profile info.
|
|
4
|
+
* @param {*} str - A user's player ID or username.
|
|
5
|
+
*/
|
|
2
6
|
getProfile:
|
|
3
7
|
async function(str) {
|
|
4
8
|
if(!str) throw new Error("Please provide a user ID or name!");
|
|
@@ -16,7 +20,7 @@ module.exports = {
|
|
|
16
20
|
let res = await gjReq("getGJUserInfo20", data);
|
|
17
21
|
if(res.data == -1) throw new Error("-1 This user is not found.");
|
|
18
22
|
|
|
19
|
-
if(res.data
|
|
23
|
+
if(res.data == "error code: 1005") {
|
|
20
24
|
res = await gjWReq("getProfile", str);
|
|
21
25
|
if(res.status == 403) throw new Error(res.data.error);
|
|
22
26
|
return res.data;
|
package/functions/getSongInfo.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Gets a song info from Newgrounds.
|
|
4
|
+
* @param {*} song - The song ID on Newgrounds.
|
|
5
|
+
*/
|
|
2
6
|
getSongInfo:
|
|
3
7
|
async function(song) {
|
|
4
8
|
if(!song) throw new Error("Please provide a song ID.");
|
|
@@ -14,7 +18,7 @@ module.exports = {
|
|
|
14
18
|
let res = await gjReq('getGJSongInfo', data);
|
|
15
19
|
if(res.data == -2) throw new Error(`-2. Couldn't find a song with ID ${song}.`)
|
|
16
20
|
|
|
17
|
-
if(res.data
|
|
21
|
+
if(res.data == "error code: 1005") {
|
|
18
22
|
res = await gjWReq("getSongInfo", song);
|
|
19
23
|
if(res.status == 403) throw new Error(res.data.error);
|
|
20
24
|
return res.data;
|