Mercurial > pumpbridge
diff src/pumpio.coffee @ 31:8238d312e281
var checks
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Tue, 30 Sep 2014 07:30:54 +0200 |
parents | 3e3fa35e3ce2 |
children |
line wrap: on
line diff
--- 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