Add daily/weekly level endpoint
This commit is contained in:
5 files changed
+70
-3
No files matched your search
@@ -13,6 +13,8 @@ This is very early in development and will not be finished for a long time likel
|
|||||||
- [x] Get leaderboards
|
- [x] Get leaderboards
|
||||||
- [x] Get classic level scores
|
- [x] Get classic level scores
|
||||||
- [x] Get plat level scores
|
- [x] Get plat level scores
|
||||||
|
- [x] Get daily/weekly level
|
||||||
|
- [ ] Get event level
|
||||||
- [ ] 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?)
|
||||||
@@ -27,7 +29,6 @@ This is very early in development and will not be finished for a long time likel
|
|||||||
- [ ] Get user list (friends list?)
|
- [ ] Get user list (friends list?)
|
||||||
- [ ] Get rewards (chests?)
|
- [ ] Get rewards (chests?)
|
||||||
- [ ] Get secret reward (new 2.2 vault?)
|
- [ ] Get secret reward (new 2.2 vault?)
|
||||||
- [ ] Get daily level
|
|
||||||
- [ ] Get challenges (unknown)
|
- [ ] Get challenges (unknown)
|
||||||
- [ ] Get account URL (unknown)
|
- [ ] Get account URL (unknown)
|
||||||
- [ ] Get song info
|
- [ ] Get song info
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { jsonResponse } from './lib/util'
|
|||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import swagger from '@elysiajs/swagger'
|
import swagger from '@elysiajs/swagger'
|
||||||
|
|
||||||
|
import { handler as eventLevelGetHandler } from './routes/event-level/get'
|
||||||
|
|
||||||
import { handler as gauntletsGetHandler } from './routes/gauntlets/get'
|
import { handler as gauntletsGetHandler } from './routes/gauntlets/get'
|
||||||
|
|
||||||
import { handler as leaderboardsGetHandler } from './routes/leaderboards/get'
|
import { handler as leaderboardsGetHandler } from './routes/leaderboards/get'
|
||||||
@@ -106,6 +108,18 @@ app.get(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
app.get('/daily-level', () => eventLevelGetHandler('0'), {
|
||||||
|
detail: {
|
||||||
|
description: 'The endpoint for getting the daily level',
|
||||||
|
tags: ['Levels']
|
||||||
|
}
|
||||||
|
})
|
||||||
|
app.get('/weekly-level', () => eventLevelGetHandler('1'), {
|
||||||
|
detail: {
|
||||||
|
description: 'The endpoint for getting the weekly level',
|
||||||
|
tags: ['Levels']
|
||||||
|
}
|
||||||
|
})
|
||||||
app.get(
|
app.get(
|
||||||
'/',
|
'/',
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export const encodeGJP2 = async (password = '', salt = 'mI29fmAnxgTs') => {
|
|||||||
.map(b => b.toString(16).padStart(2, '0'))
|
.map(b => b.toString(16).padStart(2, '0'))
|
||||||
.join('')
|
.join('')
|
||||||
}
|
}
|
||||||
|
|
||||||
export const generateTimeLength = (ms: number): string => {
|
export const generateTimeLength = (ms: number): string => {
|
||||||
const minutes = Math.floor(ms / 60000)
|
const minutes = Math.floor(ms / 60000)
|
||||||
const seconds = Math.floor((ms % 60000) / 1000)
|
const seconds = Math.floor((ms % 60000) / 1000)
|
||||||
@@ -31,3 +32,25 @@ export const generateTimeLength = (ms: number): string => {
|
|||||||
|
|
||||||
return `${minutes}:${secStr}.${msStr}`
|
return `${minutes}:${secStr}.${msStr}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const formatTime = (seconds: number): string => {
|
||||||
|
const units = [
|
||||||
|
{ label: 'y', value: 365 * 24 * 3600 },
|
||||||
|
{ label: 'mo', value: 30 * 24 * 3600 },
|
||||||
|
{ label: 'd', value: 24 * 3600 },
|
||||||
|
{ label: 'h', value: 3600 },
|
||||||
|
{ label: 'm', value: 60 },
|
||||||
|
{ label: 's', value: 1 }
|
||||||
|
]
|
||||||
|
|
||||||
|
const parts = []
|
||||||
|
for (const { label, value } of units) {
|
||||||
|
const amount = Math.floor(seconds / value)
|
||||||
|
if (amount) {
|
||||||
|
parts.push(`${amount}${label}`)
|
||||||
|
seconds %= value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts.join(' ') || '0s'
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import { formatTime, jsonResponse } from '../../lib/util'
|
||||||
|
|
||||||
|
export const handler = async (type: string) => {
|
||||||
|
const request = await axios.post(
|
||||||
|
'https://www.boomlings.com/database/getGJDailyLevel.php',
|
||||||
|
new URLSearchParams({
|
||||||
|
gameVersion: '22',
|
||||||
|
binaryVersion: '45',
|
||||||
|
secret: 'Wmfd2893gb7',
|
||||||
|
type
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'User-Agent': ' ',
|
||||||
|
Cookie: 'gd=1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const responseText = request.data as string
|
||||||
|
const responseSplit = responseText.split('|')
|
||||||
|
|
||||||
|
return jsonResponse({
|
||||||
|
...(type === '0'
|
||||||
|
? { dailyId: +responseSplit[0] }
|
||||||
|
: { weeklyId: +responseSplit[0] }),
|
||||||
|
remaining: formatTime(Number(responseSplit[1])),
|
||||||
|
remainingSeconds: +responseSplit[1]
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -7,8 +7,6 @@ export const handler = async () => {
|
|||||||
new URLSearchParams({
|
new URLSearchParams({
|
||||||
gameVersion: '22',
|
gameVersion: '22',
|
||||||
binaryVersion: '45',
|
binaryVersion: '45',
|
||||||
udid: 'BEA53432-326F-4D39-91D7-2B51B849825E',
|
|
||||||
uuid: '329348841',
|
|
||||||
count: '250',
|
count: '250',
|
||||||
page: '0',
|
page: '0',
|
||||||
secret: 'Wmfd2893gb7'
|
secret: 'Wmfd2893gb7'
|
||||||
|
|||||||
Reference in new issue
Block a user