Add leaderboards
This commit is contained in:
4 files changed
+69
-1
No files matched your search
@@ -8,13 +8,13 @@ A wrapper for the official Geometry Dash API
|
|||||||
|
|
||||||
- [x] Get gauntlets (not names yet)
|
- [x] Get gauntlets (not names yet)
|
||||||
- [x] Get map packs
|
- [x] Get map packs
|
||||||
|
- [x] Get leaderboards
|
||||||
- [ ] Get Levels List
|
- [ ] Get Levels List
|
||||||
- [ ] Get save data
|
- [ ] Get save data
|
||||||
- [ ] Get level lists (same as map packs?)
|
- [ ] Get level lists (same as map packs?)
|
||||||
- [ ] Get top artists (not sure what this is)
|
- [ ] Get top artists (not sure what this is)
|
||||||
- [ ] Get user (profile?)
|
- [ ] Get user (profile?)
|
||||||
- [ ] Get user info
|
- [ ] Get user info
|
||||||
- [ ] Get scores (leaderboards?)
|
|
||||||
- [ ] Get level scores
|
- [ ] Get level scores
|
||||||
- [ ] Get plat level scores
|
- [ ] Get plat level scores
|
||||||
- [ ] Get messages (account?)
|
- [ ] Get messages (account?)
|
||||||
|
|||||||
@@ -5,12 +5,16 @@ import { handler as gauntletsGetHandler } from './routes/gauntlets/get'
|
|||||||
|
|
||||||
import { handler as mapPacksGetHandler } from './routes/map-packs/get'
|
import { handler as mapPacksGetHandler } from './routes/map-packs/get'
|
||||||
|
|
||||||
|
import { handler as leaderboardsGetHandler } from './routes/leaderboards/get'
|
||||||
|
|
||||||
const app = new Elysia()
|
const app = new Elysia()
|
||||||
|
|
||||||
app.listen(3692)
|
app.listen(3692)
|
||||||
|
|
||||||
app.get('/gauntlets', gauntletsGetHandler)
|
app.get('/gauntlets', gauntletsGetHandler)
|
||||||
app.get('/map-packs', mapPacksGetHandler)
|
app.get('/map-packs', mapPacksGetHandler)
|
||||||
|
app.get('/leaderboards/top', () => leaderboardsGetHandler('top'))
|
||||||
|
app.get('/leaderboards/creators', () => leaderboardsGetHandler('creators'))
|
||||||
app.all('*', () =>
|
app.all('*', () =>
|
||||||
jsonResponse(
|
jsonResponse(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,3 +4,12 @@ export const jsonResponse = (data: any, status = 200) => {
|
|||||||
headers: { 'Content-Type': 'application/json' }
|
headers: { 'Content-Type': 'application/json' }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const splitGd = (input: string): Record<string, string> => {
|
||||||
|
const parts = input.split(':')
|
||||||
|
const result: Record<string, string> = {}
|
||||||
|
for (let i = 0; i < parts.length - 1; i += 2) {
|
||||||
|
result[parts[i]] = parts[i + 1]
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import { jsonResponse, splitGd } from '../../lib/util'
|
||||||
|
|
||||||
|
export const handler = async (type: string) => {
|
||||||
|
const request = await axios.post(
|
||||||
|
'https://www.boomlings.com/database/getGJScores20.php',
|
||||||
|
new URLSearchParams({
|
||||||
|
gameVersion: '22',
|
||||||
|
binaryVersion: '45',
|
||||||
|
type,
|
||||||
|
count: '100',
|
||||||
|
secret: 'Wmfd2893gb7'
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'User-Agent': ' ',
|
||||||
|
Cookie: 'gd=1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const responseText = request.data as string
|
||||||
|
const responseSplit = responseText.split('|')
|
||||||
|
|
||||||
|
return jsonResponse(
|
||||||
|
responseSplit.map(item => {
|
||||||
|
const split = splitGd(item)
|
||||||
|
return {
|
||||||
|
username: split['1'],
|
||||||
|
playerId: +split['2'],
|
||||||
|
accountId: +split['16'],
|
||||||
|
rank: +split['6'],
|
||||||
|
stats: {
|
||||||
|
stars: +split['3'],
|
||||||
|
diamonds: +split['46'],
|
||||||
|
coins: +split['13'],
|
||||||
|
userCoins: +split['17'],
|
||||||
|
demons: +split['4'],
|
||||||
|
moons: +split['52'],
|
||||||
|
creatorPoints: +split['8']
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
form: ['icon', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider'][
|
||||||
|
+split['14']
|
||||||
|
],
|
||||||
|
icon: +split['9'],
|
||||||
|
col1: +split['10'],
|
||||||
|
col2: +split['11'],
|
||||||
|
colG: +split['51'],
|
||||||
|
glow: +split['15'] > 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user