mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 18:29:08 +00:00
improve social modes for discordbot crawler.
This commit is contained in:
parent
cd70c58cc9
commit
8dd759d78c
5 changed files with 44 additions and 5 deletions
|
@ -146,8 +146,14 @@ export default (R: Router, $: AppContext) => {
|
|||
})
|
||||
|
||||
R.get('/magic/:challenge', async (ctx: Context) => {
|
||||
if (ctx.request.headers['user-agent'].includes('Discordbot')) {
|
||||
return $.ui.render(ctx.req, ctx.res, '/_internal/_discordbot/_magic', {})
|
||||
}
|
||||
|
||||
const { challenge } = ((ctx.params: any): { challenge: string })
|
||||
const chall = await $.auth.fetchDMChallenge({ magic: challenge })
|
||||
// log.notice('magic user agent', { ua: ctx.request.headers['User-Agent'] })
|
||||
|
||||
if (chall == null) {
|
||||
log.warn('bad magic', challenge)
|
||||
return ctx.redirect('/auth/expired')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue