Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it work with Twitter API 1.1 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion helpers/sys.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ sc.helpers.getPlatform = function() {
if (window.runtime) {
return SPAZCORE_PLATFORM_AIR;
}
if (window && window.PalmSystem) {
if (window.Mojo) {
return SPAZCORE_PLATFORM_WEBOS;
}
if (window.Titanium) {
Expand Down
17 changes: 0 additions & 17 deletions libs/spazaccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,23 +415,6 @@ SpazAccounts.prototype.getAuthKey = function(acc_id) {

};


/**
* Set account's auth key
*/
SpazAccounts.prototype.setAuthKey = function(acc_id, auth_key) {

if (acc_id) {
var accobj = this.get(acc_id);
accobj.auth = auth_key;
this.set(acc_id, accobj);
} else {
return null;
}

};


/**
* @requires SpazAuth
*/
Expand Down
5 changes: 4 additions & 1 deletion libs/spazcore.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ var SPAZCORE_BASEURL_IDENTICA = 'https://identi.ca/';
* @constant
*/
var SPAZCORE_BASEURL_FREELISHUS = 'http://freelish.us/';

/**
* @constant
*/
var SPAZCORE_APIVERSION_TWITTER = '1.1';


/**
Expand Down
11 changes: 4 additions & 7 deletions libs/spazimageuploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,11 @@ SpazImageUploader.prototype.upload = function() {
if (sch.isString(data)) {
rs = srvc.parseResponse.call(srvc, data);
return opts.onSuccess(rs);
} else if (data && data.responseString) { // Mojo webOS will return an object, not just the response string
} else if (data && data.responseString) { // webOS will return an object, not just the response string
rs = srvc.parseResponse.call(srvc, data.responseString);
return opts.onSuccess(rs);
} else if (arguments[1] && arguments[1].responseString) { // Enyo webOS will return more args than Mojo
rs = srvc.parseResponse.call(srvc, arguments[1].responseString);
return opts.onSuccess(rs);
} else { // I dunno what it is; just pass it to the callback
return opts.onSuccess.apply(this, arguments);
return opts.onSuccess(data);
}
};
} else {
Expand All @@ -370,14 +367,14 @@ SpazImageUploader.prototype.upload = function() {
*/
var auth_header;
if (opts.service === 'yfrog') {
verify_url = 'https://api.twitter.com/1/account/verify_credentials.xml';
verify_url = 'https://api.twitter.com/' + SPAZCORE_APIVERSION_TWITTER + '/account/verify_credentials.xml';
auth_header = this.getAuthHeader({
'getEchoHeaderOpts': {
'verify_url':verify_url
}
});
} else {
verify_url = 'https://api.twitter.com/1/account/verify_credentials.json';
verify_url = 'https://api.twitter.com/' + SPAZCORE_APIVERSION_TWITTER + '/account/verify_credentials.json';
auth_header = this.getAuthHeader();
}

Expand Down
12 changes: 7 additions & 5 deletions libs/spazimageurl.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SpazImageURL.prototype.initAPIs = function() {
});

this.addAPI('twitpic', {
'url_regex' : new RegExp("http://(?:www\.)?twitpic.com/([a-zA-Z0-9]+)", "gi"),
'url_regex' : new RegExp("http://twitpic.com/([a-zA-Z0-9]+)", "gi"),
'getThumbnailUrl' : function(id) {
var url = 'http://twitpic.com/show/thumb/'+id;
return url;
Expand Down Expand Up @@ -81,14 +81,16 @@ SpazImageURL.prototype.initAPIs = function() {
});


this.addAPI('lockerz', {
'url_regex' : /http:\/\/lockerz.com\/s\/([a-zA-Z0-9]+)/gi,
this.addAPI('tweetphoto', {
'url_regex' : /http:\/\/tweetphoto.com\/([a-zA-Z0-9]+)/gi,
'getThumbnailUrl' : function(id) {
var url = 'http://api.plixi.com/api/tpapi.svc/imagefromurl?url=http://plixi.com/p/'+id+'&size=small';
// http://TweetPhotoAPI.com/api/TPAPI.svc/json/imagefromurl?size=thumbnail&url=http://tweetphoto.com/iyb9azy4
var url = 'http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://tweetphoto.com/'+id;
return url;
},
'getImageUrl' : function(id) {
var url = 'http://api.plixi.com/api/tpapi.svc/imagefromurl?url=http://plixi.com/p/'+id+'&size=big';
// http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=big&url=http://tweetphoto.com/iyb9azy4
var url = 'http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=big&url=http://tweetphoto.com/'+id;
return url;
}
});
Expand Down
Loading