gj-boomlings-api 2.0.2 → 2.1.0
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/LICENSE +1 -1
- package/README.md +4 -4
- package/functions/acceptFriendRequest.js +39 -0
- package/functions/blockUser.js +12 -13
- package/functions/deleteAccountPost.js +12 -11
- package/functions/deleteComment.js +11 -12
- package/functions/deleteFriendRequest.js +43 -0
- package/functions/deleteLevel.js +10 -13
- package/functions/deleteMessage.js +37 -0
- package/functions/{dlLevel.js → downloadLevel.js} +46 -38
- package/functions/{dlMessage.js → downloadMessage.js} +9 -8
- package/functions/getAccountPosts.js +3 -4
- package/functions/getBlockedList.js +31 -12
- package/functions/getCommentHistory.js +8 -6
- package/functions/getComments.js +11 -7
- package/functions/getCreatorScores.js +13 -4
- package/functions/getDailyLevel.js +3 -3
- package/functions/getFriendRequests.js +87 -0
- package/functions/getFriendsList.js +25 -11
- package/functions/getGauntlets.js +5 -3
- package/functions/getLevelByID.js +2 -2
- package/functions/getLevelScores.js +22 -21
- package/functions/getMapPacks.js +1 -1
- package/functions/getMessages.js +10 -10
- package/functions/getProfile.js +139 -41
- package/functions/getSongInfo.js +3 -3
- package/functions/getTab.js +2 -2
- package/functions/getTop100.js +1 -1
- package/functions/getTopLists.js +1 -1
- package/functions/getUserLevels.js +3 -3
- package/functions/getWeeklyDemon.js +3 -3
- package/functions/removeFriend.js +40 -0
- package/functions/reportLevel.js +2 -2
- package/functions/searchLevels.js +1 -1
- package/functions/searchLists.js +2 -2
- package/functions/unblockUser.js +13 -14
- package/functions/updateLevelDesc.js +9 -10
- package/functions/uploadAccountPost.js +10 -11
- package/functions/uploadComment.js +15 -15
- package/functions/uploadFriendRequest.js +42 -0
- package/functions/uploadMessage.js +15 -15
- package/index.js +29 -3
- package/misc/GJDecode.js +12 -9
- package/misc/gauntlets.json +13 -1
- package/misc/gjp2.js +5 -0
- package/package.json +1 -1
- /package/{gjReq.js → misc/gjReq.js} +0 -0
- /package/{xor.js → misc/xor.js} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Sends a friend request to another player.
|
|
4
|
+
* @param {string} target - The player receiving the friend request.
|
|
5
|
+
* @param {string} username - The sender's username or player ID.
|
|
6
|
+
* @param {string} password - The sender's password.
|
|
7
|
+
* @param {string} comment - The comment that goes along with the request. Optional.
|
|
8
|
+
* @returns {number} Returns 1 if everything's OK, or -1 if something went wrong.
|
|
9
|
+
*/
|
|
10
|
+
uploadFriendRequest: async function (target, username, password, comment) {
|
|
11
|
+
if (!target) throw new Error("Please specify the target!");
|
|
12
|
+
if (!username) throw new Error("Please provide the username or the player ID!");
|
|
13
|
+
if (!password) throw new Error("Please provide the password!");
|
|
14
|
+
|
|
15
|
+
const { gjReq } = require("../misc/gjReq");
|
|
16
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
17
|
+
|
|
18
|
+
let userSearch = await gjReq("getGJUsers20", {
|
|
19
|
+
str: username,
|
|
20
|
+
secret: "Wmfd2893gb7"
|
|
21
|
+
});
|
|
22
|
+
if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
23
|
+
let userAccID = userSearch.data.split(":")[23];
|
|
24
|
+
|
|
25
|
+
let recSearch = await gjReq("getGJUsers20", {
|
|
26
|
+
str: target,
|
|
27
|
+
secret: "Wmfd2893gb7"
|
|
28
|
+
});
|
|
29
|
+
if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
|
|
30
|
+
let recAccID = recSearch.data.split(":")[23];
|
|
31
|
+
|
|
32
|
+
let res = await gjReq("uploadFriendRequest20", {
|
|
33
|
+
accountID: userAccID,
|
|
34
|
+
toAccountID: recAccID,
|
|
35
|
+
gjp2: gjp2(password),
|
|
36
|
+
comment: comment ? Buffer.from(comment).toString("base64") : "",
|
|
37
|
+
secret: "Wmfd2893gb7"
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return Number(res.data);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -6,43 +6,43 @@ module.exports = {
|
|
|
6
6
|
* @param {string} content - The message content.
|
|
7
7
|
* @param {string} username - The sender's username or player ID.
|
|
8
8
|
* @param {string} password - The sender's password.
|
|
9
|
-
* @returns {number} Returns 1 if everything's OK,
|
|
9
|
+
* @returns {number} Returns 1 if everything's OK, or -1 if something went wrong.
|
|
10
10
|
*/
|
|
11
11
|
uploadMessage: async function (recipient, subject, content, username, password) {
|
|
12
|
-
if (!recipient) throw new Error("Please specify
|
|
13
|
-
if (!subject) throw new Error("Please specify
|
|
14
|
-
if (!content) throw new Error("Please specify
|
|
15
|
-
if (!username) throw new Error("Please provide
|
|
16
|
-
if (!password) throw new Error("Please provide
|
|
12
|
+
if (!recipient) throw new Error("Please specify the message recipient!");
|
|
13
|
+
if (!subject) throw new Error("Please specify the message subject!");
|
|
14
|
+
if (!content) throw new Error("Please specify the message content!");
|
|
15
|
+
if (!username) throw new Error("Please provide the username or the player ID!");
|
|
16
|
+
if (!password) throw new Error("Please provide the password!");
|
|
17
17
|
|
|
18
|
-
const { gjReq } = require("../gjReq");
|
|
19
|
-
const XOR = require("../xor");
|
|
18
|
+
const { gjReq } = require("../misc/gjReq");
|
|
19
|
+
const XOR = require("../misc/xor");
|
|
20
20
|
const xor = new XOR;
|
|
21
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
21
22
|
|
|
22
23
|
let userSearch = await gjReq("getGJUsers20", {
|
|
23
24
|
str: username,
|
|
24
25
|
secret: "Wmfd2893gb7"
|
|
25
26
|
});
|
|
26
|
-
if (userSearch.data == -1) throw new Error(
|
|
27
|
-
let userAccID = userSearch.data.split(":")[
|
|
27
|
+
if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
28
|
+
let userAccID = userSearch.data.split(":")[23];
|
|
28
29
|
|
|
29
30
|
let recSearch = await gjReq("getGJUsers20", {
|
|
30
31
|
str: recipient,
|
|
31
32
|
secret: "Wmfd2893gb7"
|
|
32
33
|
});
|
|
33
|
-
if (recSearch.data == -1) throw new Error(
|
|
34
|
-
let recAccID = recSearch.data.split(":")[
|
|
34
|
+
if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
|
|
35
|
+
let recAccID = recSearch.data.split(":")[23];
|
|
35
36
|
|
|
36
37
|
let res = await gjReq("uploadGJMessage20", {
|
|
37
38
|
accountID: userAccID,
|
|
38
39
|
toAccountID: recAccID,
|
|
39
|
-
|
|
40
|
+
gjp2: gjp2(password),
|
|
40
41
|
subject: Buffer.from(subject).toString("base64"),
|
|
41
42
|
body: xor.encrypt(content, 14251),
|
|
42
43
|
secret: "Wmfd2893gb7"
|
|
43
44
|
});
|
|
44
|
-
if (res.data == -1) throw new Error(-1);
|
|
45
45
|
|
|
46
|
-
return res.data;
|
|
46
|
+
return Number(res.data);
|
|
47
47
|
}
|
|
48
48
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { downloadLevel } = require("./functions/downloadLevel");
|
|
2
2
|
const { getProfile } = require("./functions/getProfile");
|
|
3
3
|
const { getSongsLibrary } = require("./functions/getSongsLibrary");
|
|
4
4
|
const { getSongInfo } = require("./functions/getSongInfo");
|
|
@@ -13,7 +13,7 @@ const { getTop100 } = require("./functions/getTop100");
|
|
|
13
13
|
const { reportLevel } = require("./functions/reportLevel");
|
|
14
14
|
const { uploadMessage } = require("./functions/uploadMessage");
|
|
15
15
|
const { getMessages } = require("./functions/getMessages");
|
|
16
|
-
const {
|
|
16
|
+
const { downloadMessage } = require("./functions/downloadMessage");
|
|
17
17
|
const { getBlockedList } = require("./functions/getBlockedList");
|
|
18
18
|
const { getFriendsList } = require("./functions/getFriendsList");
|
|
19
19
|
const { deleteLevel } = require("./functions/deleteLevel");
|
|
@@ -33,4 +33,30 @@ const { deleteComment } = require("./functions/deleteComment");
|
|
|
33
33
|
const { getCommentHistory } = require("./functions/getCommentHistory");
|
|
34
34
|
const { getLevelScores } = require("./functions/getLevelScores");
|
|
35
35
|
const { uploadComment } = require("./functions/uploadComment");
|
|
36
|
-
|
|
36
|
+
const { uploadFriendRequest } = require("./functions/uploadFriendRequest");
|
|
37
|
+
const { deleteFriendRequest } = require("./functions/deleteFriendRequest");
|
|
38
|
+
const { getFriendRequests } = require("./functions/getFriendRequests");
|
|
39
|
+
const { acceptFriendRequest } = require("./functions/acceptFriendRequest");
|
|
40
|
+
const { removeFriend } = require("./functions/removeFriend");
|
|
41
|
+
const { deleteMessage } = require("./functions/deleteMessage");
|
|
42
|
+
|
|
43
|
+
const dlLevel = downloadLevel;
|
|
44
|
+
const dlMessage = downloadMessage;
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
dlLevel, dlMessage, // aliases
|
|
48
|
+
downloadLevel, getProfile, getSongsLibrary,
|
|
49
|
+
getSongInfo, getAccountPosts, getGauntlets,
|
|
50
|
+
getMapPacks, getOfficialSongInfo, getDailyLevel,
|
|
51
|
+
getWeeklyDemon, getCreatorScores, getTop100,
|
|
52
|
+
reportLevel, uploadMessage, getMessages,
|
|
53
|
+
downloadMessage, getBlockedList, getFriendsList,
|
|
54
|
+
deleteLevel, blockUser, unblockUser,
|
|
55
|
+
uploadAccountPost, deleteAccountPost, updateLevelDesc,
|
|
56
|
+
getLevelByID, searchLevels, getComments,
|
|
57
|
+
getTopLists, searchLists, getTab,
|
|
58
|
+
getUserLevels, deleteComment, getCommentHistory,
|
|
59
|
+
getLevelScores, uploadComment, uploadFriendRequest,
|
|
60
|
+
deleteFriendRequest, getFriendRequests, acceptFriendRequest,
|
|
61
|
+
removeFriend, deleteMessage
|
|
62
|
+
};
|
package/misc/GJDecode.js
CHANGED
|
@@ -18,18 +18,21 @@ module.exports = class GJDecode {
|
|
|
18
18
|
return {
|
|
19
19
|
name: s[1],
|
|
20
20
|
playerID: Number(s[3]),
|
|
21
|
-
accountID: Number(s[
|
|
21
|
+
accountID: Number(s[23]),
|
|
22
22
|
rank: Number(s[9]),
|
|
23
|
-
stars: Number(s[
|
|
24
|
-
diamonds: Number(s[
|
|
23
|
+
stars: Number(s[25]),
|
|
24
|
+
diamonds: Number(s[31]),
|
|
25
25
|
secretCoins: Number(s[5]),
|
|
26
26
|
userCoins: Number(s[7]),
|
|
27
|
-
demons: Number(s[
|
|
28
|
-
moons: Number(s[
|
|
29
|
-
creatorPoints: Number(s[
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
demons: Number(s[33]),
|
|
28
|
+
moons: Number(s[27]),
|
|
29
|
+
creatorPoints: Number(s[29]),
|
|
30
|
+
iconID: Number(s[11]),
|
|
31
|
+
color1: rgbToHEX(colors[s[13]]),
|
|
32
|
+
color2: rgbToHEX(colors[s[15]]),
|
|
33
|
+
glow: Boolean(Number(s[21])),
|
|
34
|
+
glowColor: rgbToHEX(colors[s[17]]),
|
|
35
|
+
iconType: iconObj[s[19]]
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
decodeSearchResults(res) {
|
package/misc/gauntlets.json
CHANGED
|
@@ -16,9 +16,14 @@
|
|
|
16
16
|
"15": "Death",
|
|
17
17
|
"16": "Forest",
|
|
18
18
|
"18": "Force",
|
|
19
|
+
"19": "Spooky",
|
|
19
20
|
"21": "Water",
|
|
20
21
|
"22": "Haunted",
|
|
22
|
+
"23": "Acid",
|
|
23
|
+
"25": "Power",
|
|
21
24
|
"29": "Halloween",
|
|
25
|
+
"30": "Treasure",
|
|
26
|
+
"33": "Gem",
|
|
22
27
|
"34": "Inferno",
|
|
23
28
|
"35": "Portal",
|
|
24
29
|
"36": "Strange",
|
|
@@ -32,5 +37,12 @@
|
|
|
32
37
|
"47": "Galaxy",
|
|
33
38
|
"48": "Universe",
|
|
34
39
|
"49": "Discord",
|
|
35
|
-
"50": "Split"
|
|
40
|
+
"50": "Split",
|
|
41
|
+
"51": "NCS I",
|
|
42
|
+
"52": "NCS II",
|
|
43
|
+
"53": "Space",
|
|
44
|
+
"54": "Cosmos",
|
|
45
|
+
"55": "Random",
|
|
46
|
+
"56": "Chance",
|
|
47
|
+
"60": "Love"
|
|
36
48
|
}
|
package/misc/gjp2.js
ADDED
package/package.json
CHANGED
|
File without changes
|
/package/{xor.js → misc/xor.js}
RENAMED
|
File without changes
|