Migrate to tslint 5.1.0

This commit is contained in:
Aya Morisawa
2017-04-14 20:45:37 +09:00
parent 798d1610f0
commit b095efaee5
16 changed files with 107 additions and 95 deletions

View File

@ -22,7 +22,7 @@ module.exports = async (app: express.Application) => {
const handler = new EventEmitter();
app.post('/hooks/github', (req, res, next) => {
if ((new Buffer(req.headers['x-hub-signature'])).equals(new Buffer('sha1=' + crypto.createHmac('sha1', config.github_bot.hook_secret).update(JSON.stringify(req.body)).digest('hex')))) {
if ((new Buffer(req.headers['x-hub-signature'])).equals(new Buffer(`sha1=${crypto.createHmac('sha1', config.github_bot.hook_secret).update(JSON.stringify(req.body)).digest('hex')}`))) {
handler.emit(req.headers['x-github-event'], req.body);
res.sendStatus(200);
} else {
@ -40,7 +40,7 @@ module.exports = async (app: express.Application) => {
// Fetch parent status
request({
url: parent.url + '/statuses',
url: `${parent.url}/statuses`,
headers: {
'User-Agent': 'misskey'
}

View File

@ -1,6 +1,6 @@
import * as express from 'express';
//import * as Twitter from 'twitter';
//const Twitter = require('twitter');
// import * as Twitter from 'twitter';
// const Twitter = require('twitter');
import autwh from 'autwh';
import redis from '../../db/redis';
import User from '../models/user';
@ -14,10 +14,10 @@ module.exports = (app: express.Application) => {
const user = await User.findOneAndUpdate({
token: res.locals.user
}, {
$set: {
twitter: null
}
});
$set: {
twitter: null
}
});
res.send(`Twitterの連携を解除しました :v:`);
@ -38,7 +38,7 @@ module.exports = (app: express.Application) => {
const twAuth = autwh({
consumerKey: config.twitter.consumer_key,
consumerSecret: config.twitter.consumer_secret,
callbackUrl: config.api_url + '/tw/cb'
callbackUrl: `${config.api_url}/tw/cb`
});
app.get('/connect/twitter', async (req, res): Promise<any> => {
@ -56,15 +56,15 @@ module.exports = (app: express.Application) => {
const user = await User.findOneAndUpdate({
token: res.locals.user
}, {
$set: {
twitter: {
access_token: result.accessToken,
access_token_secret: result.accessTokenSecret,
user_id: result.userId,
screen_name: result.screenName
$set: {
twitter: {
access_token: result.accessToken,
access_token_secret: result.accessTokenSecret,
user_id: result.userId,
screen_name: result.screenName
}
}
}
});
});
res.send(`Twitter: @${result.screenName} を、Misskey: @${user.username} に接続しました!`);