diff options
| -rw-r--r-- | lib/router.js | 8 | ||||
| -rw-r--r-- | server/methods.js | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/router.js b/lib/router.js index 55816d0..daddf5e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -8,6 +8,14 @@ Router.route('/photos', {name: 'photos'}); Router.route('/about', {name: 'about'}); +Router.route('/prints', function () { + var self = this; + var res = Prints.find({ ts: { $gt: new Date().getTime() - 60000 } }).fetch() + self.response.setHeader('Content-Type', 'application/json'); + self.response.write(JSON.stringify(res)); + self.response.end(); +}, { where: 'server' }); + Router.route('/imgproxy', function () { var self = this; var url = 'http://scontent.cdninstagram.com' + this.request._parsedUrl.search.match(/url\=[^\&]+/)[0].split('=')[1]; diff --git a/server/methods.js b/server/methods.js index 8f6cc52..5713479 100644 --- a/server/methods.js +++ b/server/methods.js @@ -1,3 +1,5 @@ +Prints = new Mongo.Collection('prints'); + Meteor.methods({ getInstagramMedia: function (year, month) { this.unblock(); @@ -12,10 +14,15 @@ Meteor.methods({ getInstagramProfilePhoto: function () { return Meteor.user().services.instagram.profile_picture; }, - printFinalImage: function(code) { + printFinalImage: function (code) { if (Meteor.userId()) { var username = Meteor.user().services.instagram.username; - console.log('Printing', username + '|' + code); + var data = username + '|' + code; + Prints.insert({ + data: data, + ip: this.connection.clientAddress, + ts: new Date().getTime() + }) } } }); |
