Make all endpoints have x-forwarded-for header

This commit is contained in:
2026-01-31 00:14:34 -07:00
parent 4cbf0dbf5d
commit ef52f8fcac

View File

@@ -465,9 +465,24 @@ app.post('/get-verify-code', context => getVerifyCodeHandler(context), {
}, },
body: t.Object({ body: t.Object({
token: t.String() token: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
})
app.get('/can-load-client', context => canLoadClientHandler(context), {
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.get('/can-load-client', context => canLoadClientHandler(context))
app.get('/launcher/versions', context => launcherVersionsHandler(context), { app.get('/launcher/versions', context => launcherVersionsHandler(context), {
detail: { detail: {
description: description:
@@ -477,20 +492,41 @@ app.get('/launcher/versions', context => launcherVersionsHandler(context), {
query: t.Object({ query: t.Object({
platform: t.Optional(t.String({ examples: ['windows', 'macos', 'linux'] })), platform: t.Optional(t.String({ examples: ['windows', 'macos', 'linux'] })),
arch: t.Optional(t.String({ examples: ['x86_64', 'aarch64'] })) arch: t.Optional(t.String({ examples: ['x86_64', 'aarch64'] }))
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.get('/launcher/latest', launcherLatestHandler, { app.get('/launcher/latest', launcherLatestHandler, {
detail: { detail: {
description: 'The endpoint for getting the latest launcher version.', description: 'The endpoint for getting the latest launcher version.',
tags: ['Launcher'] tags: ['Launcher']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
}) })
app.get('/launcher/loader/latest', launcherLoaderLatestHandler, { app.get('/launcher/loader/latest', launcherLoaderLatestHandler, {
detail: { detail: {
description: description:
'The endpoint for getting the latest loader/auto updater version.', 'The endpoint for getting the latest loader/auto updater version.',
tags: ['Launcher'] tags: ['Launcher']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
}) })
app.get( app.get(
'/launcher/loader/update-data', '/launcher/loader/update-data',
@@ -506,6 +542,13 @@ app.get(
t.String({ examples: ['windows', 'macos', 'linux'] }) t.String({ examples: ['windows', 'macos', 'linux'] })
), ),
arch: t.Optional(t.String({ examples: ['x86_64', 'aarch64'] })) arch: t.Optional(t.String({ examples: ['x86_64', 'aarch64'] }))
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -521,6 +564,13 @@ app.post(
body: t.Object({ body: t.Object({
username: t.String(), username: t.String(),
password: t.String() password: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -537,6 +587,13 @@ app.post(
password: t.String(), password: t.String(),
email: t.String(), email: t.String(),
verifyCode: t.String() verifyCode: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -554,7 +611,12 @@ app.post(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -572,7 +634,12 @@ app.post(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -584,6 +651,13 @@ app.post('/account/forgot-username', accountForgotUsernamePostHandler, {
body: t.Object({ body: t.Object({
email: t.String(), email: t.String(),
verifyCode: t.String() verifyCode: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.post('/account/forgot-password', accountForgotPasswordPostHandler, { app.post('/account/forgot-password', accountForgotPasswordPostHandler, {
@@ -594,6 +668,13 @@ app.post('/account/forgot-password', accountForgotPasswordPostHandler, {
body: t.Object({ body: t.Object({
email: t.String(), email: t.String(),
verifyCode: t.String() verifyCode: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.post('/account/reset-password', accountResetPasswordPostHandler, { app.post('/account/reset-password', accountResetPasswordPostHandler, {
@@ -604,13 +685,27 @@ app.post('/account/reset-password', accountResetPasswordPostHandler, {
token: t.String(), token: t.String(),
code: t.String(), code: t.String(),
password: t.String() password: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.get('/berrydash/latest-version', berryDashLatestVersionGetHandler, { app.get('/berrydash/latest-version', berryDashLatestVersionGetHandler, {
detail: { detail: {
description: 'The endpoint for getting the latest berry dash version.', description: 'The endpoint for getting the latest berry dash version.',
tags: ['Berry Dash'] tags: ['Berry Dash']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
}) })
app.get( app.get(
'/berrydash/leaderboards/score', '/berrydash/leaderboards/score',
@@ -621,7 +716,14 @@ app.get(
description: description:
'This endpoint was renamed to `/berrydash/leaderboard/score` and will be removed on March 19th 2026.', 'This endpoint was renamed to `/berrydash/leaderboard/score` and will be removed on March 19th 2026.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -636,6 +738,13 @@ app.get(
}, },
query: t.Object({ query: t.Object({
berry: t.String() berry: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -648,7 +757,14 @@ app.get(
description: description:
'This endpoint was renamed to `/berrydash/leaderboard/coin` and will be removed on March 19th 2026.', 'This endpoint was renamed to `/berrydash/leaderboard/coin` and will be removed on March 19th 2026.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -660,7 +776,14 @@ app.get(
description: description:
'This endpoint was renamed to `/berrydash/leaderboard/legacy` and will be removed on March 19th 2026.', 'This endpoint was renamed to `/berrydash/leaderboard/legacy` and will be removed on March 19th 2026.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -672,7 +795,14 @@ app.get(
description: description:
'This endpoint was renamed to `/berrydash/leaderboard/total` and will be removed on March 19th 2026.', 'This endpoint was renamed to `/berrydash/leaderboard/total` and will be removed on March 19th 2026.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -682,7 +812,14 @@ app.get(
detail: { detail: {
description: 'The endpoint for getting the score leaderboards.', description: 'The endpoint for getting the score leaderboards.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -696,6 +833,13 @@ app.get(
}, },
query: t.Object({ query: t.Object({
berry: t.String({ examples: ['0', '1', '2', '3', '4', '5', '6', '7'] }) berry: t.String({ examples: ['0', '1', '2', '3', '4', '5', '6', '7'] })
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -706,7 +850,14 @@ app.get(
detail: { detail: {
description: 'The endpoint for getting the coin leaderboards.', description: 'The endpoint for getting the coin leaderboards.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -716,7 +867,14 @@ app.get(
detail: { detail: {
description: 'The endpoint for getting the legacy leaderboards.', description: 'The endpoint for getting the legacy leaderboards.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get( app.get(
@@ -726,7 +884,14 @@ app.get(
detail: { detail: {
description: 'The endpoint for getting the total leaderboards.', description: 'The endpoint for getting the total leaderboards.',
tags: ['Berry Dash', 'Leaderboards'] tags: ['Berry Dash', 'Leaderboards']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.get('/berrydash/profile', context => berrydashProfileGetHandler(context), { app.get('/berrydash/profile', context => berrydashProfileGetHandler(context), {
@@ -737,6 +902,13 @@ app.get('/berrydash/profile', context => berrydashProfileGetHandler(context), {
}, },
query: t.Object({ query: t.Object({
userId: t.String() userId: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.delete( app.delete(
@@ -753,7 +925,12 @@ app.delete(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -768,6 +945,13 @@ app.get(
}, },
query: t.Object({ query: t.Object({
userId: t.String() userId: t.String()
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -785,7 +969,12 @@ app.post(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -807,7 +996,12 @@ app.put(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -818,7 +1012,14 @@ app.get(
detail: { detail: {
description: 'The endpoint for getting the icon marketplace icons.', description: 'The endpoint for getting the icon marketplace icons.',
tags: ['Berry Dash', 'Icon Marketplace'] tags: ['Berry Dash', 'Icon Marketplace']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
} }
) )
app.post( app.post(
@@ -846,6 +1047,11 @@ app.post(
t.String({ t.String({
description: 'This is your session token' description: 'This is your session token'
}) })
),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
) )
}) })
} }
@@ -868,7 +1074,12 @@ app.post(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -898,6 +1109,13 @@ app.get(
examples: ['true', 'false'] examples: ['true', 'false']
}) })
) )
}),
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -916,7 +1134,12 @@ app.post(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -932,7 +1155,12 @@ app.get(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -948,7 +1176,12 @@ app.post(
headers: t.Object({ headers: t.Object({
authorization: t.String({ authorization: t.String({
description: 'This is your session token' description: 'This is your session token'
}) }),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
} }
) )
@@ -956,7 +1189,14 @@ app.get('/berrydash/splash-text', berryDashSplashTextGetHandler, {
detail: { detail: {
description: 'The endpoint for getting splash texts.', description: 'The endpoint for getting splash texts.',
tags: ['Berry Dash', 'Splash Texts'] tags: ['Berry Dash', 'Splash Texts']
} },
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
}) })
app.post('/berrydash/splash-text', berryDashSplashTextPostHandler, { app.post('/berrydash/splash-text', berryDashSplashTextPostHandler, {
detail: { detail: {
@@ -965,17 +1205,37 @@ app.post('/berrydash/splash-text', berryDashSplashTextPostHandler, {
body: t.Object({ body: t.Object({
token: t.String(), token: t.String(),
content: t.String() content: t.String()
}),
headers: t.Object({
authorization: t.String(),
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
}) })
}) })
app.all('*', () => app.all(
jsonResponse( '*',
{ () =>
success: false, jsonResponse(
message: 'No endpoint found (are you using the correct request method?)', {
data: null success: false,
}, message:
404 'No endpoint found (are you using the correct request method?)',
) data: null
},
404
),
{
headers: t.Object({
'x-forwarded-for': t.Optional(
t.String({
hide: true
})
)
})
}
) )
app.listen(3342) app.listen(3342)