gj-boomlings-api 1.3.5 → 1.3.6
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 +1 -1
- package/functions/blockUser.js +1 -0
- package/functions/getUserLevels.js +50 -4
- package/functions/searchLevels.js +50 -4
- package/misc/decodeLevel.js +29 -62
- package/misc/decodeLevelRes.js +135 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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>
|
|
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>
|
|
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
7
|
<a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/dt/gj-boomlings-api" /></a>
|
|
8
8
|
<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>
|
package/functions/blockUser.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
blockUser:
|
|
2
3
|
async function(target, username, password) {
|
|
3
4
|
if(!target || target == "") throw new Error("Please provide a target's player ID or username!");
|
|
4
5
|
if(!username || username == "") throw new Error("Please provide your player ID or username!");
|
|
@@ -5,7 +5,7 @@ module.exports = {
|
|
|
5
5
|
|
|
6
6
|
const axios = require("axios");
|
|
7
7
|
const { headers, secret, server } = require("../config.json");
|
|
8
|
-
const {
|
|
8
|
+
const { decodeLevelRes } = require("../misc/decodeLevelRes.js");
|
|
9
9
|
const { searchUsers } = require("./searchUsers.js");
|
|
10
10
|
|
|
11
11
|
let user = await searchUsers(str);
|
|
@@ -24,10 +24,56 @@ module.exports = {
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
let levels = res.data.split("#")[0].split("|");
|
|
27
|
+
let creators = res.data.split("#")[1].split("|");
|
|
28
|
+
let songs = res.data.split("#")[2].split(":");
|
|
29
|
+
|
|
27
30
|
let result = [];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
let encCreators = {};
|
|
33
|
+
let encSongs = {};
|
|
34
|
+
|
|
35
|
+
creators.forEach(c => {
|
|
36
|
+
let playerID = c.split(":")[0];
|
|
37
|
+
let username = c.split(":")[1];
|
|
38
|
+
encCreators[playerID] = username;
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
songs.forEach(s => {
|
|
42
|
+
let songId = s.split("~|~")[1];
|
|
43
|
+
let songName = s.split("~|~")[3];
|
|
44
|
+
let songArtistID = s.split("~|~")[5];
|
|
45
|
+
let songArtist = s.split("~|~")[7];
|
|
46
|
+
let size = s.split("~|~")[9];
|
|
47
|
+
let link = s.split("~|~")[13];
|
|
48
|
+
|
|
49
|
+
encSongs[songId] = {
|
|
50
|
+
"name": songName,
|
|
51
|
+
"id": Number(songId),
|
|
52
|
+
"artist": songArtist,
|
|
53
|
+
"artistId": Number(songArtistID),
|
|
54
|
+
"fileSize": `${size} MB`,
|
|
55
|
+
"link": decodeURIComponent(link)
|
|
56
|
+
};
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
for(const l of levels) {
|
|
60
|
+
let decLvl = decodeLevelRes(l);
|
|
61
|
+
const { getOfficialSongInfo } = require("./getOfficialSongInfo.js");
|
|
62
|
+
|
|
63
|
+
let lvl = decLvl.res;
|
|
64
|
+
let officialSongID = Number(decLvl.officialSong);
|
|
65
|
+
let songID = Number(decLvl.customSong);
|
|
66
|
+
let playerId = decLvl.playerID;
|
|
67
|
+
let song;
|
|
68
|
+
|
|
69
|
+
if(officialSongID == 0 && songID != 0 || officialSongID != 0 && songID != 0) song = encSongs[songID.toString()];
|
|
70
|
+
if(officialSongID != 0 && songID == 0) song = getOfficialSongInfo(officialSongID + 1);
|
|
71
|
+
if(officialSongID == 0 && songID == 0) song = getOfficialSongInfo(1);
|
|
72
|
+
|
|
73
|
+
lvl['creator'] = encCreators[playerId] != undefined ? encCreators[playerId] : "-";
|
|
74
|
+
lvl['song'] = song;
|
|
75
|
+
|
|
76
|
+
result.push(lvl);
|
|
31
77
|
}
|
|
32
78
|
|
|
33
79
|
return result;
|
|
@@ -4,7 +4,7 @@ module.exports = {
|
|
|
4
4
|
const axios = require("axios");
|
|
5
5
|
const { headers, server, secret } = require("../config.json");
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { decodeLevelRes } = require("../misc/decodeLevelRes.js");
|
|
8
8
|
|
|
9
9
|
const data = {
|
|
10
10
|
type: 0,
|
|
@@ -20,10 +20,56 @@ module.exports = {
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
let levels = res.data.split("#")[0].split("|");
|
|
23
|
+
let creators = res.data.split("#")[1].split("|");
|
|
24
|
+
let songs = res.data.split("#")[2].split(":");
|
|
25
|
+
|
|
23
26
|
let result = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
let encCreators = {};
|
|
29
|
+
let encSongs = {};
|
|
30
|
+
|
|
31
|
+
creators.forEach(c => {
|
|
32
|
+
let playerID = c.split(":")[0];
|
|
33
|
+
let username = c.split(":")[1];
|
|
34
|
+
encCreators[playerID] = username;
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
songs.forEach(s => {
|
|
38
|
+
let songId = s.split("~|~")[1];
|
|
39
|
+
let songName = s.split("~|~")[3];
|
|
40
|
+
let songArtistID = s.split("~|~")[5];
|
|
41
|
+
let songArtist = s.split("~|~")[7];
|
|
42
|
+
let size = s.split("~|~")[9];
|
|
43
|
+
let link = s.split("~|~")[13];
|
|
44
|
+
|
|
45
|
+
encSongs[songId] = {
|
|
46
|
+
"name": songName,
|
|
47
|
+
"id": Number(songId),
|
|
48
|
+
"artist": songArtist,
|
|
49
|
+
"artistId": Number(songArtistID),
|
|
50
|
+
"fileSize": `${size} MB`,
|
|
51
|
+
"link": decodeURIComponent(link)
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
for(const l of levels) {
|
|
56
|
+
let decLvl = decodeLevelRes(l);
|
|
57
|
+
const { getOfficialSongInfo } = require("./getOfficialSongInfo.js");
|
|
58
|
+
|
|
59
|
+
let lvl = decLvl.res;
|
|
60
|
+
let officialSongID = Number(decLvl.officialSong);
|
|
61
|
+
let songID = Number(decLvl.customSong);
|
|
62
|
+
let playerId = decLvl.playerID;
|
|
63
|
+
let song;
|
|
64
|
+
|
|
65
|
+
if(officialSongID == 0 && songID != 0 || officialSongID != 0 && songID != 0) song = encSongs[songID.toString()];
|
|
66
|
+
if(officialSongID != 0 && songID == 0) song = getOfficialSongInfo(officialSongID + 1);
|
|
67
|
+
if(officialSongID == 0 && songID == 0) song = getOfficialSongInfo(1);
|
|
68
|
+
|
|
69
|
+
lvl['creator'] = encCreators[playerId] != undefined ? encCreators[playerId] : "-";
|
|
70
|
+
lvl['song'] = song;
|
|
71
|
+
|
|
72
|
+
result.push(lvl);
|
|
27
73
|
}
|
|
28
74
|
|
|
29
75
|
return result;
|
package/misc/decodeLevel.js
CHANGED
|
@@ -108,15 +108,8 @@ module.exports = {
|
|
|
108
108
|
const { getOfficialSongInfo } = require("../functions/getOfficialSongInfo.js");
|
|
109
109
|
|
|
110
110
|
let song;
|
|
111
|
-
|
|
112
|
-
if(Number(officialSong)
|
|
113
|
-
song = getOfficialSongInfo(Number(officialSong) + 1);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if(Number(officialSong) == 0 && Number(customSong) == 0) {
|
|
117
|
-
song = getOfficialSongInfo(1);
|
|
118
|
-
}
|
|
119
|
-
|
|
111
|
+
if(Number(officialSong) > 0) song = getOfficialSongInfo(Number(officialSong) + 1);
|
|
112
|
+
if(Number(officialSong) == 0 && Number(customSong) == 0) song = getOfficialSongInfo(1);
|
|
120
113
|
if(Number(customSong) > 0) {
|
|
121
114
|
let songName = level.split("~|~2~|~")[1].split("~|~3~|~")[0]
|
|
122
115
|
let songId = Number(level.split("#1~|~")[1].split("~|~2~|~")[0])
|
|
@@ -137,64 +130,38 @@ module.exports = {
|
|
|
137
130
|
song = songinfo;
|
|
138
131
|
}
|
|
139
132
|
|
|
140
|
-
let result;
|
|
141
133
|
const { demonlist } = require("./demonlist.js");
|
|
142
134
|
let dlist = await demonlist(name);
|
|
143
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: demonBoolDecoding[demonBool],
|
|
149
|
+
featured: featured,
|
|
150
|
+
epic: demonBoolDecoding[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: demonBoolDecoding[twoPlayer],
|
|
157
|
+
coins: Number(coins),
|
|
158
|
+
verified_coins: verifiedCoins,
|
|
159
|
+
song: song
|
|
160
|
+
}
|
|
161
|
+
|
|
144
162
|
if(dlist != null) {
|
|
145
|
-
result =
|
|
146
|
-
id: Number(id),
|
|
147
|
-
name: name,
|
|
148
|
-
description: decB64(desc),
|
|
149
|
-
creator: author,
|
|
150
|
-
level_version: Number(version),
|
|
151
|
-
difficulty: difficultyDecoding[difficulty],
|
|
152
|
-
stars: Number(stars),
|
|
153
|
-
downloads: Number(downloads),
|
|
154
|
-
likes: Number(likes),
|
|
155
|
-
disliked: disliked,
|
|
156
|
-
length: lengthDecoding[length],
|
|
157
|
-
demon: demonBoolDecoding[demonBool],
|
|
158
|
-
featured: featured,
|
|
159
|
-
epic: demonBoolDecoding[epic],
|
|
160
|
-
objects: Number(objs),
|
|
161
|
-
stars_requested: Number(starsRequested),
|
|
162
|
-
game_version: decodeGameVersion[gameVersion],
|
|
163
|
-
copied: Number(copiedID),
|
|
164
|
-
large: Number(objs) > 40000 ? true : false,
|
|
165
|
-
two_p: demonBoolDecoding[twoPlayer],
|
|
166
|
-
coins: Number(coins),
|
|
167
|
-
verified_coins: verifiedCoins,
|
|
168
|
-
song: song,
|
|
169
|
-
pointercrate: dlist
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
result = {
|
|
173
|
-
id: Number(id),
|
|
174
|
-
name: name,
|
|
175
|
-
description: decB64(desc),
|
|
176
|
-
creator: author,
|
|
177
|
-
level_version: Number(version),
|
|
178
|
-
difficulty: difficultyDecoding[difficulty],
|
|
179
|
-
stars: Number(stars),
|
|
180
|
-
downloads: Number(downloads),
|
|
181
|
-
likes: Number(likes),
|
|
182
|
-
disliked: disliked,
|
|
183
|
-
length: lengthDecoding[length],
|
|
184
|
-
demon: demonBoolDecoding[demonBool],
|
|
185
|
-
featured: featured,
|
|
186
|
-
epic: demonBoolDecoding[epic],
|
|
187
|
-
objects: Number(objs),
|
|
188
|
-
stars_requested: Number(starsRequested),
|
|
189
|
-
game_version: decodeGameVersion[gameVersion],
|
|
190
|
-
copied: Number(copiedID),
|
|
191
|
-
large: Number(objs) > 40000 ? true : false,
|
|
192
|
-
two_p: demonBoolDecoding[twoPlayer],
|
|
193
|
-
coins: Number(coins),
|
|
194
|
-
verified_coins: verifiedCoins,
|
|
195
|
-
song: song
|
|
163
|
+
result['pointercrate'] = dlist;
|
|
196
164
|
}
|
|
197
|
-
}
|
|
198
165
|
|
|
199
166
|
return result;
|
|
200
167
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
decodeLevelRes:
|
|
3
|
+
function(level){
|
|
4
|
+
const {decB64} = require("./decB64.js");
|
|
5
|
+
|
|
6
|
+
let spl = level.split(':');
|
|
7
|
+
let levelInfo = [];
|
|
8
|
+
for(let i =0;i<spl.length;i++) {
|
|
9
|
+
if(i%2!=0) {
|
|
10
|
+
levelInfo.push(spl[i-1]+`:`+spl[i]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let id = levelInfo[0].split("1:")[1];
|
|
15
|
+
let name = levelInfo[1].split("2:")[1];
|
|
16
|
+
let version = levelInfo[2].split("5:")[1];
|
|
17
|
+
let playerID = levelInfo[3].split("6:")[1];
|
|
18
|
+
let difficulty = levelInfo[5].split("9:")[1];
|
|
19
|
+
let downloads = levelInfo[6].split("10:")[1];
|
|
20
|
+
let officialSong = levelInfo[7].split("12:")[1];
|
|
21
|
+
let gameVersion = levelInfo[8].split("13:")[1];
|
|
22
|
+
let likes = levelInfo[9].split("14:")[1];
|
|
23
|
+
let demonBool = levelInfo[10].split("17:")[1];
|
|
24
|
+
let stars = levelInfo[13].split("18:")[1];
|
|
25
|
+
let ftrd = levelInfo[14].split("19:")[1];
|
|
26
|
+
let epic = levelInfo[15].split("42:")[1];
|
|
27
|
+
let objs = levelInfo[16].split("45:")[1];
|
|
28
|
+
let desc = levelInfo[17].split("3:")[1];
|
|
29
|
+
let length = levelInfo[18].split("15:")[1];
|
|
30
|
+
let copiedID = levelInfo[19].split("30:")[1];
|
|
31
|
+
let twoPlayer = levelInfo[20].split("31:")[1];
|
|
32
|
+
let coins = levelInfo[21].split("37:")[1];
|
|
33
|
+
let verifiedCoins = levelInfo[22].split("38:")[1];
|
|
34
|
+
let starsRequested = levelInfo[23].split("39:")[1];
|
|
35
|
+
let customSong = levelInfo[26].split("35:")[1].split("#")[0];
|
|
36
|
+
|
|
37
|
+
let disliked = false;
|
|
38
|
+
if(likes.includes("-")) disliked = true;
|
|
39
|
+
|
|
40
|
+
if(desc.includes("/")) desc = desc.split("/")[0];
|
|
41
|
+
if(decB64(desc) == '') desc = "KE5vIGRlc2NyaXB0aW9uIHByb3ZpZGVkKQ=="
|
|
42
|
+
|
|
43
|
+
if(verifiedCoins == "0") verifiedCoins = false;
|
|
44
|
+
if(verifiedCoins == "1") verifiedCoins = true;
|
|
45
|
+
|
|
46
|
+
let demonBoolDecoding = {
|
|
47
|
+
'1': true,
|
|
48
|
+
'': false,
|
|
49
|
+
'0': false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let featuredDecoding = {
|
|
53
|
+
"0": false,
|
|
54
|
+
"1": true,
|
|
55
|
+
undefined: true
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let featured = featuredDecoding[ftrd];
|
|
59
|
+
if(featured == undefined) featured = true;
|
|
60
|
+
|
|
61
|
+
let difficultyDecoding = {
|
|
62
|
+
"-10": "Auto",
|
|
63
|
+
"0": "Unrated",
|
|
64
|
+
"10": "Easy",
|
|
65
|
+
"20": "Normal",
|
|
66
|
+
"30": "Hard",
|
|
67
|
+
"40": "Harder",
|
|
68
|
+
"50": "Insane"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if(demonBoolDecoding[demonBool] == true) {
|
|
72
|
+
difficultyDecoding = {
|
|
73
|
+
"10": "Easy Demon",
|
|
74
|
+
"20": "Medium Demon",
|
|
75
|
+
"30": "Hard Demon",
|
|
76
|
+
"40": "Insane Demon",
|
|
77
|
+
"50": "Extreme Demon"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const lengthDecoding = {
|
|
82
|
+
"0": "Tiny",
|
|
83
|
+
"1": "Short",
|
|
84
|
+
"2": "Medium",
|
|
85
|
+
"3": "Long",
|
|
86
|
+
"4": "XL"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const decodeGameVersion = {
|
|
90
|
+
"1": "Pre-1.7",
|
|
91
|
+
"2": "Pre-1.7",
|
|
92
|
+
"3": "Pre-1.7",
|
|
93
|
+
"4": "Pre-1.7",
|
|
94
|
+
"5": "Pre-1.7",
|
|
95
|
+
"6": "Pre-1.7",
|
|
96
|
+
"7": "Pre-1.7",
|
|
97
|
+
"10": "1.7",
|
|
98
|
+
"18": "1.8",
|
|
99
|
+
"19": "1.9",
|
|
100
|
+
"20": "2.0",
|
|
101
|
+
"21": "2.1"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let result = {
|
|
105
|
+
id: Number(id),
|
|
106
|
+
name: name,
|
|
107
|
+
description: decB64(desc),
|
|
108
|
+
level_version: Number(version),
|
|
109
|
+
difficulty: difficultyDecoding[difficulty],
|
|
110
|
+
stars: Number(stars),
|
|
111
|
+
downloads: Number(downloads),
|
|
112
|
+
likes: Number(likes),
|
|
113
|
+
disliked: disliked,
|
|
114
|
+
length: lengthDecoding[length],
|
|
115
|
+
demon: demonBoolDecoding[demonBool],
|
|
116
|
+
featured: featured,
|
|
117
|
+
epic: demonBoolDecoding[epic],
|
|
118
|
+
objects: Number(objs),
|
|
119
|
+
stars_requested: Number(starsRequested),
|
|
120
|
+
game_version: decodeGameVersion[gameVersion],
|
|
121
|
+
copied: Number(copiedID),
|
|
122
|
+
large: Number(objs) > 40000 ? true : false,
|
|
123
|
+
two_p: demonBoolDecoding[twoPlayer],
|
|
124
|
+
coins: Number(coins),
|
|
125
|
+
verified_coins: verifiedCoins
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
res: result,
|
|
130
|
+
playerID: playerID,
|
|
131
|
+
officialSong: officialSong,
|
|
132
|
+
customSong: customSong
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|