Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/Twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

var DEBUG = (process.env.DEBUG !== undefined);

var config = require('../../../data/twitter_config.js');
var OAuth = require('oauth').OAuth;
var qs = require('qs');

function Twitter() {
var configPath = "data/twitter_config";
try {
var config = process.env;

this.consumerKey = config.twitterConsumerKey;
this.consumerSecret = config.twitterConsumerSecret;
this.accessToken = config.twitterAccessToken;
Expand All @@ -28,7 +26,6 @@ function Twitter() {
'HMAC-SHA1'
);
} catch (err) {
//console.log(err)
console.log("no 'data/twitter_config' file, continuing without...");
}
}
Expand Down Expand Up @@ -195,7 +192,7 @@ Twitter.prototype.retweet = function(id, error, success){
var url = this.baseUrl + '/statuses/retweet/'+id+'.json';
this.doPost(url, {}, error, success);
}

Twitter.prototype.unretweet = function(id, error, success){
var url = this.baseUrl + '/statuses/unretweet/'+id+'.json';
this.doPost(url, {}, error, success);
Expand All @@ -208,7 +205,7 @@ Twitter.prototype.doPost = function (url, post_body, error, success) {
.replace(/\(/g, "%28")
.replace(/\)/g, "%29")
.replace(/\*/g, "%2A");
//(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback
//(url, oauth_token, oauth_token_secret, post_body, post_content_type, callback
this.oauth.post(url, this.accessToken, this.accessTokenSecret, post_body, "application/x-www-form-urlencoded", function (err, body, response) {
if (DEBUG) console.log('URL [%s]', url);
if (!err && response.statusCode == 200) {
Expand Down
4 changes: 2 additions & 2 deletions twitter_config → twitter_config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
module.exports = {
"consumerKey": "XXX",
"consumerSecret": "XXX",
"accessToken": "XXX",
"accessTokenSecret": "XXX",
"callBackUrl": "XXX"
}
}