gj-boomlings-api 0.4.0 → 0.5.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/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # gj-boomlings-api
2
1
  <div align="center">
2
+ <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://shikoshib.github.io/font1.png" width="600"></a><hr>
3
3
  <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/v/gj-boomlings-api.svg?maxAge=3600" alt="npm version" /></a>
4
4
  <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/dt/gj-boomlings-api.svg?maxAge=3600" alt="npm downloads" /></a>
5
5
  <a href="https://snyk.io/test/github/shikoshib/gj-boomlings-api"><img src="https://snyk.io/test/github/shikoshib/gj-boomlings-api/badge.svg" alt="Known Vulnerabilities" /></a>
@@ -57,7 +57,6 @@ Returns:
57
57
  }
58
58
  }
59
59
  ```
60
-
61
60
  ### getProfile(user)
62
61
 
63
62
  With this function, you can get somebody's profile info. You can use a player ID (not the account ID) or a name string, it doesn't matter.
@@ -90,8 +89,20 @@ Returns:
90
89
  twitch: 'https://twitch.tv/robtopgames'
91
90
  }
92
91
  ```
92
+ ### uploadComment(comment, id, user, password, percent)
93
+
94
+ You can post comments with this function.
95
+
96
+ For example,
97
+ ```js
98
+ const gd = require("gj-boomlings-api");
99
+ gd.uploadComment("I love gj-boomlings-api!", 83925274, "gmdshxdow", "*********", 99).then(console.log);
100
+ // of course you need to replace the asterisks with your password
101
+ ```
102
+
103
+ Posts a comment on the level with the ID of 83925274, with 99 percent, on gmdshxdow's behalf.
93
104
 
94
- Check out [docs](./docs/) for more info.
105
+ **Check out [docs](./docs/) for more info.**
95
106
 
96
107
  ---
97
108
 
@@ -73,7 +73,7 @@ gd.getGauntlets().then(console.log);
73
73
  }
74
74
  ]
75
75
  ```
76
- This function returns an array of gauntlets.
76
+ This function returns an array of gauntlet objects.
77
77
 
78
78
  ### Properties
79
79
  `name` - the gauntlet name.
@@ -0,0 +1,88 @@
1
+ # getMapPacks()
2
+
3
+ Gets the list of map packs and decodes it.
4
+
5
+ ## Parameters
6
+ `page` (optional) - the page of the map packs list. Defaults to 1.
7
+
8
+ ## Example
9
+ ```js
10
+ const gd = require("gj-boomlings-api");
11
+ gd.getMapPacks(2).then(console.log);
12
+ ```
13
+
14
+ ## Response
15
+ ```
16
+ [
17
+ {
18
+ name: 'Ruby Pack',
19
+ levels: [ 1446958, 1063115, 1734354 ],
20
+ stars: 4,
21
+ coins: 1
22
+ },
23
+ {
24
+ name: 'Electro Pack',
25
+ levels: [ 5131543, 8157377, 8571598 ],
26
+ stars: 4,
27
+ coins: 1
28
+ },
29
+ {
30
+ name: 'Laser Pack',
31
+ levels: [ 12178580, 11357573, 11591917 ],
32
+ stars: 4,
33
+ coins: 1
34
+ },
35
+ {
36
+ name: 'Glow Pack',
37
+ levels: [ 4449079, 6979485, 10110092 ],
38
+ stars: 4,
39
+ coins: 1
40
+ },
41
+ {
42
+ name: 'Spirit Pack',
43
+ levels: [ 13766381, 13242284, 13963465 ],
44
+ stars: 4,
45
+ coins: 1
46
+ },
47
+ {
48
+ name: 'Hard Pack',
49
+ levels: [ 217631, 3785, 281148 ],
50
+ stars: 5,
51
+ coins: 1
52
+ },
53
+ {
54
+ name: 'Morph Pack',
55
+ levels: [ 364445, 411459, 509393 ],
56
+ stars: 5,
57
+ coins: 1
58
+ },
59
+ {
60
+ name: 'Phoenix Pack',
61
+ levels: [ 674454, 750434, 835854 ],
62
+ stars: 5,
63
+ coins: 1
64
+ },
65
+ {
66
+ name: 'Power Pack',
67
+ levels: [ 809579, 741941, 577710 ],
68
+ stars: 5,
69
+ coins: 1
70
+ },
71
+ {
72
+ name: 'Shiny Pack',
73
+ levels: [ 980341, 1541962, 1160937 ],
74
+ stars: 5,
75
+ coins: 1
76
+ }
77
+ ]
78
+ ```
79
+ This function returns an array of map pack objects.
80
+
81
+ ### Properties
82
+ `name` - the map pack name.
83
+
84
+ `levels` - the array of levels in a map pack.
85
+
86
+ `stars` - the amount of stars you get from beating the map pack.
87
+
88
+ `coins` - the amount of coins you get from beating the map pack.
@@ -12,14 +12,14 @@ Posts a comment to a profile.
12
12
  ## Example
13
13
  ```js
14
14
  const gd = require("gj-boomlings-api");
15
- gd.uploadAccountPost("i'm a furry", "colon", "*********").then(console.log);
16
- // basically this function posts the "i'm a furry" message to Colon's profile
15
+ gd.uploadAccountPost("I love gj-boomlings-api!", "gmdshxdow", "*********").then(console.log);
17
16
  ```
18
17
 
19
18
  ## Response
20
19
  ```js
21
20
  1
22
21
  ```
22
+
23
23
  Returns `1` if the comment was successfully posted.
24
24
 
25
25
  ---
@@ -0,0 +1,28 @@
1
+ # uploadComment()
2
+
3
+ Posts a comment to a profile.
4
+
5
+ ## Parameters
6
+
7
+ `content` - the actual comment content.
8
+
9
+ `id` - the level ID.
10
+
11
+ `user` - the username or player ID.
12
+
13
+ `gjp` - the user's password
14
+
15
+ `percent` (optional) - the comment percentage. Defaults to 0.
16
+
17
+ ## Example
18
+ ```js
19
+ const gd = require("gj-boomlings-api");
20
+ gd.uploadComment("I love gj-boomlings-api!", 83925274, "gmdshxdow", "*********", 99).then(console.log);
21
+ ```
22
+
23
+ ## Response
24
+ ```js
25
+ 1
26
+ ```
27
+
28
+ Returns `1` if the comment was successfully posted.
@@ -0,0 +1,39 @@
1
+ module.exports = {
2
+ getMapPacks:
3
+ async function(page = 1) {
4
+ const { decodeMapPack } = require("../misc/decodeMapPack.js");
5
+ const axios = require("axios");
6
+ const { headers, server } = require("../config.json");
7
+ const data = {
8
+ secret: "Wmfd2893gb7",
9
+ page: page - 1
10
+ }
11
+
12
+ let res = await axios.post(server + "getGJMapPacks21.php", data, {
13
+ headers: headers
14
+ })
15
+
16
+ let firstMapPack = res.data.split("|")[0];
17
+ let secondMapPack = res.data.split("|")[1].split("|")[0];
18
+ let thirdMapPack = res.data.split("|")[2].split("|")[0];
19
+ let fourthMapPack = res.data.split("|")[3].split("|")[0];
20
+ let fifthMapPack = res.data.split("|")[4].split("|")[0];
21
+ let sixthMapPack;
22
+ let seventhMapPack;
23
+ let eighthMapPack;
24
+ let ninthMapPack;
25
+ let tenthMapPack;
26
+ let result = [decodeMapPack(firstMapPack),decodeMapPack(secondMapPack),decodeMapPack(thirdMapPack),decodeMapPack(fourthMapPack),decodeMapPack(fifthMapPack)]
27
+
28
+ if(res.data.split("|").length - 1 == 9) {
29
+ sixthMapPack = res.data.split("|")[5].split("|")[0];
30
+ seventhMapPack = res.data.split("|")[6].split("|")[0];
31
+ eighthMapPack = res.data.split("|")[7].split("|")[0];
32
+ ninthMapPack = res.data.split("|")[8].split("|")[0];
33
+ tenthMapPack = res.data.split("|")[9].split("|")[0];
34
+ result.push(decodeMapPack(sixthMapPack),decodeMapPack(seventhMapPack),decodeMapPack(eighthMapPack),decodeMapPack(ninthMapPack),decodeMapPack(tenthMapPack))
35
+ }
36
+
37
+ return result;
38
+ }
39
+ }
@@ -73,13 +73,14 @@ module.exports = {
73
73
  } else {
74
74
  stars = stars;
75
75
  }
76
- if(dataWoSkins.split("3:")[3] != undefined || dataWoSkins.split("3:")[3] != "") {
76
+
77
+ if(dataWoSkins.split("3:")[3] !== undefined) {
77
78
  if(dataWoSkins.split("3:")[3].split(":46:")[0] == "") {
78
79
  stars = dataWoSkins.split("3:")[4].split(":46:")[0];
79
80
  } else {
80
81
  stars = stars;
81
82
  }
82
- }
83
+ }
83
84
 
84
85
  let ytLnk = `htps://youtube.com/channel/${youtube}`;
85
86
  let twitterLnk = `https://twitter.com/${twitter}`;
@@ -0,0 +1,64 @@
1
+ module.exports = {
2
+ uploadComment:
3
+ async function(comment, id, user, password, percent = 0) {
4
+ if(!comment || comment == "") throw new Error("Please provide a comment!");
5
+ if(!id || id == "") throw new Error("Please provide a level ID!");
6
+ if(!user || user == "") throw new Error("Please provide a username or a player ID!");
7
+ if(!password || password == "") throw new Error("Please provide a password!");
8
+ if(Number(percent) > 100) throw new Error("The percentage cannot be more than 100!");
9
+
10
+ const { gjp } = require("../misc/gjp.js");
11
+ const { encURLSafeBase64 } = require("./encURLSafeBase64.js");
12
+ const axios = require("axios");
13
+ const { headers, server } = require("../config.json");
14
+ const crypto = require('crypto')
15
+
16
+ function sha1(data) {
17
+ return crypto.createHash("sha1").update(data, "binary").digest("hex");
18
+ }
19
+
20
+ const data = {
21
+ gameVersion: 21,
22
+ binaryVersion: 35,
23
+ gdw: 0,
24
+ str: user,
25
+ secret: "Wmfd2893gb7"
26
+ };
27
+
28
+ let r = await axios.post(server + "getGJUsers20.php", data, {
29
+ headers: headers
30
+ })
31
+
32
+ if(r.data == -1) throw new Error("-1 This user is not found.")
33
+ let username = r.data.split("1:")[1].split(":2:")[0];
34
+ let accID = r.data.split(":16:")[1].split(":3:")[0];
35
+ if(Number(accID) < 71 || accID.includes(":")) accID = r.data.split(":16:")[2].split(":3:")[0];
36
+
37
+ const XOR = require("../misc/xor.js");
38
+ const xor = new XOR();
39
+
40
+ let chkStr = username + encURLSafeBase64(comment) + Number(id) + Number(percent) + "0xPT6iUrtws0J";
41
+ let chk = xor.encrypt(sha1(chkStr), 29481);
42
+
43
+ const uCdata = {
44
+ accountID: accID,
45
+ gjp: gjp(password),
46
+ userName: username,
47
+ comment: encURLSafeBase64(comment),
48
+ levelID: id,
49
+ percent: percent,
50
+ chk: chk,
51
+ secret: "Wmfd2893gb7"
52
+ }
53
+
54
+ let res = await axios.post(server + "uploadGJComment21.php", uCdata, {
55
+ headers: headers
56
+ }).catch(e => {
57
+ let edata = e.response.data;
58
+ if(edata == '') edata = "Whoops, the servers have rejected your request!"
59
+ throw new Error(edata)
60
+ })
61
+
62
+ return 1;
63
+ }
64
+ }
package/index.js CHANGED
@@ -12,6 +12,8 @@ const { getCommentHistory } = require("./functions/getCommentHistory.js");
12
12
  const { getGauntlets } = require("./functions/getGauntlets.js");
13
13
  const { getAccountPosts } = require("./functions/getAccountPosts.js");
14
14
  const { uploadAccountPost } = require("./functions/uploadAccountPost.js");
15
+ const { uploadComment } = require("./functions/uploadComment.js");
16
+ const { getMapPacks } = require("./functions/getMapPacks.js");
15
17
 
16
18
  module.exports.dlLevel = dlLevel;
17
19
  module.exports.getSongInfo = getSongInfo;
@@ -26,4 +28,6 @@ module.exports.getComments = getComments;
26
28
  module.exports.getCommentHistory = getCommentHistory;
27
29
  module.exports.getGauntlets = getGauntlets;
28
30
  module.exports.getAccountPosts = getAccountPosts;
29
- module.exports.uploadAccountPost = uploadAccountPost;
31
+ module.exports.uploadAccountPost = uploadAccountPost;
32
+ module.exports.uploadComment = uploadComment;
33
+ module.exports.getMapPacks = getMapPacks;
@@ -0,0 +1,55 @@
1
+ module.exports = {
2
+ decodeMapPack:
3
+ function(mp) {
4
+ let name = mp.split(":2:")[1].split(":3:")[0];
5
+ let unarrayedList = mp.split(":3:")[1].split(":4:")[0].split(":4")[0];
6
+ let stars = mp.split(":4:")[1].split(":5:")[0];
7
+ let coins = mp.split(":5:")[1].split(":6:")[0];
8
+ let difficulty = mp.split(":6:")[1].split(":7:")[0];
9
+
10
+ if(unarrayedList.includes(":")) unarrayedList = mp.split(":3:")[2].split(":4:")[0]
11
+
12
+ let firstLvl = unarrayedList.split(",")[0];
13
+ let secondLvl = unarrayedList.split(",")[1].split(",")[0];
14
+ let thirdLvl = unarrayedList.split(",")[2].split(",")[0];
15
+
16
+ if(name.includes(":")) name = name.split("2:")[1]
17
+
18
+ let difficultyDecoder = {
19
+ "0": "Auto",
20
+ "1": "Easy",
21
+ "2": "Normal",
22
+ "3": "Hard",
23
+ "4": "Harder",
24
+ "5": "Insane",
25
+ "6": "Hard Demon",
26
+ "7": "Easy Demon",
27
+ "8": "Medium Demon",
28
+ "9": "Insane Demon",
29
+ "10": "Extreme Demon",
30
+ }
31
+
32
+ if(coins.startsWith("5:")) {
33
+ coins = coins.split("5:")[1];
34
+ }
35
+
36
+ if(mp.split(":5:")[2] !== undefined) {
37
+ if(coins.includes(":")) {
38
+ coins = mp.split(":5:")[2].split(":6:")[0];
39
+ }
40
+ }
41
+
42
+ if(coins.startsWith("5:")) coins = coins.split("5:")[1];
43
+ if(coins.startsWith("7:")) coins = mp.split(":5:")[1].split(":6:")[0];
44
+ if(coins.endsWith(":6")) coins = coins.split(":6")[0];
45
+
46
+ const result = {
47
+ name: name,
48
+ levels: [Number(firstLvl),Number(secondLvl),Number(thirdLvl)],
49
+ stars: Number(stars),
50
+ coins: Number(coins)
51
+ }
52
+
53
+ return result;
54
+ }
55
+ }
package/misc/gjp.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ gjp:
3
+ function(password) {
4
+ const XOR = require("./xor.js");
5
+ const xor = new XOR();
6
+ return xor.encrypt(password, 37526).toString();
7
+ }
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A Node.js module that allows you to fetch boomlings.com easily",
5
5
  "main": "index.js",
6
6
  "scripts": {