Mercurial > pumpbridge
changeset 31:8238d312e281
var checks
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Tue, 30 Sep 2014 07:30:54 +0200 |
parents | 3e3fa35e3ce2 |
children | ca0b44c1a870 |
files | src/facebook.coffee src/google.coffee src/pumpio.coffee src/routes.coffee src/sync.coffee src/twitter.coffee |
diffstat | 6 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/facebook.coffee Thu Aug 28 18:40:39 2014 +0200 +++ b/src/facebook.coffee Tue Sep 30 07:30:54 2014 +0200 @@ -102,7 +102,7 @@ async.eachLimit allESN, 10, ((fromesn, callback) -> async.waterfall [ (cb) -> - if fromesn.sourcePost.indexOf('www.facebook.com') is -1 + if fromesn.sourcePost.indexOf('facebook.com') is -1 return Usermap.search {id: me + '_to_' + me}, cb (pumpuser, cb) ->
--- a/src/google.coffee Thu Aug 28 18:40:39 2014 +0200 +++ b/src/google.coffee Tue Sep 30 07:30:54 2014 +0200 @@ -95,8 +95,10 @@ ###### get user info googleplus ###### ####################################### getUser = (user) -> + return if not (user?) data = "" id = user.user_ESN.substr(0,user.user_ESN.indexOf('@')) + return if not (user.oauth_token?) token = user.oauth_token.substr(0,user.oauth_token.indexOf(';')) options = host: "www.googleapis.com" @@ -128,6 +130,7 @@ friends = new Array() me = user.user_pumpio id = user.user_ESN.substr(0,user.user_ESN.indexOf('@')) + return if not (user.oauth_token?) if user.oauth_token.indexOf(';') isnt -1 token = user.oauth_token.substr(0,user.oauth_token.indexOf(';')) else
--- a/src/pumpio.coffee Thu Aug 28 18:40:39 2014 +0200 +++ b/src/pumpio.coffee Tue Sep 30 07:30:54 2014 +0200 @@ -30,9 +30,11 @@ (callback) -> Host.search {hostname: server}, callback (host,callback) -> + return if not (host?) # get host from db host = JSON.stringify(host) host = JSON.parse(host) + return if not (host[0]?) oauth = new OAuth.OAuth(host[0].request_token_endpoint, host[0].access_token_endpoint, host[0].client_id, host[0].client_secret, "1.0A", null, "HMAC-SHA1") oauth.get "https://" + server + "/api/user/"+id, token, secret, callback ], (err,result) -> @@ -61,8 +63,10 @@ Host.search {hostname: server}, callback (host,callback) -> # get host from db + return if not (host?) host = JSON.stringify(host) host = JSON.parse(host) + return if not (host[0]?) activity = verb: "post" #cc: [ @@ -98,8 +102,10 @@ Host.search {hostname: server}, callback (host,callback) -> # get host from db + return if not (host?) host = JSON.stringify(host) host = JSON.parse(host) + return if not (host[0]?) oauth = new OAuth.OAuth(host[0].request_token_endpoint, host[0].access_token_endpoint, host[0].client_id, host[0].client_secret, "1.0A", null, "HMAC-SHA1") oauth.get "https://" + server + "/api/user/"+id+"/feed", token, secret, callback ], (err,result) -> @@ -126,9 +132,11 @@ (callback) -> Host.search {hostname: server}, callback (host,callback) -> + return if not (host?) # get host from db host = JSON.stringify(host) host = JSON.parse(host) + return if not (host[0]?) oauth = new OAuth.OAuth(host[0].request_token_endpoint, host[0].access_token_endpoint, host[0].client_id, host[0].client_secret, "1.0A", null, "HMAC-SHA1") oauth.get noteurl, token, secret, callback ], (err,result) -> @@ -141,6 +149,7 @@ return getLikes = (user, callback) -> + return if not (user?) id = user.user_ESN.substr(0,user.user_ESN.indexOf('@')) server = user.user_ESN.substr(user.user_ESN.indexOf('@')+1,user.user_ESN.length) token = user.oauth_token.substr(0,user.oauth_token.indexOf(';')) @@ -153,8 +162,10 @@ Host.search {hostname: server}, callback (host,callback) -> # get host from db + return if not (host?) host = JSON.stringify(host) host = JSON.parse(host) + return if not (host[0]?) #console.log JSON.stringify host oauth = new OAuth.OAuth(host[0].request_token_endpoint, host[0].access_token_endpoint, host[0].client_id, host[0].client_secret, "1.0A", null, "HMAC-SHA1") oauth.get url, token, secret, callback
--- a/src/routes.coffee Thu Aug 28 18:40:39 2014 +0200 +++ b/src/routes.coffee Tue Sep 30 07:30:54 2014 +0200 @@ -49,11 +49,11 @@ fbdelete = req.body.fbdelete twdelete = req.body.twdelete - + twmode = req.body.twmode if(req.body.twtoesn?) then twtoesn=true else twtoesn=false if(req.body.twfromesn?) then twfromesn=true else twfromesn=false - + # create/update userdb entrys # SET THE CONNECTION BETWEENS PUMPIO AND ESN-ACCOUNT (facebook or google)
--- a/src/sync.coffee Thu Aug 28 18:40:39 2014 +0200 +++ b/src/sync.coffee Tue Sep 30 07:30:54 2014 +0200 @@ -68,7 +68,8 @@ if network is 'facebook' if user? and user.profilePicLink? - profilePicLink = user.profilePicLink.replace("50x50", "80x80") + profilePicLink = user.profilePicLink + #.replace("50x50", "80x80") else profilePicLink = 'http://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/F_icon.svg/80px-F_icon.svg.png'
--- a/src/twitter.coffee Thu Aug 28 18:40:39 2014 +0200 +++ b/src/twitter.coffee Tue Sep 30 07:30:54 2014 +0200 @@ -135,7 +135,7 @@ if text.length <= 140 status += text else - status += text.substr(0, 140 - (post.object.url.length + 2)) + ".." + post.object.url + status += text.substr(0, 140 - (post.object.url.length + 2)) + " " + post.object.url twit.verifyCredentials((data) -> #console.log util.inspect(data) return