[WIP] Twitter support

This commit is contained in:
syuilo 2017-01-20 11:09:54 +09:00
parent 6c36c2419f
commit 257d54d1e6
5 changed files with 25 additions and 0 deletions

View File

@ -58,6 +58,7 @@
"@types/rimraf": "0.0.28", "@types/rimraf": "0.0.28",
"@types/serve-favicon": "2.2.28", "@types/serve-favicon": "2.2.28",
"@types/shelljs": "0.3.33", "@types/shelljs": "0.3.33",
"@types/twitter": "0.0.28",
"@types/uuid": "2.0.29", "@types/uuid": "2.0.29",
"@types/vinyl-buffer": "0.0.28", "@types/vinyl-buffer": "0.0.28",
"@types/vinyl-source-stream": "0.0.28", "@types/vinyl-source-stream": "0.0.28",
@ -143,6 +144,7 @@
"tcp-port-used": "0.1.2", "tcp-port-used": "0.1.2",
"textarea-caret": "3.0.2", "textarea-caret": "3.0.2",
"tslint": "4.3.1", "tslint": "4.3.1",
"twitter": "1.7.0",
"typescript": "2.1.5", "typescript": "2.1.5",
"uuid": "3.0.1", "uuid": "3.0.1",
"velocity-animate": "1.4.0", "velocity-animate": "1.4.0",

View File

@ -64,6 +64,7 @@ export default (
delete _user.password; delete _user.password;
delete _user.token; delete _user.token;
delete _user.username_lower; delete _user.username_lower;
delete _user.twitter;
// Visible via only the official client // Visible via only the official client
if (!opts.includeSecrets) { if (!opts.includeSecrets) {

View File

@ -57,6 +57,10 @@ interface ISource {
secretKey: string; secretKey: string;
}; };
accesslog: string; accesslog: string;
twitter: {
consumer_key: string;
consumer_secret: string;
};
} }
/** /**

View File

@ -48,6 +48,8 @@ app.get(/\/api:meta/, require('./meta'));
app.get(/\/api:url/, require('./service/url-preview')); app.get(/\/api:url/, require('./service/url-preview'));
app.post(/\/api:rss/, require('./service/rss-proxy')); app.post(/\/api:rss/, require('./service/rss-proxy'));
app.get(/\/connect:twitter/, require('./service/twitter/begin'));
/** /**
* Subdomain * Subdomain
*/ */

View File

@ -0,0 +1,16 @@
import * as express from 'express';
//import * as Twitter from 'twitter';
import Twitter = require('twitter');
const client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET
});
module.exports = (req: express.Request, res: express.Response) => {
client.get('oauth/request_token', (x, y, z) => {
console.log(x);
console.log(y);
console.log(z);
});
};