gj-boomlings-api 1.4.0 → 1.4.2

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
@@ -2,183 +2,28 @@
2
2
  <h1>
3
3
  <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://shikoshib.github.io/font1.png" width="576"></a>
4
4
  </h1>
5
- A light-weight Geometry Dash API wrapper<br><br><a href="https://shikoshib.github.io/gj-boomlings-api"><b>Documentation (coming soon)</b></a><br><br>
5
+ A light-weight Geometry Dash API wrapper<br><br><a href="https://github.com/shikoshib/gj-boomlings-api/wiki"><b>Documentation</b></a><br><br>
6
6
  <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>
7
+ <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/min/gj-boomlings-api">
8
+ <a href="https://github.com/shikoshib/gj-boomlings-api/actions/workflows/node.js.yml"><img src="https://github.com/shikoshib/gj-boomlings-api/actions/workflows/node.js.yml/badge.svg" /></a>
7
9
  <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/dt/gj-boomlings-api" /></a>
8
10
  <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>
9
11
  <a href="https://packagequality.com/#?package=gj-boomlings-api"><img src="https://packagequality.com/shield/gj-boomlings-api.svg"/></a>
10
12
  </div>
11
13
 
12
- ## Functions
13
-
14
- ### dlLevel(id)
15
-
16
- So basically this function downloads the entire level and converts the response into JSON.
17
-
18
- ```js
19
- const gd = require("gj-boomlings-api");
20
- gd.dlLevel(42584142).then(console.log);
21
- ```
22
-
23
- Returns:
24
-
25
- ```
26
- {
27
- id: 42584142,
28
- name: 'Bloodlust',
29
- description: 'Your thirst for blood continues? Very well, let the blood spill. Let the demons feed off your unfortunate soul...',
30
- creator: 'Knobbelboy',
31
- level_version: 3,
32
- difficulty: 'Extreme Demon',
33
- stars: 10,
34
- downloads: 19055472,
35
- likes: 701448,
36
- disliked: false,
37
- length: 'XL',
38
- password: '21296',
39
- demon: true,
40
- featured: true,
41
- epic: true,
42
- objects: 170739,
43
- uploaded: '4 years',
44
- updated: '6 months',
45
- stars_requested: 10,
46
- game_version: '2.1',
47
- ldm: false,
48
- copied: 25066306,
49
- large: true,
50
- two_p: false,
51
- coins: 0,
52
- verified_coins: false,
53
- song: {
54
- name: 'At the Speed of Light',
55
- id: 467339,
56
- artist: 'Dimrain47',
57
- artistId: 52,
58
- fileSize: '9.56 MB',
59
- link: 'https://geometrydashcontent.b-cdn.net/songs/467339.mp3'
60
- },
61
- pointercrate: {
62
- position: 50,
63
- publisher: 'knobbelboy',
64
- verifier: 'knobbelboy'
65
- }
66
- }
67
- ```
68
- ### getProfile(user)
69
-
70
- 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.
71
-
72
- ```js
73
- const gd = require("gj-boomlings-api");
74
- gd.getProfile(16).then(console.log); // returns RobTop's info
75
- ```
76
-
77
- Returns:
78
-
79
- ```
80
- {
81
- username: 'RobTop',
82
- playerID: 16,
83
- accountID: 71,
84
- rank: 220553,
85
- color1: '#7D00FF',
86
- color2: '#00FFFF',
87
- stars: 2389,
88
- diamonds: 2169,
89
- secretCoins: 3,
90
- userCoins: 140,
91
- demons: 5,
92
- creatorPoints: 0,
93
- messages: 'none',
94
- friendRequests: 'none',
95
- commentHistory: 'all',
96
- mod: 'elder',
97
- youtube: 'https://youtube.com/channel/UCz_yk8mDSAnxJq0ar66L4sw',
98
- twitter: 'https://twitter.com/RobTopGames',
99
- twitch: 'https://twitch.tv/robtopgames'
100
- }
101
- ```
102
- ### uploadComment(comment, id, user, password, percent)
103
-
104
- You can post comments with this function.
105
-
106
- For example,
107
- ```js
108
- const gd = require("gj-boomlings-api");
109
- gd.uploadComment("I love gj-boomlings-api!", 83925274, "gmdshxdow", "*********", 99).then(console.log);
110
- // of course you need to replace the asterisks with your password
111
- ```
112
-
113
- Posts a comment on the level with the ID of 83925274, with 99 percent, on gmdshxdow's behalf.
114
- ### getMapPacks(page)
115
-
116
- This function gets the info about the map packs on a specified page (if left out, defaults to 1).
117
-
118
- ```js
119
- const gd = require("gj-boomlings-api");
120
- gd.getMapPacks(7).then(console.log);
14
+ # About
15
+ **gj-boomlings-api** is a light-weight Node.js module that allows you to easily interact with Geometry Dash API.
16
+ # Installation
17
+ **Node.js 18.0.0 or newer is required.**
121
18
  ```
122
-
123
- Returns:
124
-
19
+ npm i gj-boomlings-api
20
+ yarn add gj-boomlings-api
125
21
  ```
126
- [
127
- {
128
- name: 'Demon Pack 13',
129
- id: 49,
130
- levels: [ 764038, 897837, 848722 ],
131
- stars: 10,
132
- coins: 2,
133
- difficulty: 'Hard Demon',
134
- textColor: '#00FF00',
135
- barColor: '#00FF00'
136
- },
137
- {
138
- name: 'Demon Pack 14',
139
- id: 50,
140
- levels: [ 840397, 413504, 839175 ],
141
- stars: 10,
142
- coins: 2,
143
- difficulty: 'Hard Demon',
144
- textColor: '#00FFFF',
145
- barColor: '#00FFFF'
146
- },
147
- {
148
- name: 'Demon Pack 15',
149
- id: 64,
150
- levels: [ 1018758, 1326086, 1698428 ],
151
- stars: 10,
152
- coins: 2,
153
- difficulty: 'Hard Demon',
154
- textColor: '#FF0000',
155
- barColor: '#FF0000'
156
- },
157
- {
158
- name: 'Demon Pack 16',
159
- id: 65,
160
- levels: [ 1668421, 1703546, 923264 ],
161
- stars: 10,
162
- coins: 2,
163
- difficulty: 'Hard Demon',
164
- textColor: '#FFFF00',
165
- barColor: '#FFFF00'
166
- },
167
- {
168
- name: 'Demon Pack 17',
169
- id: 66,
170
- levels: [ 1650666, 1474319, 1777565 ],
171
- stars: 10,
172
- coins: 2,
173
- difficulty: 'Hard Demon',
174
- textColor: '#96FF96',
175
- barColor: '#96FF96'
176
- }
177
- ]
22
+ ## In browser...
23
+ ```html
24
+ <script src="https://shikoshib.github.io/gba-max.min.js"></script>
178
25
  ```
179
26
 
180
- **Check out [docs](./docs/) for more info.**
181
-
182
27
  ---
183
28
 
184
29
  Inspired by [GDBrowser](https://github.com/GDColon/GDBrowser/). Thanks to [Wireshark](https://www.wireshark.org/) and [GD Docs](https://github.com/gd-programming/gd.docs/) for helping me in creating this package.
package/config.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "Accept-Encoding":"*",
6
6
  "Accept":"*/*"
7
7
  },
8
- "server":"http://www.boomlings.com/database/",
8
+ "server":"https://www.boomlings.com/database/",
9
9
  "secret":"Wmfd2893gb7"
10
10
  }
@@ -24,6 +24,7 @@ module.exports = {
24
24
  }
25
25
 
26
26
  let res = await gjReq("blockGJUser20", data);
27
+ if(res.data == -1) throw new Error(-1);
27
28
 
28
29
  return 1;
29
30
  }
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ deleteLevel:
3
+ async function(lvl, str, password) {
4
+ if(!lvl || lvl == "") throw new Error("Please provide a level ID!");
5
+ if(!str || str == "") throw new Error("Please provide a user ID or name!");
6
+ if(!password || password == "") throw new Error("Please provide a password!");
7
+
8
+ const {gjReq} = require("../misc/gjReq.js");
9
+ const { searchUsers } = require("./searchUsers.js");
10
+ const {gjp} = require("../misc/gjp.js");
11
+
12
+ let user = await searchUsers(str);
13
+
14
+ let data = {
15
+ accountID: user.accountID,
16
+ secret: "Wmfv2898gc9",
17
+ levelID: lvl,
18
+ gjp: gjp(password),
19
+ };
20
+
21
+ let res = await gjReq("deleteGJLevelUser20", data);
22
+ if(res.data == -1) throw new Error(-1);
23
+
24
+ return 1;
25
+ }
26
+ }
@@ -8,11 +8,12 @@ module.exports = {
8
8
  const { decodeLevelRes } = require("../misc/decodeLevelRes.js");
9
9
  const { searchUsers } = require("./searchUsers.js");
10
10
 
11
- let user = await searchUsers(str);
11
+ let user = str;
12
+ if(isNaN(str)) user = await (await searchUsers(str)).playerID;
12
13
 
13
14
  const data = {
14
15
  type: 5,
15
- str: user.playerID,
16
+ str: user,
16
17
  secret: secret,
17
18
  page: Number(page) - 1
18
19
  }
@@ -24,6 +24,7 @@ module.exports = {
24
24
  }
25
25
 
26
26
  let res = await gjReq("unblockGJUser20", data)
27
+ if(res.data == -1) throw new Error(-1);
27
28
 
28
29
  return 1;
29
30
  }
@@ -40,7 +40,7 @@ module.exports = {
40
40
 
41
41
  if(res.data == -1) throw new Error("Whoops, the servers have rejected your request!");
42
42
  if(res.data == -10) throw new Error("You're permanently banned from commenting!");
43
- if(res.data.startsWith("temp_")) throw new Error(`You're temporarily banned from commenting!\nRemaining duration: ${edata.split("_")[1]}\nReason: ${edata.split("_")[2]}`);
43
+ if(res.data.startsWith("temp_")) throw new Error(`You're temporarily banned from commenting!\nRemaining duration: ${edata.split("_")[1]} seconds\nReason: ${edata.split("_")[2]}`);
44
44
 
45
45
  return res.data;
46
46
  }
package/index.js CHANGED
@@ -31,6 +31,7 @@ const { uploadMessage } = require("./functions/uploadMessage.js");
31
31
  const { searchUsers } = require("./functions/searchUsers.js");
32
32
  const { getFriendsList } = require("./functions/getFriendsList.js");
33
33
  const { getBlockedList } = require("./functions/getBlockedList.js");
34
+ const { deleteLevel } = require("./functions/deleteLevel.js");
34
35
 
35
36
  module.exports.dlLevel = dlLevel;
36
37
  module.exports.getSongInfo = getSongInfo;
@@ -61,4 +62,5 @@ module.exports.dlMessage = dlMessage;
61
62
  module.exports.uploadMessage = uploadMessage;
62
63
  module.exports.searchUsers = searchUsers;
63
64
  module.exports.getFriendsList = getFriendsList;
64
- module.exports.getBlockedList = getBlockedList;
65
+ module.exports.getBlockedList = getBlockedList;
66
+ module.exports.deleteLevel = deleteLevel;
@@ -129,9 +129,6 @@ module.exports = {
129
129
 
130
130
  song = songinfo;
131
131
  }
132
-
133
- const { demonlist } = require("./demonlist.js");
134
- let dlist = await demonlist(name);
135
132
 
136
133
  let result = {
137
134
  id: Number(id),
@@ -159,8 +156,10 @@ module.exports = {
159
156
  song: song
160
157
  }
161
158
 
162
- if(dlist != null) {
163
- result['pointercrate'] = dlist;
159
+ if(["Extreme Demon", "Insane Demon"].includes(difficultyDecoding[difficulty])) {
160
+ const { demonlist } = require("./demonlist.js");
161
+ const dlist = await demonlist(name.trim());
162
+ if(dlist != null) result.pointercrate = dlist;
164
163
  }
165
164
 
166
165
  return result;
package/misc/gjReq.js CHANGED
@@ -2,15 +2,17 @@ module.exports = {
2
2
  gjReq:
3
3
  async function(endpoint, data) {
4
4
  const { server } = require("../config.json");
5
+ let headers = new Headers({
6
+ "Content-Type": "application/x-www-form-urlencoded",
7
+ "User-Agent": " ",
8
+ "Accept-Encoding": "*",
9
+ "Accept": "*/*"
10
+ })
5
11
 
6
12
  let r = await fetch(`${server}${endpoint.endsWith(".php") ? endpoint.split(".php")[0] : endpoint}.php`, {
7
13
  method: 'POST',
8
- headers: {
9
- "Content-Type":"application/x-www-form-urlencoded",
10
- "user-agent":"",
11
- "Accept-Encoding":"*",
12
- "Accept":"*/*"
13
- },
14
+ mode: "no-cors",
15
+ headers: headers,
14
16
  body: new URLSearchParams(data)
15
17
  })
16
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "A light-weight Geometry Dash API wrapper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "bugs": {
17
17
  "url": "https://github.com/shikoshib/gj-boomlings-api/issues"
18
18
  },
19
- "homepage": "https://shikoshib.github.io/gj-boomlings-api/",
19
+ "homepage": "https://github.com/shikoshib/gj-boomlings-api/wiki",
20
20
  "keywords": [
21
21
  "geometrydash",
22
22
  "gd",