Add get gauntlets endpoint
This commit is contained in:
6 files changed
+103
-1
No files matched your search
@@ -1,9 +1,23 @@
|
||||
import { Elysia } from 'elysia'
|
||||
import { jsonResponse } from './lib/util'
|
||||
|
||||
import { handler as gauntletsGetHandler } from './routes/gauntlets/get'
|
||||
|
||||
const app = new Elysia()
|
||||
|
||||
app.listen(3692)
|
||||
|
||||
app.get('/gauntlets', gauntletsGetHandler)
|
||||
app.all('*', () =>
|
||||
jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Endpoint not found (are you using the correct request method?)'
|
||||
},
|
||||
404
|
||||
)
|
||||
)
|
||||
|
||||
console.log(
|
||||
`Geometry Dash API Server started on http://${app.server?.hostname}:${app.server?.port}/`
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
export const jsonResponse = (data: any, status = 200) => {
|
||||
return new Response(JSON.stringify(data, null, 2), {
|
||||
status,
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import axios from 'axios'
|
||||
import { jsonResponse } from '../../lib/util'
|
||||
|
||||
export const handler = async () => {
|
||||
const request = await axios.post(
|
||||
'https://www.boomlings.com/database/getGJGauntlets21.php',
|
||||
new URLSearchParams({
|
||||
gameVersion: '22',
|
||||
binaryVersion: '45',
|
||||
secret: 'Wmfd2893gb7',
|
||||
special: '1'
|
||||
}),
|
||||
{
|
||||
headers: {
|
||||
'User-Agent': ' ',
|
||||
Cookie: 'gd=1'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const responseText = request.data as string
|
||||
const responseSplit = responseText.split('#')[0].split('|')
|
||||
|
||||
return jsonResponse(
|
||||
responseSplit.map(item => {
|
||||
const split = item.split(':')
|
||||
return {
|
||||
id: split[1],
|
||||
name: 'n/a',
|
||||
levels: split[3].split(',')
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user