mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
made api backwards-compatible with old syntax
This commit is contained in:
parent
4b358389ab
commit
2fe94d611f
2 changed files with 13 additions and 5 deletions
|
@ -15,7 +15,7 @@ Gravatar = {
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
|
||||||
}else{
|
}else if(user.services && user.services.twitter){
|
||||||
return user.services.twitter.profile_image_url; //for the oauth-login avatar, diff for diff oauth, maybe it could be better
|
return user.services.twitter.profile_image_url; //for the oauth-login avatar, diff for diff oauth, maybe it could be better
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
serveAPI = function(limit){
|
serveAPI = function(limitSegment){
|
||||||
var posts = [];
|
var posts = [];
|
||||||
limit = typeof limit == 'undefined' ? 100 : limit;
|
var limit = 100; // default limit: 100 posts
|
||||||
console.log(limit)
|
|
||||||
|
if(this.request.query.limit){
|
||||||
|
// first, try getting the limit from the request (i.e. ?limit=100)
|
||||||
|
limit = this.request.query.limit;
|
||||||
|
}else if(typeof limitSegment !== 'undefined'){
|
||||||
|
// else, get it from the URL segment
|
||||||
|
limit = limitSegment;
|
||||||
|
}
|
||||||
|
|
||||||
Posts.find({status: STATUS_APPROVED}, {sort: {submitted: -1}, limit: limit}).forEach(function(post) {
|
Posts.find({status: STATUS_APPROVED}, {sort: {submitted: -1}, limit: limit}).forEach(function(post) {
|
||||||
var url = (post.url ? post.url : getPostUrl(post._id));
|
var url = (post.url ? post.url : getPostUrl(post._id));
|
||||||
var properties = {
|
var properties = {
|
||||||
|
@ -51,7 +59,7 @@ Meteor.Router.add({
|
||||||
return feed.xml();
|
return feed.xml();
|
||||||
},
|
},
|
||||||
|
|
||||||
'/api/': serveAPI,
|
'/api': serveAPI,
|
||||||
|
|
||||||
'/api/:limit': serveAPI
|
'/api/:limit': serveAPI
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue