48ea805999 (commitcomment-48584326)
This commit is contained in:
syuilo 2021-03-23 14:54:09 +09:00
parent 48ea805999
commit 5c3a56b283
10 changed files with 42 additions and 39 deletions

View file

@ -4,7 +4,7 @@ import { getJson } from '../../../misc/fetch';
import { OAuth2 } from 'oauth';
import config from '../../../config';
import { publishMainStream } from '../../../services/stream';
import redis from '../../../db/redis';
import { redisClient } from '../../../db/redis';
import { v4 as uuid } from 'uuid';
import signin from '../common/signin';
import { fetchMeta } from '../../../misc/fetch-meta';
@ -96,7 +96,7 @@ router.get('/connect/discord', async ctx => {
response_type: 'code'
};
redis.set(userToken, JSON.stringify(params));
redisClient.set(userToken, JSON.stringify(params));
const oauth2 = await getOAuth2();
ctx.redirect(oauth2!.getAuthorizeUrl(params));
@ -118,7 +118,7 @@ router.get('/signin/discord', async ctx => {
httpOnly: true
});
redis.set(sessid, JSON.stringify(params));
redisClient.set(sessid, JSON.stringify(params));
const oauth2 = await getOAuth2();
ctx.redirect(oauth2!.getAuthorizeUrl(params));
@ -145,7 +145,7 @@ router.get('/dc/cb', async ctx => {
}
const { redirect_uri, state } = await new Promise<any>((res, rej) => {
redis.get(sessid, async (_, state) => {
redisClient.get(sessid, async (_, state) => {
res(JSON.parse(state));
});
});
@ -216,7 +216,7 @@ router.get('/dc/cb', async ctx => {
}
const { redirect_uri, state } = await new Promise<any>((res, rej) => {
redis.get(userToken, async (_, state) => {
redisClient.get(userToken, async (_, state) => {
res(JSON.parse(state));
});
});