gj-boomlings-api 2.1.0 → 2.1.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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/functions/acceptFriendRequest.js +3 -10
  3. package/functions/blockUser.js +2 -9
  4. package/functions/deleteAccountPost.js +1 -5
  5. package/functions/deleteComment.js +1 -5
  6. package/functions/deleteFriendRequest.js +2 -9
  7. package/functions/deleteLevel.js +1 -4
  8. package/functions/deleteMessage.js +1 -5
  9. package/functions/downloadLevel.js +1 -5
  10. package/functions/downloadMessage.js +1 -5
  11. package/functions/getAccountPosts.js +1 -5
  12. package/functions/getBlockedList.js +1 -5
  13. package/functions/getCommentHistory.js +0 -1
  14. package/functions/getComments.js +1 -2
  15. package/functions/getCreatorScores.js +0 -1
  16. package/functions/getFriendRequests.js +1 -5
  17. package/functions/getFriendsList.js +1 -5
  18. package/functions/getGauntlets.js +1 -1
  19. package/functions/getLevelByID.js +0 -1
  20. package/functions/getLevelScores.js +1 -5
  21. package/functions/getMapPacks.js +1 -5
  22. package/functions/getMessages.js +1 -5
  23. package/functions/getProfile.js +10 -19
  24. package/functions/getSongInfo.js +1 -6
  25. package/functions/getSongsLibrary.js +14 -3
  26. package/functions/getTab.js +1 -2
  27. package/functions/getTop100.js +2 -5
  28. package/functions/getTopLists.js +0 -1
  29. package/functions/getUserLevels.js +1 -5
  30. package/functions/removeFriend.js +2 -9
  31. package/functions/reportLevel.js +1 -4
  32. package/functions/searchLevels.js +1 -2
  33. package/functions/searchLists.js +0 -1
  34. package/functions/unblockUser.js +4 -13
  35. package/functions/updateAccountSettings.js +75 -0
  36. package/functions/updateLevelDesc.js +2 -6
  37. package/functions/uploadAccountPost.js +1 -5
  38. package/functions/uploadComment.js +3 -7
  39. package/functions/uploadFriendRequest.js +3 -10
  40. package/functions/uploadMessage.js +3 -10
  41. package/index.js +2 -1
  42. package/misc/gauntlets.json +1 -0
  43. package/misc/gjReq.js +30 -15
  44. package/package.json +2 -5
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  </div>
8
8
 
9
9
  # About
10
- **gj-boomlings-api** is a light-weight Node.js module that allows you to easily interact with Geometry Dash API.
10
+ **gj-boomlings-api** is a light-weight Node.js module that makes it easier to interact with Geometry Dash API.
11
11
  # Installation
12
12
  ## Node.js
13
13
  ```
@@ -14,25 +14,18 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let userSearch = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let userSearch = await gjReq("getGJUsers20", { str: username });
21
18
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let userAccID = userSearch.data.split(":")[23];
23
20
 
24
- let recSearch = await gjReq("getGJUsers20", {
25
- str: from,
26
- secret: "Wmfd2893gb7"
27
- });
21
+ let recSearch = await gjReq("getGJUsers20", { str: from });
28
22
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${from}" not found`);
29
23
  let recAccID = recSearch.data.split(":")[23];
30
24
 
31
25
  let res = await gjReq("acceptGJFriendRequest20", {
32
26
  accountID: userAccID,
33
27
  targetAccountID: recAccID,
34
- gjp2: gjp2(password),
35
- secret: "Wmfd2893gb7",
28
+ gjp2: gjp2(password)
36
29
  });
37
30
  return Number(res.data);
38
31
  }
@@ -14,22 +14,15 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let userSearch = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let userSearch = await gjReq("getGJUsers20", { str: username });
21
18
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let userAccID = userSearch.data.split(":")[23];
23
20
 
24
- let recSearch = await gjReq("getGJUsers20", {
25
- str: target,
26
- secret: "Wmfd2893gb7"
27
- });
21
+ let recSearch = await gjReq("getGJUsers20", { str: target });
28
22
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
29
23
  let targetAccID = recSearch.data.split(":")[23];
30
24
 
31
25
  const data = {
32
- secret: "Wmfd2893gb7",
33
26
  targetAccountID: targetAccID,
34
27
  accountID: userAccID,
35
28
  gjp2: gjp2(password)
@@ -14,16 +14,12 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let search = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let search = await gjReq("getGJUsers20", { str: username });
21
18
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let accID = search.data.split(":")[23];
23
20
 
24
21
  let res = await gjReq("deleteGJAccComment20", {
25
22
  accountID: accID,
26
- secret: "Wmfd2893gb7",
27
23
  gjp2: gjp2(password),
28
24
  commentID: id,
29
25
  cType: 1,
@@ -17,16 +17,12 @@ module.exports = {
17
17
  const { gjReq } = require("../misc/gjReq");
18
18
  const { gjp2 } = require("../misc/gjp2");
19
19
 
20
- let search = await gjReq("getGJUsers20", {
21
- str: username,
22
- secret: "Wmfd2893gb7"
23
- });
20
+ let search = await gjReq("getGJUsers20", { str: username });
24
21
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
25
22
  let accID = search.data.split(":")[23];
26
23
 
27
24
  const res = await gjReq("deleteGJComment20", {
28
25
  accountID: accID,
29
- secret: "Wmfd2893gb7",
30
26
  levelID: level,
31
27
  gjp2: gjp2(password),
32
28
  commentID: id
@@ -16,17 +16,11 @@ module.exports = {
16
16
  const { gjReq } = require("../misc/gjReq");
17
17
  const { gjp2 } = require("../misc/gjp2");
18
18
 
19
- let userSearch = await gjReq("getGJUsers20", {
20
- str: username,
21
- secret: "Wmfd2893gb7"
22
- });
19
+ let userSearch = await gjReq("getGJUsers20", { str: username });
23
20
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
24
21
  let userAccID = userSearch.data.split(":")[23];
25
22
 
26
- let recSearch = await gjReq("getGJUsers20", {
27
- str: target,
28
- secret: "Wmfd2893gb7"
29
- });
23
+ let recSearch = await gjReq("getGJUsers20", { str: target });
30
24
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
31
25
  let recAccID = recSearch.data.split(":")[23];
32
26
 
@@ -34,7 +28,6 @@ module.exports = {
34
28
  accountID: userAccID,
35
29
  targetAccountID: recAccID,
36
30
  gjp2: gjp2(password),
37
- secret: "Wmfd2893gb7",
38
31
  isSender: Number(isSender)
39
32
  });
40
33
 
@@ -14,10 +14,7 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let search = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let search = await gjReq("getGJUsers20", { str: username });
21
18
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let accID = search.data.split(":")[23];
23
20
 
@@ -16,17 +16,13 @@ module.exports = {
16
16
  const { gjReq } = require("../misc/gjReq");
17
17
  const { gjp2 } = require("../misc/gjp2");
18
18
 
19
- let search = await gjReq("getGJUsers20", {
20
- str: username,
21
- secret: "Wmfd2893gb7"
22
- });
19
+ let search = await gjReq("getGJUsers20", { str: username });
23
20
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
24
21
  let accID = search.data.split(":")[23];
25
22
 
26
23
  let data = {
27
24
  accountID: accID,
28
25
  gjp2: gjp2(password),
29
- secret: "Wmfd2893gb7",
30
26
  messageID: id
31
27
  };
32
28
  if (isSender) data.isSender = 1;
@@ -58,12 +58,8 @@ module.exports = {
58
58
 
59
59
  const { gjReq } = require("../misc/gjReq");
60
60
 
61
- const data = {
62
- levelID: level.toString().trim(),
63
- secret: "Wmfd2893gb7"
64
- }
65
61
 
66
- let res = await gjReq("downloadGJLevel22", data);
62
+ let res = await gjReq("downloadGJLevel22", { levelID: level.toString().trim() });
67
63
  if (res.data == -1) return {};
68
64
  const XOR = require("../misc/xor");
69
65
  let xor = new XOR;
@@ -27,17 +27,13 @@ module.exports = {
27
27
  const XOR = require("../misc/xor");
28
28
  const xor = new XOR;
29
29
 
30
- let search = await gjReq("getGJUsers20", {
31
- str: username,
32
- secret: "Wmfd2893gb7"
33
- });
30
+ let search = await gjReq("getGJUsers20", { str: username });
34
31
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
35
32
  let accID = search.data.split(":")[23];
36
33
 
37
34
  let res = await gjReq("downloadGJMessage20", {
38
35
  accountID: accID,
39
36
  gjp2: gjp2(password),
40
- secret: "Wmfd2893gb7",
41
37
  messageID: id
42
38
  });
43
39
  if (res.data == -1) return {};
@@ -17,16 +17,12 @@ module.exports = {
17
17
  if (!target) throw new Error("Please provide a player ID or username!");
18
18
  const { gjReq } = require("../misc/gjReq");
19
19
 
20
- let search = await gjReq("getGJUsers20", {
21
- str: target,
22
- secret: "Wmfd2893gb7"
23
- });
20
+ let search = await gjReq("getGJUsers20", { str: target });
24
21
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
25
22
  let targetAccID = search.data.split(":")[23];
26
23
 
27
24
  let res = await gjReq("getGJAccountComments20", {
28
25
  accountID: targetAccID,
29
- secret: "Wmfd2893gb7",
30
26
  page: page - 1
31
27
  })
32
28
  if (res.data.startsWith("#")) return [];
@@ -23,17 +23,13 @@ module.exports = {
23
23
  const { gjReq } = require("../misc/gjReq");
24
24
  const { gjp2 } = require("../misc/gjp2");
25
25
 
26
- let search = await gjReq("getGJUsers20", {
27
- str: username,
28
- secret: "Wmfd2893gb7"
29
- });
26
+ let search = await gjReq("getGJUsers20", { str: username });
30
27
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
31
28
  let accID = search.data.split(":")[23];
32
29
 
33
30
  const data = {
34
31
  accountID: accID,
35
32
  gjp2: gjp2(password),
36
- secret: "Wmfd2893gb7",
37
33
  type: 1
38
34
  }
39
35
 
@@ -41,7 +41,6 @@ module.exports = {
41
41
  if (user.commentHistory != "all") throw new Error("Whoops! This user has disabled viewing his comment history!");
42
42
 
43
43
  let res = await gjReq("getGJCommentHistory", {
44
- secret: "Wmfd2893gb7",
45
44
  userID: user.playerID,
46
45
  page: Number(page) - 1,
47
46
  mode: Number(mode)
@@ -39,8 +39,7 @@ module.exports = {
39
39
  let res = await gjReq("getGJComments21", {
40
40
  levelID: level,
41
41
  page: Number(page) - 1,
42
- mode: Number(mode),
43
- secret: "Wmfd2893gb7"
42
+ mode: Number(mode)
44
43
  });
45
44
  if (res.data == -1 || res.data.startsWith("#")) return [];
46
45
 
@@ -32,7 +32,6 @@ module.exports = {
32
32
  const { gjReq } = require("../misc/gjReq");
33
33
 
34
34
  const data = {
35
- secret: "Wmfd2893gb7",
36
35
  type: "creators",
37
36
  count: count
38
37
  }
@@ -33,17 +33,13 @@ module.exports = {
33
33
  const { rgbToHEX } = require("../misc/rgbToHEX");
34
34
  const colors = require("../misc/colors.json");
35
35
 
36
- let userSearch = await gjReq("getGJUsers20", {
37
- str: username,
38
- secret: "Wmfd2893gb7"
39
- });
36
+ let userSearch = await gjReq("getGJUsers20", { str: username });
40
37
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
41
38
  let userAccID = userSearch.data.split(":")[23];
42
39
 
43
40
  let res = await gjReq("getGJFriendRequests20", {
44
41
  accountID: userAccID,
45
42
  gjp2: gjp2(password),
46
- secret: "Wmfd2893gb7",
47
43
  getSent: Number(isSender),
48
44
  page: Number(page) - 1
49
45
  });
@@ -21,17 +21,13 @@ module.exports = {
21
21
  const { gjReq } = require("../misc/gjReq");
22
22
  const { gjp2 } = require("../misc/gjp2");
23
23
 
24
- let search = await gjReq("getGJUsers20", {
25
- str: username,
26
- secret: "Wmfd2893gb7"
27
- });
24
+ let search = await gjReq("getGJUsers20", { str: username });
28
25
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
29
26
  let accID = search.data.split(":")[23];
30
27
 
31
28
  const data = {
32
29
  accountID: accID,
33
30
  gjp2: gjp2(password),
34
- secret: "Wmfd2893gb7"
35
31
  }
36
32
 
37
33
  let res = await gjReq("getGJUserList20", data);
@@ -15,7 +15,7 @@ module.exports = {
15
15
 
16
16
  // the only time i've ever used binaryVersion lmao
17
17
  // for some reason it does make a difference though
18
- let res = await gjReq("getGJGauntlets21", { secret: "Wmfd2893gb7", special: 1, binaryVersion: 48 });
18
+ let res = await gjReq("getGJGauntlets21", { special: 1, binaryVersion: 48 });
19
19
 
20
20
  let gauntlets = res.data.split("#")[0].split("|");
21
21
  let result = [];
@@ -48,7 +48,6 @@ module.exports = {
48
48
  const GJDecode = require("../misc/GJDecode");
49
49
  const { decodeSearchResults } = new GJDecode;
50
50
  const res = await gjReq("getGJLevels21", {
51
- secret: "Wmfd2893gb7",
52
51
  str: id,
53
52
  type: 0
54
53
  });
@@ -33,10 +33,7 @@ module.exports = {
33
33
  const { gjReq } = require("../misc/gjReq");
34
34
  const { rgbToHEX } = require("../misc/rgbToHEX");
35
35
  const colors = require("../misc/colors.json");
36
- let search = await gjReq("getGJUsers20", {
37
- str: username,
38
- secret: "Wmfd2893gb7"
39
- });
36
+ let search = await gjReq("getGJUsers20", { str: username });
40
37
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
41
38
  let accID = search.data.split(":")[23];
42
39
 
@@ -46,7 +43,6 @@ module.exports = {
46
43
  accountID: accID,
47
44
  gjp2: gjp2(password),
48
45
  levelID: level,
49
- secret: "Wmfd2893gb7",
50
46
  type: types[type.toLowerCase()]
51
47
  }
52
48
 
@@ -17,12 +17,8 @@ module.exports = {
17
17
  */
18
18
  getMapPacks: async function (page = 1) {
19
19
  const { gjReq } = require("../misc/gjReq");
20
- const data = {
21
- secret: "Wmfd2893gb7",
22
- page: Number(page) - 1
23
- }
24
20
 
25
- let res = await gjReq("getGJMapPacks21", data);
21
+ let res = await gjReq("getGJMapPacks21", { page: Number(page) - 1 });
26
22
  if (res.data.startsWith("#")) throw new Error("-1 Not found.");
27
23
 
28
24
  let packs = res.data.split("#")[0].split("|");
@@ -24,17 +24,13 @@ module.exports = {
24
24
  const { gjReq } = require("../misc/gjReq");
25
25
  const { gjp2 } = require("../misc/gjp2");
26
26
 
27
- let search = await gjReq("getGJUsers20", {
28
- str: username,
29
- secret: "Wmfd2893gb7"
30
- });
27
+ let search = await gjReq("getGJUsers20", { str: username });
31
28
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
32
29
  let accID = search.data.split(":")[23];
33
30
 
34
31
  let res = await gjReq("getGJMessages20", {
35
32
  accountID: accID,
36
33
  gjp2: gjp2(password),
37
- secret: "Wmfd2893gb7",
38
34
  page: page - 1
39
35
  });
40
36
  if (res.data == -1) throw new Error(-1);
@@ -64,18 +64,18 @@
64
64
  * @property {number} spiderID - The ID of the currently selected spider icon.
65
65
  * @property {number} swingID - The ID of the currently selected swing icon.
66
66
  * @property {number} jetpackID - The ID of the currently selected jetpack icon.
67
- * @property {number} trailID - The ID of the currently selected trail.
68
67
  * @property {number} explosionID - The ID of the currently selected explosion animation.
69
68
  * @property {boolean} glow - Whether the player's icon has the "glow" feature enabled.
70
- * @property {string} messages - The current state of messaging the player. Returns "all" if anyone can message the person, "friends" if it's limited to friends, and "none" if no one can.
69
+ * @property {string} glowColor - The HEX code of the player's glow color.
70
+ * @property {("all"|"friends"|"none")} messages - The current state of messaging the player. Returns "all" if anyone can message the person, "friends" if it's limited to friends, or "none" if no one can.
71
71
  * @property {boolean} friendRequests - Whether the player has allowed to receive friend requests.
72
- * @property {string} commentHistory - The current state of viewing the player's comment history. Returns "all" if anyone can do it, "friends" if it's limited to friends, and "none" if only the player can.
73
- * @property {string|null} mod - Whether the player is a moderator. Returns `null` if not, "mod" if the user is a regular moderator and "elder" if the user is an elder moderator.
72
+ * @property {("all"|"friends"|"none")} commentHistory - The current state of viewing the player's comment history. Returns "all" if anyone can do it, "friends" if it's limited to friends, or "none" if only the player can.
73
+ * @property {string|null} mod - Whether the player is a moderator. Returns `null` if not, "mod" if the user is a regular moderator or "elder" if the user is an elder moderator.
74
74
  * @property {string} youtube - The player's YouTube channel ID/handle, used in this template: `https://youtube.com/@((youtube))` or `https://youtube.com/channel/((youtube))` (only if the provided value starts with UC).
75
75
  * @property {string} twitter - The player's X (formerly Twitter) username, used in this template: `https://x.com/((twitter))`.
76
76
  * @property {string} twitch - The player's Twitch username, used in this template: `https://twitch.tv/((twitch))`.
77
77
  * @property {string} instagram - The player's Instagram username, used in this template: `https://instagram.com/@((instagram))`.
78
- * @property {string} tiktok - The player's Twitch username, used in this template: `https://tiktok.com/@((tiktok))`.
78
+ * @property {string} tiktok - The player's TikTok username, used in this template: `https://tiktok.com/@((tiktok))`.
79
79
  * @property {string} discord - The player's Discord username.
80
80
  * @property {string} custom - The custom string provided by the player.
81
81
  * @property {completedClassicLevels} completedClassicLevels - An object breaking down what classic levels the player has completed by difficulties, as well as daily levels and gauntlet levels.
@@ -123,7 +123,7 @@ module.exports = {
123
123
  let spider = Number(array[47]); // 43:
124
124
  let swing = Number(array[51]); // 53:
125
125
  let jetpack = Number(array[53]); // 54:
126
- let trail = Number(array[13]); // 51:
126
+ let glowColor = Number(array[13]); // 51:
127
127
  let glow = Boolean(Number(array[45])); // 28:
128
128
  let explosion = Number(array[49]); // 48:
129
129
  let rank = Number(array[81]); // 30:
@@ -179,9 +179,9 @@ module.exports = {
179
179
  spiderID: spider,
180
180
  swingID: swing,
181
181
  jetpackID: jetpack,
182
- trailID: trail,
183
182
  explosionID: explosion,
184
183
  glow: glow,
184
+ glowColor: rgbToHEX(colors[glowColor]),
185
185
  messages: msgObj[msg],
186
186
  friendRequests: friendReqsObj[friendReqs],
187
187
  commentHistory: msgObj[commentHistory],
@@ -231,10 +231,7 @@ module.exports = {
231
231
  }
232
232
 
233
233
  async function accIDSearch() {
234
- let res = await gjReq("getGJUserInfo20", {
235
- targetAccountID: name,
236
- secret: "Wmfd2893gb7"
237
- });
234
+ let res = await gjReq("getGJUserInfo20", { targetAccountID: name });
238
235
  if (res.data == -1) throw new Error(`-1: Player not found`);
239
236
  let accArray = res.data.split(":");
240
237
 
@@ -242,17 +239,11 @@ module.exports = {
242
239
  }
243
240
 
244
241
  async function nonAccIDSearch() {
245
- let search = await gjReq("getGJUsers20", {
246
- str: name,
247
- secret: "Wmfd2893gb7"
248
- });
242
+ let search = await gjReq("getGJUsers20", { str: name });
249
243
  if (search.data == -1) throw new Error(`-1: Player not found`);
250
244
  let targetAccID = search.data.split(":")[23];
251
245
 
252
- let res = await gjReq("getGJUserInfo20", {
253
- targetAccountID: targetAccID,
254
- secret: "Wmfd2893gb7"
255
- });
246
+ let res = await gjReq("getGJUserInfo20", { targetAccountID: targetAccID });
256
247
  let accArray = res.data.split(":");
257
248
 
258
249
  return decodeUser(accArray);
@@ -18,12 +18,7 @@ module.exports = {
18
18
  if (isNaN(song)) throw new Error("Please provide a valid song ID.");
19
19
  const { gjReq } = require("../misc/gjReq");
20
20
 
21
- const data = {
22
- songID: song,
23
- secret: "Wmfd2893gb7"
24
- }
25
-
26
- let res = await gjReq('getGJSongInfo', data);
21
+ let res = await gjReq('getGJSongInfo', { songID: song });
27
22
  if (res.data == -2 || res.data == -1) return { id: Number(song) };
28
23
  let rawSong = res.data.split("~|~");
29
24
 
@@ -29,10 +29,21 @@ module.exports = {
29
29
  */
30
30
  getSongsLibrary: async function () {
31
31
  const zlib = require("zlib");
32
- const fetch = require("node-fetch");
32
+ const https = require("https");
33
33
 
34
- let req = await fetch("https://geometrydashfiles.b-cdn.net/music/musiclibrary.dat");
35
- let res = await req.text();
34
+ const res = await new Promise((resolve, reject) => {
35
+ https.get("https://geometrydashfiles.b-cdn.net/music/musiclibrary.dat", (res) => {
36
+ let data = "";
37
+
38
+ res.on("data", chunk => {
39
+ data += chunk;
40
+ });
41
+
42
+ res.on("end", () => {
43
+ resolve(data);
44
+ });
45
+ }).on("error", reject);
46
+ });
36
47
 
37
48
  let libArray;
38
49
  const buffer = await new Promise((resolve, reject) => {
@@ -14,8 +14,7 @@ module.exports = {
14
14
  const { decodeSearchResults } = new GJDecode;
15
15
  const res = await gjReq("getGJLevels21", {
16
16
  type: tabs[tab.toLowerCase()],
17
- page: Number(page) - 1,
18
- secret: "Wmfd2893gb7"
17
+ page: Number(page) - 1
19
18
  });
20
19
  if (res.data == -1) return [];
21
20
 
@@ -8,13 +8,10 @@ module.exports = {
8
8
  const { decodeScoresUser } = new GJDecode;
9
9
  const { gjReq } = require("../misc/gjReq");
10
10
 
11
- const data = {
12
- secret: "Wmfd2893gb7",
11
+ let res = await gjReq("getGJScores20", {
13
12
  type: "top",
14
13
  count: 100
15
- }
16
-
17
- let res = await gjReq("getGJScores20", data);
14
+ });
18
15
 
19
16
  let players = res.data.split("|");
20
17
  players.pop();
@@ -10,7 +10,6 @@ module.exports = {
10
10
  const { decodeLists } = new GJDecode;
11
11
  const res = await gjReq("getGJLevelLists", {
12
12
  type: 6,
13
- secret: "Wmfd2893gb7",
14
13
  page: Number(page) - 1
15
14
  })
16
15
  if (res.data == -1) return [];
@@ -13,10 +13,7 @@ module.exports = {
13
13
  const { decodeSearchResults } = new GJDecode;
14
14
  let playerID = username;
15
15
  if (isNaN(username)) {
16
- let search = await gjReq("getGJUsers20", {
17
- str: username,
18
- secret: "Wmfd2893gb7"
19
- });
16
+ let search = await gjReq("getGJUsers20", { str: username });
20
17
  if (search.data == -1) throw new Error(`-1: Player "${username}" not found`);
21
18
  playerID = search.data.split(":")[3];
22
19
  }
@@ -24,7 +21,6 @@ module.exports = {
24
21
  const res = await gjReq("getGJLevels21", {
25
22
  type: 5,
26
23
  str: playerID,
27
- secret: "Wmfd2893gb7",
28
24
  page: Number(page) - 1
29
25
  });
30
26
  if (res.data == -1) return [];
@@ -14,22 +14,15 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let userSearch = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let userSearch = await gjReq("getGJUsers20", { str: username });
21
18
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let userAccID = userSearch.data.split(":")[23];
23
20
 
24
- let recSearch = await gjReq("getGJUsers20", {
25
- str: target,
26
- secret: "Wmfd2893gb7"
27
- });
21
+ let recSearch = await gjReq("getGJUsers20", { str: target });
28
22
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
29
23
  let targetAccID = recSearch.data.split(":")[23];
30
24
 
31
25
  let res = await gjReq("removeGJFriend20", {
32
- secret: "Wmfd2893gb7",
33
26
  targetAccountID: targetAccID,
34
27
  accountID: userAccID,
35
28
  gjp2: gjp2(password)
@@ -8,10 +8,7 @@ module.exports = {
8
8
  if (isNaN(level)) throw new Error("Please provide a valid level ID.");
9
9
  const { gjReq } = require("../misc/gjReq");
10
10
 
11
- let res = await gjReq("reportGJLevel", {
12
- levelID: level,
13
- secret: "Wmfd2893gb7"
14
- });
11
+ let res = await gjReq("reportGJLevel", { levelID: level });
15
12
 
16
13
  return res.data;
17
14
  }
@@ -13,8 +13,7 @@ module.exports = {
13
13
  let res = await gjReq("getGJLevels21", {
14
14
  type: 0,
15
15
  str: query,
16
- page: Number(page) - 1,
17
- secret: "Wmfd2893gb7"
16
+ page: Number(page) - 1
18
17
  });
19
18
  if (res.data == -1) return [];
20
19
 
@@ -30,7 +30,6 @@ module.exports = {
30
30
  const res = await gjReq("getGJLevelLists", {
31
31
  type: 0,
32
32
  str: query,
33
- secret: "Wmfd2893gb7",
34
33
  page: Number(page) - 1
35
34
  })
36
35
  if (res.data == -1) return [];
@@ -14,28 +14,19 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let userSearch = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let userSearch = await gjReq("getGJUsers20", { str: username });
21
18
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let userAccID = userSearch.data.split(":")[23];
23
20
 
24
- let recSearch = await gjReq("getGJUsers20", {
25
- str: target,
26
- secret: "Wmfd2893gb7"
27
- });
21
+ let recSearch = await gjReq("getGJUsers20", { str: target });
28
22
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
29
23
  let targetAccID = recSearch.data.split(":")[23];
30
24
 
31
- const data = {
32
- secret: "Wmfd2893gb7",
25
+ let res = await gjReq("unblockGJUser20", {
33
26
  targetAccountID: targetAccID,
34
27
  accountID: userAccID,
35
28
  gjp2: gjp2(password)
36
- }
37
-
38
- let res = await gjReq("unblockGJUser20", data);
29
+ });
39
30
 
40
31
  return Number(res.data);
41
32
  }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @typedef {Object} AccountSettings
3
+ * @property {("all"|"friends"|"none")?} messages - Who the player allows messages from. Set to "all" to allow messages from everyone, "friends" to make messaging limited to friends, or "none" to disable messaging altogether.
4
+ * @property {Boolean?} friendRequests - Whether the player allows friend requests.
5
+ * @property {("all"|"friends"|"none")?} commentHistory - Who the player allows to view their comments. Set to "all" to allow everyone, "friends" to limit it to friends, or "none" to limit it to yourself.
6
+ * @property {string} youtube - The player's YouTube channel ID/handle, used in this template: `https://youtube.com/@((youtube))` or `https://youtube.com/channel/((youtube))` (only if the provided value starts with UC). Be careful, as not providing this value unsets it on the servers as well.
7
+ * @property {string} twitter - The player's X (formerly Twitter) username, used in this template: `https://x.com/((twitter))`. Be careful, as not providing this value unsets it on the servers as well.
8
+ * @property {string} twitch - The player's Twitch username, used in this template: `https://twitch.tv/((twitch))`. Be careful, as not providing this value unsets it on the servers as well.
9
+ * @property {string} instagram - The player's Instagram username, used in this template: `https://instagram.com/@((instagram))`. Be careful, as not providing this value unsets it on the servers as well.
10
+ * @property {string} tiktok - The player's TikTok username, used in this template: `https://tiktok.com/@((tiktok))`. Be careful, as not providing this value unsets it on the servers as well.
11
+ * @property {string} discord - The player's Discord username. Be careful, as not providing this value unsets it on the servers as well.
12
+ * @property {string} custom - The custom string provided by the player. Be careful, as not providing this value unsets it on the servers as well.
13
+ */
14
+
15
+ module.exports = {
16
+ /**
17
+ * Updates the account settings.
18
+ * @param {string} username - The player's username or player ID.
19
+ * @param {string} password - The player's password.
20
+ * @param {AccountSettings} settings - The settings to set.
21
+ * @returns {number} Returns 1 regardless of whether anything was updated, or -1 if something went wrong.
22
+ */
23
+ updateAccountSettings: async function (username, password, settings) {
24
+ if (!username) throw new Error("Please provide the username or the player ID!");
25
+ if (!password) throw new Error("Please provide the password!");
26
+
27
+ const { gjReq } = require("../misc/gjReq");
28
+ const { gjp2 } = require("../misc/gjp2");
29
+
30
+ let search = await gjReq("getGJUsers20", { str: username });
31
+ if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
32
+ let accID = search.data.split(":")[23];
33
+
34
+ const parseAccessIDs = {
35
+ "all": "0",
36
+ "friends": "1",
37
+ "none": "2",
38
+ "0": "0",
39
+ "1": "1",
40
+ "2": "2"
41
+ };
42
+
43
+ const parseBoolean = {
44
+ "true": "0",
45
+ "false": "1",
46
+ "0": "0",
47
+ "1": "1"
48
+ };
49
+
50
+ let messages = parseAccessIDs[settings.messages?.toString()] || "";
51
+ let friendRequests = parseBoolean[settings.friendRequests?.toString()] || "";
52
+ let commentHistory = parseAccessIDs[settings.commentHistory?.toString()] || "";
53
+
54
+ const dataObj = {
55
+ accountID: accID,
56
+ secret: "Wmfv3899gc9",
57
+ gjp2: gjp2(password),
58
+ mS: messages,
59
+ frS: friendRequests,
60
+ cS: commentHistory
61
+ };
62
+
63
+ if (settings.youtube) dataObj.yt = settings.youtube;
64
+ if (settings.twitter) dataObj.twitter = settings.twitter;
65
+ if (settings.twitch) dataObj.twitch = settings.twitch;
66
+ if (settings.instagram) dataObj.instagram = settings.instagram;
67
+ if (settings.tiktok) dataObj.tiktok = settings.tiktok;
68
+ if (settings.discord) dataObj.discord = settings.discord;
69
+ if (settings.custom) dataObj.custom = settings.custom;
70
+
71
+ let res = await gjReq("updateGJAccSettings20", dataObj);
72
+
73
+ return Number(res.data);
74
+ }
75
+ }
@@ -15,10 +15,7 @@ module.exports = {
15
15
  const { gjReq } = require("../misc/gjReq");
16
16
  const { gjp2 } = require("../misc/gjp2");
17
17
 
18
- let search = await gjReq("getGJUsers20", {
19
- str: username,
20
- secret: "Wmfd2893gb7"
21
- });
18
+ let search = await gjReq("getGJUsers20", { str: username });
22
19
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
23
20
  let accID = search.data.split(":")[23];
24
21
 
@@ -26,8 +23,7 @@ module.exports = {
26
23
  accountID: accID,
27
24
  gjp2: gjp2(password),
28
25
  levelID: level,
29
- levelDesc: Buffer.from(desc).toString("base64"),
30
- secret: "Wmfd2893gb7"
26
+ levelDesc: Buffer.from(desc).toString("base64")
31
27
  });
32
28
 
33
29
  return res.data;
@@ -14,16 +14,12 @@ module.exports = {
14
14
  const { gjReq } = require("../misc/gjReq");
15
15
  const { gjp2 } = require("../misc/gjp2");
16
16
 
17
- let search = await gjReq("getGJUsers20", {
18
- str: username,
19
- secret: "Wmfd2893gb7"
20
- });
17
+ let search = await gjReq("getGJUsers20", { str: username });
21
18
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
22
19
  let accID = search.data.split(":")[23];
23
20
 
24
21
  let res = await gjReq("uploadGJAccComment20", {
25
22
  accountID: accID,
26
- secret: "Wmfd2893gb7",
27
23
  gjp2: gjp2(password),
28
24
  comment: Buffer.from(content).toString("base64"),
29
25
  cType: 1
@@ -16,14 +16,11 @@ module.exports = {
16
16
  if (Number(percent) > 100) throw new Error("The percentage cannot be more than 100!");
17
17
 
18
18
  const { gjReq } = require("../misc/gjReq");
19
- const crypto = require('crypto')
19
+ const crypto = require("crypto");
20
20
 
21
21
  function sha1(data) { return crypto.createHash("sha1").update(data, "binary").digest("hex"); }
22
22
 
23
- let search = await gjReq("getGJUsers20", {
24
- str: username,
25
- secret: "Wmfd2893gb7"
26
- });
23
+ let search = await gjReq("getGJUsers20", {str: username});
27
24
  if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
28
25
  let name = search.data.split(":")[1];
29
26
  let accID = search.data.split(":")[23];
@@ -42,8 +39,7 @@ module.exports = {
42
39
  comment: Buffer.from(comment).toString("base64"),
43
40
  levelID: level,
44
41
  percent: percent,
45
- chk: chk,
46
- secret: "Wmfd2893gb7"
42
+ chk: chk
47
43
  });
48
44
 
49
45
  if (res.data == -10) throw new Error("You're permanently banned from commenting!");
@@ -15,17 +15,11 @@ module.exports = {
15
15
  const { gjReq } = require("../misc/gjReq");
16
16
  const { gjp2 } = require("../misc/gjp2");
17
17
 
18
- let userSearch = await gjReq("getGJUsers20", {
19
- str: username,
20
- secret: "Wmfd2893gb7"
21
- });
18
+ let userSearch = await gjReq("getGJUsers20", {str: username});
22
19
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
23
20
  let userAccID = userSearch.data.split(":")[23];
24
21
 
25
- let recSearch = await gjReq("getGJUsers20", {
26
- str: target,
27
- secret: "Wmfd2893gb7"
28
- });
22
+ let recSearch = await gjReq("getGJUsers20", {str: target});
29
23
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
30
24
  let recAccID = recSearch.data.split(":")[23];
31
25
 
@@ -33,8 +27,7 @@ module.exports = {
33
27
  accountID: userAccID,
34
28
  toAccountID: recAccID,
35
29
  gjp2: gjp2(password),
36
- comment: comment ? Buffer.from(comment).toString("base64") : "",
37
- secret: "Wmfd2893gb7"
30
+ comment: comment ? Buffer.from(comment).toString("base64") : ""
38
31
  });
39
32
 
40
33
  return Number(res.data);
@@ -20,17 +20,11 @@ module.exports = {
20
20
  const xor = new XOR;
21
21
  const { gjp2 } = require("../misc/gjp2");
22
22
 
23
- let userSearch = await gjReq("getGJUsers20", {
24
- str: username,
25
- secret: "Wmfd2893gb7"
26
- });
23
+ let userSearch = await gjReq("getGJUsers20", {str: username});
27
24
  if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
28
25
  let userAccID = userSearch.data.split(":")[23];
29
26
 
30
- let recSearch = await gjReq("getGJUsers20", {
31
- str: recipient,
32
- secret: "Wmfd2893gb7"
33
- });
27
+ let recSearch = await gjReq("getGJUsers20", {str: recipient});
34
28
  if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
35
29
  let recAccID = recSearch.data.split(":")[23];
36
30
 
@@ -39,8 +33,7 @@ module.exports = {
39
33
  toAccountID: recAccID,
40
34
  gjp2: gjp2(password),
41
35
  subject: Buffer.from(subject).toString("base64"),
42
- body: xor.encrypt(content, 14251),
43
- secret: "Wmfd2893gb7"
36
+ body: xor.encrypt(content, 14251)
44
37
  });
45
38
 
46
39
  return Number(res.data);
package/index.js CHANGED
@@ -39,6 +39,7 @@ const { getFriendRequests } = require("./functions/getFriendRequests");
39
39
  const { acceptFriendRequest } = require("./functions/acceptFriendRequest");
40
40
  const { removeFriend } = require("./functions/removeFriend");
41
41
  const { deleteMessage } = require("./functions/deleteMessage");
42
+ const { updateAccountSettings } = require("./functions/updateAccountSettings");
42
43
 
43
44
  const dlLevel = downloadLevel;
44
45
  const dlMessage = downloadMessage;
@@ -58,5 +59,5 @@ module.exports = {
58
59
  getUserLevels, deleteComment, getCommentHistory,
59
60
  getLevelScores, uploadComment, uploadFriendRequest,
60
61
  deleteFriendRequest, getFriendRequests, acceptFriendRequest,
61
- removeFriend, deleteMessage
62
+ removeFriend, deleteMessage, updateAccountSettings
62
63
  };
@@ -23,6 +23,7 @@
23
23
  "25": "Power",
24
24
  "29": "Halloween",
25
25
  "30": "Treasure",
26
+ "32": "Spider",
26
27
  "33": "Gem",
27
28
  "34": "Inferno",
28
29
  "35": "Portal",
package/misc/gjReq.js CHANGED
@@ -1,18 +1,33 @@
1
- const fetch = require("node-fetch");
1
+ const https = require("https");
2
2
  module.exports = {
3
- gjReq: async function (endpoint, data) {
4
- let r = await fetch(`https://www.boomlings.com/database/${endpoint.endsWith(".php") ? endpoint.split(".php")[0] : endpoint}.php`, {
5
- method: "POST",
6
- headers: {
7
- "Content-Type": "application/x-www-form-urlencoded",
8
- "User-Agent": " "
9
- },
10
- body: new URLSearchParams(data)
11
- });
12
- let res = await r.text();
13
- return {
14
- data: res,
15
- status: r.status
16
- }
3
+ gjReq: function (endpoint, data) {
4
+ return new Promise((resolve, reject) => {
5
+ if (!data.secret) data.secret = "Wmfd2893gb7";
6
+ const body = new URLSearchParams(data).toString();
7
+
8
+ const r = https.request({
9
+ hostname: "www.boomlings.com",
10
+ path: `/database/${endpoint.endsWith(".php") ? endpoint.split(".php")[0] : endpoint}.php`,
11
+ method: "POST",
12
+ headers: {
13
+ "Content-Type": "application/x-www-form-urlencoded",
14
+ "User-Agent": ""
15
+ }
16
+ }, (res) => {
17
+ let output = "";
18
+
19
+ res.on("data", chunk => {output += chunk;});
20
+ res.on("end", () => {
21
+ resolve({
22
+ data: output,
23
+ status: r.statusCode
24
+ })
25
+ })
26
+ })
27
+
28
+ r.on("error", reject);
29
+ r.write(body);
30
+ r.end();
31
+ })
17
32
  }
18
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A light-weight Geometry Dash API wrapper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,8 +26,5 @@
26
26
  "gaming",
27
27
  "robtop",
28
28
  "geometry dash"
29
- ],
30
- "dependencies": {
31
- "node-fetch": "^2.7.0"
32
- }
29
+ ]
33
30
  }