diff --git a/.gitignore b/.gitignore index 314b49d..faca506 100755 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,6 @@ npm-debug.log* package-lock.json vendor .env - +build dist/graph.js dist/graph.js.gz \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f06ae2..54824c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,4 +27,69 @@ Added share button share indicator always shown ## 1.35 -show inactive instance warning with grou.ps feeds \ No newline at end of file +show inactive instance warning with grou.ps feeds + +## 2.0 +list-private-contents function added +login/register with custom-fields +login/register with moderation/verification queue + +## 2.6 +auto-focus="off" for auth-login and auth-register tags + +## 2.8 +star-button hide-zero="on" (off by default) + +## 2.9 +filter-out attribute for Messages + +## 2.10 +ref attribute for star-button + +## 2.11 +star-button shows registration box if not logged in + +## 2.12 +* remount tags after avatar update +* authentication-text attribute for graphjs-star-button + +## 2.13 +Added cookiejar support, because Chrome Windows giving errors otherwise + +## 2.14 +headers : {'Content-Type': 'application/x-www-form-urlencoded'} + +## 2.15 +* reverted 2.13 and 2.14 +* added samesite=secure to cookies + +## 2.16 +samesite=none in cookies + +## 2.17 +added secure to cookies + +## 2.18 +added url attribute to graphjs-comments tag (hence showComments function) + +## 2.19 +comments tag submit without url argument bug fixed + +## 2.20 +fixed comments tag delete visual bug + +## 3.1 +chaining is now possible (star only) + +## 3.2 +chaining with all functions + +## 3.3 +bugfixes with login logout + +# 3.4 +bugfix with auth-login after login (delay in state change, taken into account) + +# 3.5 +bugfix forum title +forum-list to handle login \ No newline at end of file diff --git a/VERSION b/VERSION index 71437d0..56e972a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.37 \ No newline at end of file +3.5 \ No newline at end of file diff --git a/bin/release.php b/bin/release.php index 7717555..b614d11 100644 --- a/bin/release.php +++ b/bin/release.php @@ -20,13 +20,20 @@ echo "Starting\n"; file_put_contents($me."/VERSION", $version); +echo "Version file written\n"; -$groupsv2_op = "cd {$me} && NEWVERSION={$version} && modules=groupsv2 npm run build && cp {$dist_dir}/graph* {$groups_frontend_path}/site/vendor/graphjs/ && cd {$groups_frontend_path} && git commit -am \$NEWVERSION && git tag graphjs-\$NEWVERSION && git push && git push --tag"; +echo "Starting Groups Frontend Ops\n"; +$groupsv2_op = "cd {$groups_frontend_path} && git pull && cd {$me} && NEWVERSION={$version} && modules=groupsv2 npm run build && cp {$dist_dir}/graph* {$groups_frontend_path}/site/vendor/graphjs/ && cd {$groups_frontend_path} && git commit -am \$NEWVERSION && git tag graphjs-\$NEWVERSION && git push && git push --tag"; exec($groupsv2_op); +echo "Ended Groups Frontend Ops\n"; -$graphjs_website_op = "cd {$me} && NEWVERSION={$version} && modules=all npm run build && mkdir {$graphjs_website_path}/app/dist/\$NEWVERSION && cp {$dist_dir}/graph* {$graphjs_website_path}/app/dist/\$NEWVERSION && cd {$graphjs_website_path} && git add app/dist/\$NEWVERSION && git commit -am \$NEWVERSION && git tag graphjs-\$NEWVERSION && git push && git push --tags"; +echo "Starting GraphJS Website Ops\n"; +$graphjs_website_op = "cd {$graphjs_website_path} && git pull && cd {$me} && NEWVERSION={$version} && modules=all npm run build && mkdir {$graphjs_website_path}/app/dist/\$NEWVERSION && cp {$dist_dir}/graph* {$graphjs_website_path}/app/dist/\$NEWVERSION && cd {$graphjs_website_path} && git add app/dist/\$NEWVERSION && git commit -am \$NEWVERSION && git tag graphjs-\$NEWVERSION && git push && git push --tags"; exec($graphjs_website_op); +echo "Ended GraphJS Website Ops\n"; +echo "Starting GraphJS Ops\n"; exec("cd {$me} && git commit -am {$version} && git tag {$version} && git push && git push --tags"); +echo "Ended GraphJS Ops\n"; echo "Complete...\n"; \ No newline at end of file diff --git a/lib/scripts/_handleLoginCookies.js b/lib/scripts/_handleLoginCookies.js index 8ea5d8d..94c2622 100644 --- a/lib/scripts/_handleLoginCookies.js +++ b/lib/scripts/_handleLoginCookies.js @@ -1,11 +1,9 @@ export default function(username, id) { - //if(response.data.success) { - let key = (window && window.hasOwnProperty('GraphJSConfig')) ? window.GraphJSConfig.id.replace(/-/g, '') : undefined; - let expiry = new Date(); - expiry.setTime(expiry.getTime() + (10 * 60 * 1000)); - document.cookie = 'graphjs_' + key + '_id=' + id + '; path=/; expires=' + expiry.toGMTString(); - document.cookie = 'graphjs_' + key + '_username=' + username + '; path=/; expires=' + expiry.toGMTString(); - document.cookie = 'graphjs_' + key + '_session_off=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - // window.GraphJS.events.emit("afterLogin", args, response.data); - //} + let key = (window && window.hasOwnProperty('GraphJSConfig')) ? window.GraphJSConfig.id.replace(/-/g, '') : undefined; + let expiry = new Date(); + expiry.setTime(expiry.getTime() + (10 * 60 * 1000)); + let secure = (location.protocol === 'https:') ? " secure;" : ""; + window.document.cookie = 'graphjs_' + key + '_session_off=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;' + ' samesite=none;' + secure; + window.document.cookie = 'graphjs_' + key + '_id=' + id + '; path=/; expires=' + expiry.toGMTString() + '; samesite=none;' + secure;; + window.document.cookie = 'graphjs_' + key + '_username=' + username + '; path=/; expires=' + expiry.toGMTString() + '; samesite=none;' + secure;; } \ No newline at end of file diff --git a/lib/scripts/addComment.js b/lib/scripts/addComment.js index d7dd52b..95bb682 100644 --- a/lib/scripts/addComment.js +++ b/lib/scripts/addComment.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function addCommentCall(args, callback) { - apiCall("addComment", { + return apiCall("addComment", { "url": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function addCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - addCommentCall(args, callback); + return addCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/addFeedback.js b/lib/scripts/addFeedback.js index 7bb3612..a2fd106 100644 --- a/lib/scripts/addFeedback.js +++ b/lib/scripts/addFeedback.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function addFeedbackCall(args, callback) { - apiCall("addFeedback", { + return apiCall("addFeedback", { "url": args[0], "content": args[1], "rating": args[2] @@ -14,5 +14,5 @@ function addFeedbackCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - addFeedbackCall(args, callback); + return addFeedbackCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/addPrivateContent.js b/lib/scripts/addPrivateContent.js index 1a59dec..982d3fc 100644 --- a/lib/scripts/addPrivateContent.js +++ b/lib/scripts/addPrivateContent.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function addPrivateContentCall(args, callback) { - apiCall("addPrivateContent", { + return apiCall("addPrivateContent", { "data": args[0] }, function(response) { @@ -12,5 +12,5 @@ function addPrivateContentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - addPrivateContentCall(args, callback); + return addPrivateContentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/api.js b/lib/scripts/api.js index fd116ba..47142c8 100644 --- a/lib/scripts/api.js +++ b/lib/scripts/api.js @@ -1,10 +1,12 @@ import axios from 'axios'; +const Q = require ("q"); function ucfirst(string) { return string.charAt(0).toUpperCase() + string.slice(1); } function ApiCall(method, args, callback, emitPostSignal){ + var def = Q.defer(); var instance = axios.create({ baseURL: window.GraphJSConfig.host, timeout: 20000, @@ -18,16 +20,29 @@ function ApiCall(method, args, callback, emitPostSignal){ _call += key + '=' + encodeURIComponent(args[key]) + '&'; } _call += 'public_id=' + window.GraphJSConfig.id; - instance.get(_call, {withCredentials: true}) + instance.get(_call, { + withCredentials: true + }) .then(function(response) { callback(response); + if(typeof response.data !== 'undefined') { + if(typeof response.data.success !== 'undefined' && response.data.success) + def.resolve(response.data); + else + def.reject(response.data); + } + else { + def.reject(response); + } if(emitPostSignal) window.GraphJS.events.emit("after" + ucfirst(method), args); }) .catch(function (error) { console.log(error); + def.reject(error); } ); + return def.promise; } export default function(method, args, callback, emitPostSignal = true) { @@ -35,10 +50,10 @@ export default function(method, args, callback, emitPostSignal = true) { if(beforeEventsExist){ window.GraphJS.events.emit("before" + ucfirst(method), args,function(goToNextStep = true) { if(goToNextStep){ - ApiCall(method, args, callback, emitPostSignal); + return ApiCall(method, args, callback, emitPostSignal); } }); } else { - ApiCall(method, args, callback, emitPostSignal); + return ApiCall(method, args, callback, emitPostSignal); } } \ No newline at end of file diff --git a/lib/scripts/checkSubscription.js b/lib/scripts/checkSubscription.js index 40e5b2b..04faba3 100644 --- a/lib/scripts/checkSubscription.js +++ b/lib/scripts/checkSubscription.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function checkSubscriptionCall(args, callback) { - apiCall("checkSubscription", { + return apiCall("checkSubscription", { "username": args[0] }, function(response) { @@ -12,5 +12,5 @@ function checkSubscriptionCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - checkSubscriptionCall(args, callback); + return checkSubscriptionCall(args, callback); }; diff --git a/lib/scripts/commentBlogPost.js b/lib/scripts/commentBlogPost.js index 2c5a9cc..4350b9a 100644 --- a/lib/scripts/commentBlogPost.js +++ b/lib/scripts/commentBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function commentBlogPostCall(args, callback) { - apiCall("addComment", { + return apiCall("addComment", { "id": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function commentBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - commentBlogPostCall(args, callback); + return commentBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/commentStatusUpdate.js b/lib/scripts/commentStatusUpdate.js index aa5fafb..5c1fbfe 100644 --- a/lib/scripts/commentStatusUpdate.js +++ b/lib/scripts/commentStatusUpdate.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function commentStatusUpdateCall(args, callback) { - apiCall("addComment", { + return apiCall("addComment", { "id": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function commentStatusUpdateCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - commentStatusUpdateCall(args, callback); + return commentStatusUpdateCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/countUnreadMessages.js b/lib/scripts/countUnreadMessages.js index 0e00802..aeb50ef 100644 --- a/lib/scripts/countUnreadMessages.js +++ b/lib/scripts/countUnreadMessages.js @@ -1,12 +1,12 @@ import apiCall from './api'; function countUnreadMessagesCall(callback) { - apiCall("countUnreadMessages", {}, + return apiCall("countUnreadMessages", {}, function(response) { callback(response.data); }); }; export default function(callback) { - countUnreadMessagesCall(callback); + return countUnreadMessagesCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/createGroup.js b/lib/scripts/createGroup.js index 0121563..3fa4c50 100644 --- a/lib/scripts/createGroup.js +++ b/lib/scripts/createGroup.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function createGroupCall(args, callback) { - apiCall("createGroup", { + return apiCall("createGroup", { "title": args[0], "description": args[1] }, @@ -13,5 +13,5 @@ function createGroupCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - createGroupCall(args, callback); + return createGroupCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/createSubscription.js b/lib/scripts/createSubscription.js index f72c9b1..fcf036a 100644 --- a/lib/scripts/createSubscription.js +++ b/lib/scripts/createSubscription.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function createSubscriptionCall(args, callback) { - apiCall("createSubscription", { + return apiCall("createSubscription", { "email": args[0], "plan": args[1], "source": args[2] @@ -14,5 +14,5 @@ function createSubscriptionCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - createSubscriptionCall(args, callback); + return createSubscriptionCall(args, callback); }; diff --git a/lib/scripts/deleteGroup.js b/lib/scripts/deleteGroup.js index 4640844..716e15c 100644 --- a/lib/scripts/deleteGroup.js +++ b/lib/scripts/deleteGroup.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function deleteGroupCall(args, callback) { - apiCall("deleteGroup", { + return apiCall("deleteGroup", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function deleteGroupCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - deleteGroupCall(args, callback); + return deleteGroupCall(args, callback); }; diff --git a/lib/scripts/editBlogComment.js b/lib/scripts/editBlogComment.js index 3dbfb08..0ac35f8 100644 --- a/lib/scripts/editBlogComment.js +++ b/lib/scripts/editBlogComment.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function editBlogCommentCall(args, callback) { - apiCall("editComment", { + return apiCall("editComment", { "id": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function editBlogCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - editBlogCommentCall(args, callback); + return editBlogCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/editBlogPost.js b/lib/scripts/editBlogPost.js index c70255a..05f3a78 100644 --- a/lib/scripts/editBlogPost.js +++ b/lib/scripts/editBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './post.js'; function editBlogPostCall(args, callback) { - apiCall("editBlogPost", { + return apiCall("editBlogPost", { "id": args[0], "title": args[1], "content": args[2] @@ -14,5 +14,5 @@ function editBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - editBlogPostCall(args, callback); + return editBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/editComment.js b/lib/scripts/editComment.js index 63243b7..26aac8b 100644 --- a/lib/scripts/editComment.js +++ b/lib/scripts/editComment.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function editCommentCall(args, callback) { - apiCall("editComment", { + return apiCall("editComment", { "id": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function editCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - editCommentCall(args, callback); + return editCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/editPrivateContent.js b/lib/scripts/editPrivateContent.js index 427b4aa..8fe92cb 100644 --- a/lib/scripts/editPrivateContent.js +++ b/lib/scripts/editPrivateContent.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function editPrivateContentCall(args, callback) { - apiCall("editPrivateContent", { + return apiCall("editPrivateContent", { "id": args[0], "data": args[1] }, @@ -13,5 +13,5 @@ function editPrivateContentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - editPrivateContentCall(args, callback); + return editPrivateContentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/editReply.js b/lib/scripts/editReply.js index e7ecf0a..32698be 100644 --- a/lib/scripts/editReply.js +++ b/lib/scripts/editReply.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function editReplyCall(args, callback) { - apiCall("editForumPost", { + return apiCall("editForumPost", { "id": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function editReplyCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - editReplyCall(args, callback); + return editReplyCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/follow.js b/lib/scripts/follow.js index 82c7ff5..bf1d65e 100644 --- a/lib/scripts/follow.js +++ b/lib/scripts/follow.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function followCall(args, callback) { - apiCall("follow", { + return apiCall("follow", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function followCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - followCall(args, callback); + return followCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getActivityToken.js b/lib/scripts/getActivityToken.js index 65999de..88c56d7 100644 --- a/lib/scripts/getActivityToken.js +++ b/lib/scripts/getActivityToken.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function loginCall(args, callback) { - apiCall("generateFeedToken", { + return apiCall("generateFeedToken", { "type": args[0], "id": args[1] }, @@ -13,5 +13,5 @@ function loginCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - loginCall(args, callback); + return loginCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getBlogComments.js b/lib/scripts/getBlogComments.js index d5d604d..71b4f34 100644 --- a/lib/scripts/getBlogComments.js +++ b/lib/scripts/getBlogComments.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getBlogCommentsCall(args, callback) { - apiCall("getComments", { + return apiCall("getComments", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getBlogCommentsCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getBlogCommentsCall(args, callback); + return getBlogCommentsCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getBlogPost.js b/lib/scripts/getBlogPost.js index 514fb0c..b61e790 100644 --- a/lib/scripts/getBlogPost.js +++ b/lib/scripts/getBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getBlogPostCall(args, callback) { - apiCall("getBlogPost", { + return apiCall("getBlogPost", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getBlogPostCall(args, callback); + return getBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getBlogPosts.js b/lib/scripts/getBlogPosts.js index 4f183eb..d4f6224 100644 --- a/lib/scripts/getBlogPosts.js +++ b/lib/scripts/getBlogPosts.js @@ -13,7 +13,7 @@ function getBlogPostsCall(args, callback) { } } } - apiCall("getBlogPosts", { + return apiCall("getBlogPosts", { "order": order, "count": count, "offset": offset @@ -26,5 +26,5 @@ function getBlogPostsCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getBlogPostsCall(args, callback); + return getBlogPostsCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getComments.js b/lib/scripts/getComments.js index 8df41f4..1514186 100644 --- a/lib/scripts/getComments.js +++ b/lib/scripts/getComments.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getCommentsCall(args, callback) { - apiCall("getComments", { + return apiCall("getComments", { "url": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getCommentsCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getCommentsCall(args, callback); + return getCommentsCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getConversation.js b/lib/scripts/getConversation.js index 091c7f5..2578d51 100644 --- a/lib/scripts/getConversation.js +++ b/lib/scripts/getConversation.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getConversationCall(args, callback) { - apiCall("getConversation", { + return apiCall("getConversation", { "with": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getConversationCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getConversationCall(args, callback); + return getConversationCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getConversations.js b/lib/scripts/getConversations.js index 4f95dce..2c5f1a8 100644 --- a/lib/scripts/getConversations.js +++ b/lib/scripts/getConversations.js @@ -2,7 +2,7 @@ import apiCall from './api'; import handleInactive from './handleInactive'; function getConversationsCall(callback) { - apiCall("getConversations", {}, + return apiCall("getConversations", {}, function(response) { handleInactive(response); callback(response.data); @@ -10,5 +10,5 @@ function getConversationsCall(callback) { }; export default function(callback) { - getConversationsCall(callback); + return getConversationsCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getCustomFields.js b/lib/scripts/getCustomFields.js index eff59e9..aca6cd0 100644 --- a/lib/scripts/getCustomFields.js +++ b/lib/scripts/getCustomFields.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getCustomFieldsCall(callback) { - apiCall("getCustomFields", {}, + return apiCall("getCustomFields", {}, function(response) { callback(response.data); }); @@ -10,5 +10,5 @@ function getCustomFieldsCall(callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getCustomFieldsCall(callback); + return getCustomFieldsCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getFeedback.js b/lib/scripts/getFeedback.js index 9d5384c..dc263d1 100644 --- a/lib/scripts/getFeedback.js +++ b/lib/scripts/getFeedback.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getFeedbackCall(args, callback) { - apiCall("getFeedback", { + return apiCall("getFeedback", { "url": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getFeedbackCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getFeedbackCall(args, callback); + return getFeedbackCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getFollowers.js b/lib/scripts/getFollowers.js index 526b07f..f54ba35 100644 --- a/lib/scripts/getFollowers.js +++ b/lib/scripts/getFollowers.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getFollowersCall(args, callback) { - apiCall("getFollowers", { + return apiCall("getFollowers", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getFollowersCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getFollowersCall(args, callback); + return getFollowersCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getFollowing.js b/lib/scripts/getFollowing.js index ca241a5..3c52423 100644 --- a/lib/scripts/getFollowing.js +++ b/lib/scripts/getFollowing.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getFollowingCall(args, callback) { - apiCall("getFollowing", { + return apiCall("getFollowing", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getFollowingCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getFollowingCall(args, callback); + return getFollowingCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getGroup.js b/lib/scripts/getGroup.js index 69dbfb5..c60e78c 100644 --- a/lib/scripts/getGroup.js +++ b/lib/scripts/getGroup.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getGroupCall(args, callback) { - apiCall("getGroup", { + return apiCall("getGroup", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getGroupCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getGroupCall(args, callback); + return getGroupCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getId.js b/lib/scripts/getId.js index dc06c9d..5210c39 100644 --- a/lib/scripts/getId.js +++ b/lib/scripts/getId.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getIdCall(args, callback) { - apiCall("getId", { + return apiCall("getId", { "ref": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getIdCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getIdCall(args, callback); + return getIdCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getInbox.js b/lib/scripts/getInbox.js index b7bce78..ebd87cf 100644 --- a/lib/scripts/getInbox.js +++ b/lib/scripts/getInbox.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getInboxCall(callback) { - apiCall("getInbox", {}, + return apiCall("getInbox", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getInboxCall(callback); + return getInboxCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getMembers.js b/lib/scripts/getMembers.js index 4f5cd7f..2f4bbf7 100644 --- a/lib/scripts/getMembers.js +++ b/lib/scripts/getMembers.js @@ -2,7 +2,7 @@ import apiCall from './api'; import handleInactive from './handleInactive'; function getMembersCall(callback) { - apiCall("getMembers", {}, + return apiCall("getMembers", {}, function(response) { handleInactive(response); callback(response.data); @@ -10,5 +10,5 @@ function getMembersCall(callback) { }; export default function(callback) { - getMembersCall(callback); + return getMembersCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getMessage.js b/lib/scripts/getMessage.js index 3d7383f..af995a4 100644 --- a/lib/scripts/getMessage.js +++ b/lib/scripts/getMessage.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getMessageCall(args, callback) { - apiCall("getMessage", { + return apiCall("getMessage", { "msgid": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getMessageCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getMessageCall(args, callback); + return getMessageCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getNotifications.js b/lib/scripts/getNotifications.js index 30db398..667c712 100644 --- a/lib/scripts/getNotifications.js +++ b/lib/scripts/getNotifications.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getNotificationsCall(callback) { - apiCall("getNotifications", {}, + return apiCall("getNotifications", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getNotificationsCall(callback); + return getNotificationsCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getNotificationsCount.js b/lib/scripts/getNotificationsCount.js index 1b04c9c..90e29fd 100644 --- a/lib/scripts/getNotificationsCount.js +++ b/lib/scripts/getNotificationsCount.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getNotificationsCountCall(callback) { - apiCall("getNotificationsCount", {}, + return apiCall("getNotificationsCount", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getNotificationsCountCall(callback); + return getNotificationsCountCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getOutbox.js b/lib/scripts/getOutbox.js index 7d62df3..3c27a12 100644 --- a/lib/scripts/getOutbox.js +++ b/lib/scripts/getOutbox.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getOutboxCall(callback) { - apiCall("getOutbox", {}, + return apiCall("getOutbox", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getOutboxCall(callback); + return getOutboxCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getPrivateContent.js b/lib/scripts/getPrivateContent.js index b0a6999..52bdcef 100644 --- a/lib/scripts/getPrivateContent.js +++ b/lib/scripts/getPrivateContent.js @@ -1,7 +1,7 @@ import apiCall from './api'; function getPrivateContentCall(args, callback) { - apiCall("getPrivateContent", { + return apiCall("getPrivateContent", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getPrivateContentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getPrivateContentCall(args, callback); + return getPrivateContentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getProfile.js b/lib/scripts/getProfile.js index 359146b..d812bef 100644 --- a/lib/scripts/getProfile.js +++ b/lib/scripts/getProfile.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getProfileCall(args, callback) { - apiCall("getProfile", { + return apiCall("getProfile", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getProfileCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getProfileCall(args, callback); + return getProfileCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getSession.js b/lib/scripts/getSession.js index c4e3c97..79da022 100644 --- a/lib/scripts/getSession.js +++ b/lib/scripts/getSession.js @@ -1,6 +1,6 @@ import getUser from './getUser.js'; -function getSessionCall(callback) { +export default function(callback) { let key = (window && window.hasOwnProperty('GraphJSConfig')) ? window.GraphJSConfig.id.replace(/-/g, '') : undefined; let id; let username; @@ -41,17 +41,13 @@ function getSessionCall(callback) { if(response.success) { let expiry = new Date(); expiry.setTime(expiry.getTime() + (10 * 60 * 1000)); - document.cookie = 'graphjs_' + key + '_id=' + response.id + '; path=/; expires=' + expiry.toGMTString(); - document.cookie = 'graphjs_' + key + '_username=' + response.username + '; path=/; expires=' + expiry.toGMTString(); + document.cookie = 'graphjs_' + key + '_id=' + response.id + '; path=/; expires=' + expiry.toGMTString() + '; samesite=none; secure;';; + document.cookie = 'graphjs_' + key + '_username=' + response.username + '; path=/; expires=' + expiry.toGMTString() + '; samesite=none; secure;';; } else { - document.cookie = 'graphjs_' + key + '_session_off=true; path=/;'; + document.cookie = 'graphjs_' + key + '_session_off=true; path=/; samesite=none; secure;'; } callback(response); }); } } -}; - -export default function(callback) { - getSessionCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getStar.js b/lib/scripts/getStar.js index fdd58ab..c298b91 100644 --- a/lib/scripts/getStar.js +++ b/lib/scripts/getStar.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getStarCall(args, callback) { - apiCall("isStarred", { + return apiCall("isStarred", { "url": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getStarCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getStarCall(args, callback); + return getStarCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getStars.js b/lib/scripts/getStars.js index 3e021d9..b0b90f0 100644 --- a/lib/scripts/getStars.js +++ b/lib/scripts/getStars.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getStarsCall(callback) { - apiCall("getStarredContent", {}, + return apiCall("getStarredContent", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getStarsCall(callback); + return getStarsCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getStatusUpdate.js b/lib/scripts/getStatusUpdate.js index 9727be8..6931d9c 100644 --- a/lib/scripts/getStatusUpdate.js +++ b/lib/scripts/getStatusUpdate.js @@ -2,7 +2,7 @@ import apiCall from './api.js'; import metadata from '../../metadata/index'; function getStatusUpdateCall(args, callback) { - apiCall("getStatusUpdate", { + return apiCall("getStatusUpdate", { "id": args[0] }, function(response) { @@ -14,7 +14,7 @@ export default function() { let args = Array.from(arguments); let callback = args.pop(); //getStatusUpdatesCall(args, callback); - middleware(args, callback); // Temporary + return middleware(args, callback); // Temporary }; export function transformFeedItem(feedItem) { @@ -60,7 +60,7 @@ export function transformFeedItem(feedItem) { // Middleware import getBlogPost from './getBlogPost'; function middleware(args, callback) { - getBlogPost(args[0], function(response) { + return getBlogPost(args[0], function(response) { response.update = transformFeedItem(response.blog); delete response.blog; callback(response); diff --git a/lib/scripts/getStatusUpdateComments.js b/lib/scripts/getStatusUpdateComments.js index 4a8b276..ddd8404 100644 --- a/lib/scripts/getStatusUpdateComments.js +++ b/lib/scripts/getStatusUpdateComments.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getStatusUpdateCommentsCall(args, callback) { - apiCall("getComments", { + return apiCall("getComments", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getStatusUpdateCommentsCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getStatusUpdateCommentsCall(args, callback); + return getStatusUpdateCommentsCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getStatusUpdates.js b/lib/scripts/getStatusUpdates.js index 2060e35..7a0c544 100644 --- a/lib/scripts/getStatusUpdates.js +++ b/lib/scripts/getStatusUpdates.js @@ -3,7 +3,7 @@ import metadata from '../../metadata/index'; import { transformFeedItem } from './getStatusUpdate'; function getStatusUpdatesCall(offset, count, callback) { - apiCall("getStatusUpdates", {"offset": offset, "count": count}, + return apiCall("getStatusUpdates", {"offset": offset, "count": count}, function(response) { callback(response.data); }); @@ -11,14 +11,14 @@ function getStatusUpdatesCall(offset, count, callback) { export default function(offset, count, callback) { //getStatusUpdatesCall(offset, count, callback); - middleware(offset, count, callback); // Temporary + return middleware(offset, count, callback); // Temporary }; // Middleware import getBlogPosts from './getBlogPosts'; import handleInactive from './handleInactive.js'; function middleware(offset, count, callback) { - getBlogPosts("desc", count, offset, + return getBlogPosts("desc", count, offset, function(response) { handleInactive(response); response.updates = []; diff --git a/lib/scripts/getThread.js b/lib/scripts/getThread.js index 1b07d9d..b3290b2 100644 --- a/lib/scripts/getThread.js +++ b/lib/scripts/getThread.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getThreadCall(args, callback) { - apiCall("getThread", { + return apiCall("getThread", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getThreadCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getThreadCall(args, callback); + return getThreadCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getThreads.js b/lib/scripts/getThreads.js index 3118568..0429c13 100644 --- a/lib/scripts/getThreads.js +++ b/lib/scripts/getThreads.js @@ -16,7 +16,7 @@ function getThreadsCall(args, callback) { } } console.log(offset) - apiCall("getThreads", { + return apiCall("getThreads", { "order": order, "count": count, "offset": offset @@ -30,5 +30,5 @@ function getThreadsCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getThreadsCall(args, callback); + return getThreadsCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getUpvote.js b/lib/scripts/getUpvote.js index ca74b6b..86d3568 100644 --- a/lib/scripts/getUpvote.js +++ b/lib/scripts/getUpvote.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function getUpvoteCall(args, callback) { - apiCall("isStarred", { + return apiCall("isStarred", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function getUpvoteCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - getUpvoteCall(args, callback); + return getUpvoteCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/getUser.js b/lib/scripts/getUser.js index e08e55a..06d0f0a 100644 --- a/lib/scripts/getUser.js +++ b/lib/scripts/getUser.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getUserCall(callback) { - apiCall("whoami", {}, + return apiCall("whoami", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getUserCall(callback); + return getUserCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/getUserStars.js b/lib/scripts/getUserStars.js index be53e90..eac6e79 100644 --- a/lib/scripts/getUserStars.js +++ b/lib/scripts/getUserStars.js @@ -1,12 +1,12 @@ import apiCall from './api'; function getUserStarsCall(callback) { - apiCall("getMyStarredContent", {}, + return apiCall("getMyStarredContent", {}, function(response) { callback(response.data); }); }; export default function(callback) { - getUserStarsCall(callback); + return getUserStarsCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/joinGroup.js b/lib/scripts/joinGroup.js index dd2b7e2..634cf54 100644 --- a/lib/scripts/joinGroup.js +++ b/lib/scripts/joinGroup.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function joinGroupCall(args, callback) { - apiCall("join", { + return apiCall("join", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function joinGroupCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - joinGroupCall(args, callback); + return joinGroupCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/leaveGroup.js b/lib/scripts/leaveGroup.js index b9eb9c5..a45d4b0 100644 --- a/lib/scripts/leaveGroup.js +++ b/lib/scripts/leaveGroup.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function leaveGroupCall(args, callback) { - apiCall("leave", { + return apiCall("leave", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function leaveGroupCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - leaveGroupCall(args, callback); + return leaveGroupCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/listGroups.js b/lib/scripts/listGroups.js index cbb1642..5c2b07c 100644 --- a/lib/scripts/listGroups.js +++ b/lib/scripts/listGroups.js @@ -1,12 +1,12 @@ import apiCall from './api'; function listGroupsCall(callback) { - apiCall("listGroups", {}, + return apiCall("listGroups", {}, function(response) { callback(response.data); }); }; export default function(callback) { - listGroupsCall(callback); + return listGroupsCall(callback); }; \ No newline at end of file diff --git a/lib/scripts/listMembers.js b/lib/scripts/listMembers.js index ca758fb..c7dbae2 100644 --- a/lib/scripts/listMembers.js +++ b/lib/scripts/listMembers.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function listMembersCall(args, callback) { - apiCall("listMembers", { + return apiCall("listMembers", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function listMembersCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - listMembersCall(args, callback); + return listMembersCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/listMemberships.js b/lib/scripts/listMemberships.js index a0578ff..7c4443b 100644 --- a/lib/scripts/listMemberships.js +++ b/lib/scripts/listMemberships.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function listMembershipsCall(args, callback) { - apiCall("listMemberships", { + return apiCall("listMemberships", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function listMembershipsCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - listMembershipsCall(args, callback); + return listMembershipsCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/listPrivateContents.js b/lib/scripts/listPrivateContents.js index 03bc891..826fd2b 100644 --- a/lib/scripts/listPrivateContents.js +++ b/lib/scripts/listPrivateContents.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; export default function(callback) { - apiCall("listPrivateContents", {}, + return apiCall("listPrivateContents", {}, function(response) { callback(response.data); }); diff --git a/lib/scripts/login.js b/lib/scripts/login.js index 63220d6..8cb3a9a 100644 --- a/lib/scripts/login.js +++ b/lib/scripts/login.js @@ -1,24 +1,35 @@ import apiCall from './api.js'; import handleLoginCookies from './_handleLoginCookies.js'; +const Q = require("q"); function loginCall(args, callback) { + var def = Q.defer(); let username = args[0]; window.GraphJS.events.emit("beforeLogin"); - apiCall("login", { + let _call = apiCall("login", { "username": username, "password": args[1] }, function(response) { - if(response.data.success) { - handleLoginCookies(username, response.data.id); - window.GraphJS.events.emit("afterLogin", args, response.data); - } callback(response.data); }, false); + _call.then(res => + { + if(res.success) { + handleLoginCookies(username, res.id); + window.GraphJS.events.emit("afterLogin", args, res); + } + def.resolve(res); + }); + _call.catch(err => + { + def.reject(err); + }); + return def.promise; }; export default function() { let args = Array.from(arguments); let callback = args.pop(); - loginCall(args, callback); + return loginCall(args, callback); }; diff --git a/lib/scripts/logout.js b/lib/scripts/logout.js index dc64f78..bc22d25 100644 --- a/lib/scripts/logout.js +++ b/lib/scripts/logout.js @@ -1,20 +1,32 @@ import apiCall from './api'; +const Q = require("q"); -function logoutCall(callback) { +export default function(callback) { + var def = Q.defer(); window.GraphJS.events.emit("beforeLogout"); - apiCall("logout", {}, + let _call = apiCall("logout", {}, function(response) { - if(response.data.success) { - let key = (window && window.hasOwnProperty('GraphJSConfig')) ? window.GraphJSConfig.id.replace(/-/g, '') : undefined; - document.cookie = 'graphjs_' + key + '_id=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - document.cookie = 'graphjs_' + key + '_username=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - document.cookie = 'graphjs_' + key + '_session_off=true; path=/;'; - window.GraphJS.events.emit("afterLogout"); - } callback(response.data); }, false); + _call.then(res => + { + if(res.success) { + _clearCookies(); + window.GraphJS.events.emit("afterLogout"); + } + def.resolve(res); + }); + _call.catch(err => + { + def.reject(err); + }); + return def.promise; }; -export default function(callback) { - logoutCall(callback); -}; \ No newline at end of file +function _clearCookies() { + let key = (window && window.hasOwnProperty('GraphJSConfig')) ? window.GraphJSConfig.id.replace(/-/g, '') : undefined; + let secure = (location.protocol === 'https:') ? " secure;" : ""; + document.cookie = 'graphjs_' + key + '_id=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=none;' + secure; + document.cookie = 'graphjs_' + key + '_username=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=none;' + secure + document.cookie = 'graphjs_' + key + '_session_off=true; path=/; samesite=none;' + secure +} \ No newline at end of file diff --git a/lib/scripts/post.js b/lib/scripts/post.js index ddaa07d..b737493 100644 --- a/lib/scripts/post.js +++ b/lib/scripts/post.js @@ -1,10 +1,12 @@ import axios from 'axios'; +const Q = require("q"); function ucfirst(string) { return string.charAt(0).toUpperCase() + string.slice(1); } function ApiCall(method, args, callback, emitPostSignal){ + var def = Q.defer(); var instance = axios.create({ baseURL: window.GraphJSConfig.host, timeout: 20000, @@ -19,12 +21,16 @@ function ApiCall(method, args, callback, emitPostSignal){ instance.post(`/${method}?public_id=${window.GraphJSConfig.id}`, JSON.stringify(args)) .then(function(response) { callback(response); + def.resolve(response); if(emitPostSignal) window.GraphJS.events.emit("after" + ucfirst(method), args); }) .catch(function (error) { console.log(error); + def.reject(error); }); + + return def.promise; } export default function(method, args, callback, emitPostSignal = true) { @@ -32,10 +38,10 @@ export default function(method, args, callback, emitPostSignal = true) { if(beforeEventsExist){ window.GraphJS.events.emit("before" + ucfirst(method), args,function(goToNextStep = true) { if(goToNextStep){ - ApiCall(method, args, callback, emitPostSignal); + return ApiCall(method, args, callback, emitPostSignal); } }); } else { - ApiCall(method, args, callback, emitPostSignal); + return ApiCall(method, args, callback, emitPostSignal); } } \ No newline at end of file diff --git a/lib/scripts/publishBlogPost.js b/lib/scripts/publishBlogPost.js index 8b4ca5d..7c3af7e 100644 --- a/lib/scripts/publishBlogPost.js +++ b/lib/scripts/publishBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function publishBlogPostCall(args, callback) { - apiCall("publishBlogPost", { + return apiCall("publishBlogPost", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function publishBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - publishBlogPostCall(args, callback); + return publishBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/register.js b/lib/scripts/register.js index c9f8c78..f3275c9 100644 --- a/lib/scripts/register.js +++ b/lib/scripts/register.js @@ -2,7 +2,7 @@ import apiCall from './api'; function registerCall(args, callback) { window.GraphJS.events.emit("beforeRegister", args); - apiCall("signup", { + return apiCall("signup", { "username": args[0], "email": args[1], "password": args[2], @@ -21,5 +21,5 @@ function registerCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - registerCall(args, callback); + return registerCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeBlogComment.js b/lib/scripts/removeBlogComment.js index a57a772..f688a9b 100644 --- a/lib/scripts/removeBlogComment.js +++ b/lib/scripts/removeBlogComment.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeBlogCommentCall(args, callback) { - apiCall("removeComment", { + return apiCall("removeComment", { "comment_id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeBlogCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeBlogCommentCall(args, callback); + return removeBlogCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeBlogPost.js b/lib/scripts/removeBlogPost.js index e8266bf..2b105ea 100644 --- a/lib/scripts/removeBlogPost.js +++ b/lib/scripts/removeBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeBlogPostCall(args, callback) { - apiCall("removeBlogPost", { + return apiCall("removeBlogPost", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeBlogPostCall(args, callback); + return removeBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeComment.js b/lib/scripts/removeComment.js index d37f893..df29182 100644 --- a/lib/scripts/removeComment.js +++ b/lib/scripts/removeComment.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeCommentCall(args, callback) { - apiCall("removeComment", { + return apiCall("removeComment", { "comment_id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeCommentCall(args, callback); + return removeCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeFeedback.js b/lib/scripts/removeFeedback.js index d4514d7..6bcb63c 100644 --- a/lib/scripts/removeFeedback.js +++ b/lib/scripts/removeFeedback.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeFeedbackCall(args, callback) { - apiCall("removeFeedback", { + return apiCall("removeFeedback", { "feedback_id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeFeedbackCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeFeedbackCall(args, callback); + return removeFeedbackCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removePrivateContent.js b/lib/scripts/removePrivateContent.js index 831f4b3..4e99fe3 100644 --- a/lib/scripts/removePrivateContent.js +++ b/lib/scripts/removePrivateContent.js @@ -1,7 +1,7 @@ import apiCall from './api'; function deletePrivateContentCall(args, callback) { - apiCall("deletePrivateContent", { + return apiCall("deletePrivateContent", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function deletePrivateContentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - deletePrivateContentCall(args, callback); + return deletePrivateContentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeReply.js b/lib/scripts/removeReply.js index e3e0136..31536a0 100644 --- a/lib/scripts/removeReply.js +++ b/lib/scripts/removeReply.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeCommentCall(args, callback) { - apiCall("deleteForumPost", { + return apiCall("deleteForumPost", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeCommentCall(args, callback); + return removeCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeStar.js b/lib/scripts/removeStar.js index 2366b6f..72910a2 100644 --- a/lib/scripts/removeStar.js +++ b/lib/scripts/removeStar.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeStarCall(args, callback) { - apiCall("unstar", { + return apiCall("unstar", { "url": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeStarCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeStarCall(args, callback); + return removeStarCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeStatusUpdate.js b/lib/scripts/removeStatusUpdate.js index 1b3a0dd..da5fc57 100644 --- a/lib/scripts/removeStatusUpdate.js +++ b/lib/scripts/removeStatusUpdate.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeStatusUpdateCall(args, callback) { - apiCall("removeStatusUpdate", { + return apiCall("removeStatusUpdate", { "id": args[0] }, function(response) { @@ -13,14 +13,14 @@ export default function() { let args = Array.from(arguments); let callback = args.pop(); //updateStatusCall(args, callback); - middleware(args, callback); //Temporary + return middleware(args, callback); //Temporary }; // Middleware import removeBlogPost from './removeBlogPost'; function middleware(args, callback) { let id = args[0] - removeBlogPost(id, function(response) { + return removeBlogPost(id, function(response) { callback(response); }); } \ No newline at end of file diff --git a/lib/scripts/removeStatusUpdateComment.js b/lib/scripts/removeStatusUpdateComment.js index b699e5f..aed700e 100644 --- a/lib/scripts/removeStatusUpdateComment.js +++ b/lib/scripts/removeStatusUpdateComment.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeStatusUpdateCommentCall(args, callback) { - apiCall("removeComment", { + return apiCall("removeComment", { "comment_id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeStatusUpdateCommentCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeStatusUpdateCommentCall(args, callback); + return removeStatusUpdateCommentCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/removeUpvote.js b/lib/scripts/removeUpvote.js index 2d230c8..e05fd6d 100644 --- a/lib/scripts/removeUpvote.js +++ b/lib/scripts/removeUpvote.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function removeUpvoteCall(args, callback) { - apiCall("unstar", { + return apiCall("unstar", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function removeUpvoteCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - removeUpvoteCall(args, callback); + return removeUpvoteCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/replyThread.js b/lib/scripts/replyThread.js index a00e3dd..1b57404 100644 --- a/lib/scripts/replyThread.js +++ b/lib/scripts/replyThread.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function replyThreadCall(args, callback) { - apiCall("reply", { + return apiCall("reply", { "id": args[0], "message": args[1] }, @@ -13,5 +13,5 @@ function replyThreadCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - replyThreadCall(args, callback); + return replyThreadCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/reset.js b/lib/scripts/reset.js index d9f8749..1aa5802 100644 --- a/lib/scripts/reset.js +++ b/lib/scripts/reset.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function resetCall(args, callback) { - apiCall("resetPassword", { + return apiCall("resetPassword", { "email": args[0] }, function(response) { @@ -12,5 +12,5 @@ function resetCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - resetCall(args, callback); + return resetCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/sendAnonymousMessage.js b/lib/scripts/sendAnonymousMessage.js index 93b55d8..09bb204 100644 --- a/lib/scripts/sendAnonymousMessage.js +++ b/lib/scripts/sendAnonymousMessage.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function sendAnonymousMessageCall(args, callback) { - apiCall("sendAnonymousMessage", { + return apiCall("sendAnonymousMessage", { "sender": args[0], "to": args[1], "message": args[2] @@ -14,5 +14,5 @@ function sendAnonymousMessageCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - sendAnonymousMessageCall(args, callback); + return sendAnonymousMessageCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/sendMessage.js b/lib/scripts/sendMessage.js index 5742c35..79ead6b 100644 --- a/lib/scripts/sendMessage.js +++ b/lib/scripts/sendMessage.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function sendMessageCall(args, callback) { - apiCall("sendMessage", { + return apiCall("sendMessage", { "to": args[0], "message": args[1] }, @@ -13,5 +13,5 @@ function sendMessageCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - sendMessageCall(args, callback); + return sendMessageCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setAvatar.js b/lib/scripts/setAvatar.js index ad7156f..beb4103 100644 --- a/lib/scripts/setAvatar.js +++ b/lib/scripts/setAvatar.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setAvatarCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "avatar": args[0] }, function(response) { @@ -12,5 +12,5 @@ function setAvatarCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setAvatarCall(args, callback); + return setAvatarCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setBio.js b/lib/scripts/setBio.js index c0888e3..7a87de6 100644 --- a/lib/scripts/setBio.js +++ b/lib/scripts/setBio.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setBioCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "about": args[0] }, function(response) { @@ -12,5 +12,5 @@ function setBioCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setBioCall(args, callback); + return setBioCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setBirthday.js b/lib/scripts/setBirthday.js index 42125cd..c12f1e6 100644 --- a/lib/scripts/setBirthday.js +++ b/lib/scripts/setBirthday.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setBirthdayCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "birthday": args[0] }, function(response) { @@ -12,5 +12,5 @@ function setBirthdayCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setBirthdayCall(args, callback); + return setBirthdayCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setEmail.js b/lib/scripts/setEmail.js index 083ff8a..35fb89f 100644 --- a/lib/scripts/setEmail.js +++ b/lib/scripts/setEmail.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setEmailCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "email": args[0] }, function(response) { @@ -12,5 +12,5 @@ function setEmailCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setEmailCall(args, callback); + return setEmailCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setGroupCover.js b/lib/scripts/setGroupCover.js index 2b9a6d4..8c8e5b2 100644 --- a/lib/scripts/setGroupCover.js +++ b/lib/scripts/setGroupCover.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setGroupCoverCall(args, callback) { - apiCall("setGroup", { + return apiCall("setGroup", { "id": args[0], "cover": args[1] }, @@ -13,5 +13,5 @@ function setGroupCoverCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setGroupCoverCall(args, callback); + return setGroupCoverCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setGroupDescription.js b/lib/scripts/setGroupDescription.js index dd3b465..0ed3418 100644 --- a/lib/scripts/setGroupDescription.js +++ b/lib/scripts/setGroupDescription.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setGroupDescriptionCall(args, callback) { - apiCall("setGroup", { + return apiCall("setGroup", { "id": args[0], "description": args[1] }, @@ -13,5 +13,5 @@ function setGroupDescriptionCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setGroupDescriptionCall(args, callback); + return setGroupDescriptionCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setGroupTitle.js b/lib/scripts/setGroupTitle.js index e5b5de7..7c6428e 100644 --- a/lib/scripts/setGroupTitle.js +++ b/lib/scripts/setGroupTitle.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setGroupTitleCall(args, callback) { - apiCall("setGroup", { + return apiCall("setGroup", { "id": args[0], "title": args[1] }, @@ -13,5 +13,5 @@ function setGroupTitleCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setGroupTitleCall(args, callback); + return setGroupTitleCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setPassword.js b/lib/scripts/setPassword.js index 8cd2306..dc99eef 100644 --- a/lib/scripts/setPassword.js +++ b/lib/scripts/setPassword.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setPasswordCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "password": args[0] }, function(response) { diff --git a/lib/scripts/setProfile.js b/lib/scripts/setProfile.js index 397fe08..00cc4ce 100644 --- a/lib/scripts/setProfile.js +++ b/lib/scripts/setProfile.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setProfileCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "avatar": args[0], "birthday": args[1], "about": args[2], @@ -16,5 +16,5 @@ function setProfileCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setProfileCall(args, callback); + return setProfileCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/setUsername.js b/lib/scripts/setUsername.js index ca262e7..ee3cede 100644 --- a/lib/scripts/setUsername.js +++ b/lib/scripts/setUsername.js @@ -1,7 +1,7 @@ import apiCall from './api'; function setUsernameCall(args, callback) { - apiCall("setProfile", { + return apiCall("setProfile", { "username": args[0] }, function(response) { @@ -12,5 +12,5 @@ function setUsernameCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - setUsernameCall(args, callback); + return setUsernameCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/star.js b/lib/scripts/star.js index dd02364..730ca6f 100644 --- a/lib/scripts/star.js +++ b/lib/scripts/star.js @@ -1,16 +1,17 @@ import apiCall from './api.js'; function starCall(args, callback) { - apiCall("star", { + return apiCall("star", { "url": args[0] }, function(response) { callback(response.data); - }); + }, + ); }; export default function() { let args = Array.from(arguments); let callback = args.pop(); - starCall(args, callback); + return starCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/startBlogPost.js b/lib/scripts/startBlogPost.js index 9c07e3e..a3b12d7 100644 --- a/lib/scripts/startBlogPost.js +++ b/lib/scripts/startBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './post.js'; // Moved to POST api function startBlogPostCall(args, callback) { - apiCall("startBlogPost", { + return apiCall("startBlogPost", { "title": args[0], "content": args[1] }, @@ -13,5 +13,5 @@ function startBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - startBlogPostCall(args, callback); + return startBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/startThread.js b/lib/scripts/startThread.js index d8e871b..5c7f6b3 100644 --- a/lib/scripts/startThread.js +++ b/lib/scripts/startThread.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function startThreadCall(args, callback) { - apiCall("startThread", { + return apiCall("startThread", { "title": args[0], "message": args[1] }, @@ -13,5 +13,5 @@ function startThreadCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - startThreadCall(args, callback); + return startThreadCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/tokenLogin.js b/lib/scripts/tokenLogin.js index 0753872..38fa839 100644 --- a/lib/scripts/tokenLogin.js +++ b/lib/scripts/tokenLogin.js @@ -1,25 +1,34 @@ import apiCall from './api.js'; +import handleLoginCookies from './_handleLoginCookies.js'; +const Q = require("q"); function tokenLoginCall(args, callback) { + var def = Q.defer(); window.GraphJS.events.emit("beforeLogin"); - apiCall("tokenLogin", { + let _call = apiCall("tokenLogin", { "token": args[0] }, function(response) { - if(response.data.success) { - let key = (window && window.hasOwnProperty('GraphJSConfig')) ? window.GraphJSConfig.id.replace(/-/g, '') : undefined; - let expiry = new Date(); - expiry.setTime(expiry.getTime() + (10 * 60 * 1000)); - document.cookie = 'graphjs_' + key + '_id=' + response.data.id + '; path=/; expires=' + expiry.toGMTString(); - document.cookie = 'graphjs_' + key + '_session_off=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; - window.GraphJS.events.emit("afterLogin", args); - } callback(response.data); }, false); + _call.then(res => + { + if(res.success) { + handleLoginCookies(res.username, res.id); + window.GraphJS.events.emit("afterLogin", args, res); + } + def.resolve(res); + }); + _call.catch(err => + { + def.reject(err); + }); + + return def.promise; }; export default function() { let args = Array.from(arguments); let callback = args.pop(); - tokenLoginCall(args, callback); + return tokenLoginCall(args, callback); }; diff --git a/lib/scripts/unfollow.js b/lib/scripts/unfollow.js index b5b9d38..8bd2645 100644 --- a/lib/scripts/unfollow.js +++ b/lib/scripts/unfollow.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function unfollowCall(args, callback) { - apiCall("unfollow", { + return apiCall("unfollow", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function unfollowCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - unfollowCall(args, callback); + return unfollowCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/unpublishBlogPost.js b/lib/scripts/unpublishBlogPost.js index 3e62550..d0572a5 100644 --- a/lib/scripts/unpublishBlogPost.js +++ b/lib/scripts/unpublishBlogPost.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function unpublishBlogPostCall(args, callback) { - apiCall("unpublishBlogPost", { + return apiCall("unpublishBlogPost", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function unpublishBlogPostCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - unpublishBlogPostCall(args, callback); + return unpublishBlogPostCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/updateStatus.js b/lib/scripts/updateStatus.js index c8e7d99..b182604 100644 --- a/lib/scripts/updateStatus.js +++ b/lib/scripts/updateStatus.js @@ -3,7 +3,7 @@ import apiCall from './post.js'; import metadata from '../../metadata/index.js'; function updateStatusCall(args, callback) { - apiCall("updateStatus", { + return apiCall("updateStatus", { "type": args[0], "message": args[1], "content": args[2] @@ -17,7 +17,7 @@ export default function() { let args = Array.from(arguments); let callback = args.pop(); //updateStatusCall(args, callback); - middleware(args, callback); // Temporary + return middleware(args, callback); // Temporary }; // Middleware @@ -36,7 +36,7 @@ function middleware(args, callback) { } let result = (message + ' ' + markdown).trim(); result += metaStr; - startBlogPost( + return startBlogPost( 'feed', // Title result, // Content function(response) { diff --git a/lib/scripts/upvote.js b/lib/scripts/upvote.js index 2cf1fa4..5ffea20 100644 --- a/lib/scripts/upvote.js +++ b/lib/scripts/upvote.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function upvoteCall(args, callback) { - apiCall("star", { + return apiCall("star", { "id": args[0] }, function(response) { @@ -12,5 +12,5 @@ function upvoteCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - upvoteCall(args, callback); + return upvoteCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/verify.js b/lib/scripts/verify.js index 37fa768..269c693 100644 --- a/lib/scripts/verify.js +++ b/lib/scripts/verify.js @@ -1,7 +1,7 @@ import apiCall from './api.js'; function resetCall(args, callback) { - apiCall("verifyReset", { + return apiCall("verifyReset", { "email": args[0], "code": args[1] }, @@ -13,5 +13,5 @@ function resetCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - resetCall(args, callback); + return resetCall(args, callback); }; \ No newline at end of file diff --git a/lib/scripts/verifyEmailCode.js b/lib/scripts/verifyEmailCode.js index 72c76c7..e185976 100644 --- a/lib/scripts/verifyEmailCode.js +++ b/lib/scripts/verifyEmailCode.js @@ -2,7 +2,7 @@ import apiCall from './api.js'; import handleLoginCookies from './_handleLoginCookies.js'; function verifyEmailCodeCall(args, callback) { - apiCall("verifyEmailCode", { + return apiCall("verifyEmailCode", { "id": args[0], "code": args[1] }, @@ -18,5 +18,5 @@ function verifyEmailCodeCall(args, callback) { export default function() { let args = Array.from(arguments); let callback = args.pop(); - verifyEmailCodeCall(args, callback); + return verifyEmailCodeCall(args, callback); }; \ No newline at end of file diff --git a/lib/styles/components/feed-item.less b/lib/styles/components/feed-item.less index dafe868..a05c487 100644 --- a/lib/styles/components/feed-item.less +++ b/lib/styles/components/feed-item.less @@ -43,17 +43,10 @@ .@{prefix}-embed-iframe { position: relative; - padding-bottom: 56.25%; padding-top: 2em; - height: 0; - overflow: hidden; - iframe { width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; + min-height: 360px; } } diff --git a/lib/tags/auth-login.tag b/lib/tags/auth-login.tag index 0d700e6..51aea78 100644 --- a/lib/tags/auth-login.tag +++ b/lib/tags/auth-login.tag @@ -11,7 +11,7 @@