summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/service/github.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/service/github.ts')
-rw-r--r--packages/backend/src/server/api/service/github.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/backend/src/server/api/service/github.ts b/packages/backend/src/server/api/service/github.ts
index 07b4fe717e..5e0839df93 100644
--- a/packages/backend/src/server/api/service/github.ts
+++ b/packages/backend/src/server/api/service/github.ts
@@ -92,7 +92,7 @@ router.get('/connect/github', async ctx => {
const params = {
redirect_uri: `${config.url}/api/gh/cb`,
scope: ['read:user'],
- state: uuid()
+ state: uuid(),
};
redisClient.set(userToken, JSON.stringify(params));
@@ -107,13 +107,13 @@ router.get('/signin/github', async ctx => {
const params = {
redirect_uri: `${config.url}/api/gh/cb`,
scope: ['read:user'],
- state: uuid()
+ state: uuid(),
};
ctx.cookies.set('signin_with_github_sid', sessid, {
path: '/',
secure: config.url.startsWith('https'),
- httpOnly: true
+ httpOnly: true,
});
redisClient.set(sessid, JSON.stringify(params));
@@ -155,7 +155,7 @@ router.get('/gh/cb', async ctx => {
const { accessToken } = await new Promise<any>((res, rej) =>
oauth2!.getOAuthAccessToken(code, {
- redirect_uri
+ redirect_uri,
}, (err, accessToken, refresh, result) => {
if (err) {
rej(err);
@@ -167,7 +167,7 @@ router.get('/gh/cb', async ctx => {
}));
const { login, id } = await getJson('https://api.github.com/user', 'application/vnd.github.v3+json', 10 * 1000, {
- 'Authorization': `bearer ${accessToken}`
+ 'Authorization': `bearer ${accessToken}`,
});
if (!login || !id) {
ctx.throw(400, 'invalid session');
@@ -219,7 +219,7 @@ router.get('/gh/cb', async ctx => {
}));
const { login, id } = await getJson('https://api.github.com/user', 'application/vnd.github.v3+json', 10 * 1000, {
- 'Authorization': `bearer ${accessToken}`
+ 'Authorization': `bearer ${accessToken}`,
});
if (!login || !id) {
@@ -229,7 +229,7 @@ router.get('/gh/cb', async ctx => {
const user = await Users.findOneOrFail({
host: null,
- token: userToken
+ token: userToken,
});
const profile = await UserProfiles.findOneOrFail(user.id);
@@ -241,8 +241,8 @@ router.get('/gh/cb', async ctx => {
accessToken: accessToken,
id: id,
login: login,
- }
- }
+ },
+ },
});
ctx.body = `GitHub: @${login} を、Misskey: @${user.username} に接続しました!`;
@@ -250,7 +250,7 @@ router.get('/gh/cb', async ctx => {
// Publish i updated event
publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, {
detail: true,
- includeSecrets: true
+ includeSecrets: true,
}));
}
});