fix lint
This commit is contained in:
@@ -42,7 +42,7 @@ router.get('/disconnect/discord', async ctx => {
|
||||
|
||||
const user = await Users.findOneOrFail({
|
||||
host: null,
|
||||
token: userToken
|
||||
token: userToken,
|
||||
});
|
||||
|
||||
const profile = await UserProfiles.findOneOrFail(user.id);
|
||||
@@ -58,7 +58,7 @@ router.get('/disconnect/discord', async ctx => {
|
||||
// Publish i updated event
|
||||
publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, {
|
||||
detail: true,
|
||||
includeSecrets: true
|
||||
includeSecrets: true,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -93,7 +93,7 @@ router.get('/connect/discord', async ctx => {
|
||||
redirect_uri: `${config.url}/api/dc/cb`,
|
||||
scope: ['identify'],
|
||||
state: uuid(),
|
||||
response_type: 'code'
|
||||
response_type: 'code',
|
||||
};
|
||||
|
||||
redisClient.set(userToken, JSON.stringify(params));
|
||||
@@ -109,13 +109,13 @@ router.get('/signin/discord', async ctx => {
|
||||
redirect_uri: `${config.url}/api/dc/cb`,
|
||||
scope: ['identify'],
|
||||
state: uuid(),
|
||||
response_type: 'code'
|
||||
response_type: 'code',
|
||||
};
|
||||
|
||||
ctx.cookies.set('signin_with_discord_sid', sessid, {
|
||||
path: '/',
|
||||
secure: config.url.startsWith('https'),
|
||||
httpOnly: true
|
||||
httpOnly: true,
|
||||
});
|
||||
|
||||
redisClient.set(sessid, JSON.stringify(params));
|
||||
@@ -158,7 +158,7 @@ router.get('/dc/cb', async ctx => {
|
||||
const { accessToken, refreshToken, expiresDate } = await new Promise<any>((res, rej) =>
|
||||
oauth2!.getOAuthAccessToken(code, {
|
||||
grant_type: 'authorization_code',
|
||||
redirect_uri
|
||||
redirect_uri,
|
||||
}, (err, accessToken, refreshToken, result) => {
|
||||
if (err) {
|
||||
rej(err);
|
||||
@@ -168,7 +168,7 @@ router.get('/dc/cb', async ctx => {
|
||||
res({
|
||||
accessToken,
|
||||
refreshToken,
|
||||
expiresDate: Date.now() + Number(result.expires_in) * 1000
|
||||
expiresDate: Date.now() + Number(result.expires_in) * 1000,
|
||||
});
|
||||
}
|
||||
}));
|
||||
@@ -201,8 +201,8 @@ router.get('/dc/cb', async ctx => {
|
||||
refreshToken: refreshToken,
|
||||
expiresDate: expiresDate,
|
||||
username: username,
|
||||
discriminator: discriminator
|
||||
}
|
||||
discriminator: discriminator,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -229,7 +229,7 @@ router.get('/dc/cb', async ctx => {
|
||||
const { accessToken, refreshToken, expiresDate } = await new Promise<any>((res, rej) =>
|
||||
oauth2!.getOAuthAccessToken(code, {
|
||||
grant_type: 'authorization_code',
|
||||
redirect_uri
|
||||
redirect_uri,
|
||||
}, (err, accessToken, refreshToken, result) => {
|
||||
if (err) {
|
||||
rej(err);
|
||||
@@ -239,7 +239,7 @@ router.get('/dc/cb', async ctx => {
|
||||
res({
|
||||
accessToken,
|
||||
refreshToken,
|
||||
expiresDate: Date.now() + Number(result.expires_in) * 1000
|
||||
expiresDate: Date.now() + Number(result.expires_in) * 1000,
|
||||
});
|
||||
}
|
||||
}));
|
||||
@@ -254,7 +254,7 @@ router.get('/dc/cb', async ctx => {
|
||||
|
||||
const user = await Users.findOneOrFail({
|
||||
host: null,
|
||||
token: userToken
|
||||
token: userToken,
|
||||
});
|
||||
|
||||
const profile = await UserProfiles.findOneOrFail(user.id);
|
||||
@@ -268,9 +268,9 @@ router.get('/dc/cb', async ctx => {
|
||||
expiresDate: expiresDate,
|
||||
id: id,
|
||||
username: username,
|
||||
discriminator: discriminator
|
||||
}
|
||||
}
|
||||
discriminator: discriminator,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
ctx.body = `Discord: @${username}#${discriminator} を、Misskey: @${user.username} に接続しました!`;
|
||||
@@ -278,7 +278,7 @@ router.get('/dc/cb', async ctx => {
|
||||
// Publish i updated event
|
||||
publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, {
|
||||
detail: true,
|
||||
includeSecrets: true
|
||||
includeSecrets: true,
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
@@ -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,
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
@@ -41,7 +41,7 @@ router.get('/disconnect/twitter', async ctx => {
|
||||
|
||||
const user = await Users.findOneOrFail({
|
||||
host: null,
|
||||
token: userToken
|
||||
token: userToken,
|
||||
});
|
||||
|
||||
const profile = await UserProfiles.findOneOrFail(user.id);
|
||||
@@ -57,7 +57,7 @@ router.get('/disconnect/twitter', async ctx => {
|
||||
// Publish i updated event
|
||||
publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, {
|
||||
detail: true,
|
||||
includeSecrets: true
|
||||
includeSecrets: true,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ async function getTwAuth() {
|
||||
return autwh({
|
||||
consumerKey: meta.twitterConsumerKey,
|
||||
consumerSecret: meta.twitterConsumerSecret,
|
||||
callbackUrl: `${config.url}/api/tw/cb`
|
||||
callbackUrl: `${config.url}/api/tw/cb`,
|
||||
});
|
||||
} else {
|
||||
return null;
|
||||
@@ -104,7 +104,7 @@ router.get('/signin/twitter', async ctx => {
|
||||
ctx.cookies.set('signin_with_twitter_sid', sessid, {
|
||||
path: '/',
|
||||
secure: config.url.startsWith('https'),
|
||||
httpOnly: true
|
||||
httpOnly: true,
|
||||
});
|
||||
|
||||
ctx.redirect(twCtx.url);
|
||||
@@ -164,7 +164,7 @@ router.get('/tw/cb', async ctx => {
|
||||
|
||||
const user = await Users.findOneOrFail({
|
||||
host: null,
|
||||
token: userToken
|
||||
token: userToken,
|
||||
});
|
||||
|
||||
const profile = await UserProfiles.findOneOrFail(user.id);
|
||||
@@ -177,7 +177,7 @@ router.get('/tw/cb', async ctx => {
|
||||
accessTokenSecret: result.accessTokenSecret,
|
||||
userId: result.userId,
|
||||
screenName: result.screenName,
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -186,7 +186,7 @@ router.get('/tw/cb', async ctx => {
|
||||
// Publish i updated event
|
||||
publishMainStream(user.id, 'meUpdated', await Users.pack(user, user, {
|
||||
detail: true,
|
||||
includeSecrets: true
|
||||
includeSecrets: true,
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user