summaryrefslogtreecommitdiff
path: root/src/server/api/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api/service')
-rw-r--r--src/server/api/service/discord.ts10
-rw-r--r--src/server/api/service/github.ts10
-rw-r--r--src/server/api/service/twitter.ts10
3 files changed, 6 insertions, 24 deletions
diff --git a/src/server/api/service/discord.ts b/src/server/api/service/discord.ts
index b2561dee61..d8a979b5b2 100644
--- a/src/server/api/service/discord.ts
+++ b/src/server/api/service/discord.ts
@@ -83,8 +83,6 @@ async function getOAuth2() {
}
router.get('/connect/discord', async ctx => {
- if (redis == null) return;
-
if (!compareOrigin(ctx)) {
ctx.throw(400, 'invalid origin');
return;
@@ -110,8 +108,6 @@ router.get('/connect/discord', async ctx => {
});
router.get('/signin/discord', async ctx => {
- if (redis == null) return;
-
const sessid = uuid();
const params = {
@@ -138,8 +134,6 @@ router.get('/signin/discord', async ctx => {
});
router.get('/dc/cb', async ctx => {
- if (redis == null) return;
-
const userToken = getUserToken(ctx);
const oauth2 = await getOAuth2();
@@ -160,7 +154,7 @@ router.get('/dc/cb', async ctx => {
}
const { redirect_uri, state } = await new Promise<any>((res, rej) => {
- redis!.get(sessid, async (_, state) => {
+ redis.get(sessid, async (_, state) => {
res(JSON.parse(state));
});
});
@@ -241,7 +235,7 @@ router.get('/dc/cb', async ctx => {
}
const { redirect_uri, state } = await new Promise<any>((res, rej) => {
- redis!.get(userToken, async (_, state) => {
+ redis.get(userToken, async (_, state) => {
res(JSON.parse(state));
});
});
diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts
index 4878d8c529..a4d274cc62 100644
--- a/src/server/api/service/github.ts
+++ b/src/server/api/service/github.ts
@@ -80,8 +80,6 @@ async function getOath2() {
}
router.get('/connect/github', async ctx => {
- if (redis == null) return;
-
if (!compareOrigin(ctx)) {
ctx.throw(400, 'invalid origin');
return;
@@ -106,8 +104,6 @@ router.get('/connect/github', async ctx => {
});
router.get('/signin/github', async ctx => {
- if (redis == null) return;
-
const sessid = uuid();
const params = {
@@ -133,8 +129,6 @@ router.get('/signin/github', async ctx => {
});
router.get('/gh/cb', async ctx => {
- if (redis == null) return;
-
const userToken = getUserToken(ctx);
const oauth2 = await getOath2();
@@ -155,7 +149,7 @@ router.get('/gh/cb', async ctx => {
}
const { redirect_uri, state } = await new Promise<any>((res, rej) => {
- redis!.get(sessid, async (_, state) => {
+ redis.get(sessid, async (_, state) => {
res(JSON.parse(state));
});
});
@@ -222,7 +216,7 @@ router.get('/gh/cb', async ctx => {
}
const { redirect_uri, state } = await new Promise<any>((res, rej) => {
- redis!.get(userToken, async (_, state) => {
+ redis.get(userToken, async (_, state) => {
res(JSON.parse(state));
});
});
diff --git a/src/server/api/service/twitter.ts b/src/server/api/service/twitter.ts
index b35ee8c479..39fdfd8654 100644
--- a/src/server/api/service/twitter.ts
+++ b/src/server/api/service/twitter.ts
@@ -79,8 +79,6 @@ async function getTwAuth() {
}
router.get('/connect/twitter', async ctx => {
- if (redis == null) return;
-
if (!compareOrigin(ctx)) {
ctx.throw(400, 'invalid origin');
return;
@@ -99,8 +97,6 @@ router.get('/connect/twitter', async ctx => {
});
router.get('/signin/twitter', async ctx => {
- if (redis == null) return;
-
const twAuth = await getTwAuth();
const twCtx = await twAuth!.begin();
@@ -122,8 +118,6 @@ router.get('/signin/twitter', async ctx => {
});
router.get('/tw/cb', async ctx => {
- if (redis == null) return;
-
const userToken = getUserToken(ctx);
const twAuth = await getTwAuth();
@@ -137,7 +131,7 @@ router.get('/tw/cb', async ctx => {
}
const get = new Promise<any>((res, rej) => {
- redis!.get(sessid, async (_, twCtx) => {
+ redis.get(sessid, async (_, twCtx) => {
res(twCtx);
});
});
@@ -170,7 +164,7 @@ router.get('/tw/cb', async ctx => {
}
const get = new Promise<any>((res, rej) => {
- redis!.get(userToken, async (_, twCtx) => {
+ redis.get(userToken, async (_, twCtx) => {
res(twCtx);
});
});