fix instagram
This commit is contained in:
1 parent
7f7dcf84f3
commit
1d2e17a581
2 files changed
+11
-4
No files matched your search
+10
-1
@@ -18,6 +18,14 @@ function personByInstagram(list, instagram){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function postText(post){
|
||||||
|
try{
|
||||||
|
return post.data.caption.text.replace(/#[\w_]+/, "")
|
||||||
|
}catch(error){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
app.directive("timeline", function (team) {
|
app.directive("timeline", function (team) {
|
||||||
return {
|
return {
|
||||||
@@ -36,13 +44,14 @@ module.exports = function(app) {
|
|||||||
$scope.feed = list.map(function (post) {
|
$scope.feed = list.map(function (post) {
|
||||||
var author_id = personByInstagram(team.team, post.data.user.username);
|
var author_id = personByInstagram(team.team, post.data.user.username);
|
||||||
var name = author_id ? team.short(author_id) : post.data.user.username;
|
var name = author_id ? team.short(author_id) : post.data.user.username;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
date: post.publishDate,
|
date: post.publishDate,
|
||||||
image: post.data.images.standard_resolution.url,
|
image: post.data.images.standard_resolution.url,
|
||||||
url: post.data.link,
|
url: post.data.link,
|
||||||
username: name,
|
username: name,
|
||||||
userpic: post.data.user.profile_picture,
|
userpic: post.data.user.profile_picture,
|
||||||
text: post.data.caption.text.replace(/#[\w_]+/, "")
|
text: postText(post)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,15 +3,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var Router = require("express").Router;
|
var Router = require("express").Router;
|
||||||
var instagram = require("./instagram");
|
var instagram = require("../core/instagram");
|
||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
var router;
|
var router;
|
||||||
router = new Router();
|
router = new Router();
|
||||||
router.route("/auth/instagram/callback")
|
router.route("/auth/instagram/callback")
|
||||||
.get(function (req, res) {
|
.get(function (req, res) {
|
||||||
var api = instagram.client();
|
|
||||||
|
|
||||||
var code = req.query.code;
|
var code = req.query.code;
|
||||||
instagram.authorize(code)
|
instagram.authorize(code)
|
||||||
.catch(function(error){
|
.catch(function(error){
|
||||||
|
|||||||
Reference in new issue
Block a user