mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
remove twitter api for get latest tweet
This commit is contained in:
parent
900d84f3c6
commit
db29673a4c
@ -10,16 +10,13 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Application.Controllers.controller('HomeController', ['$scope', '$stateParams', 'Twitter', 'lastMembersPromise', 'lastProjectsPromise', 'upcomingEventsPromise', 'homeBlogpostPromise', 'twitterNamePromise',
|
||||
function ($scope, $stateParams, Twitter, lastMembersPromise, lastProjectsPromise, upcomingEventsPromise, homeBlogpostPromise, twitterNamePromise) {
|
||||
Application.Controllers.controller('HomeController', ['$scope', '$stateParams', 'lastMembersPromise', 'lastProjectsPromise', 'upcomingEventsPromise', 'homeBlogpostPromise', 'twitterNamePromise',
|
||||
function ($scope, $stateParams, lastMembersPromise, lastProjectsPromise, upcomingEventsPromise, homeBlogpostPromise, twitterNamePromise) {
|
||||
/* PUBLIC SCOPE */
|
||||
|
||||
// The last registered members who confirmed their addresses
|
||||
$scope.lastMembers = lastMembersPromise;
|
||||
|
||||
// The last tweets from the Fablab official twitter account
|
||||
$scope.lastTweets = [];
|
||||
|
||||
// The last projects published/documented on the plateform
|
||||
$scope.lastProjects = lastProjectsPromise;
|
||||
|
||||
@ -45,10 +42,6 @@ Application.Controllers.controller('HomeController', ['$scope', '$stateParams',
|
||||
* Kind of constructor: these actions will be realized first when the controller is loaded
|
||||
*/
|
||||
const initialize = function () {
|
||||
// we retrieve tweets from here instead of ui-router's promise because, if adblock stop the API request,
|
||||
// this prevent the whole home page to be blocked
|
||||
$scope.lastTweets = Twitter.query({ limit: 1 });
|
||||
|
||||
// if we recieve a token to reset the password as GET parameter, trigger the
|
||||
// changePassword modal from the parent controller
|
||||
if ($stateParams.reset_password_token) {
|
||||
|
@ -1,5 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
Application.Services.factory('Twitter', ['$resource', function ($resource) {
|
||||
return $resource('/api/feeds/twitter_timelines');
|
||||
}]);
|
@ -1,23 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# API Controller to wrap social networks public feeds
|
||||
class API::FeedsController < API::ApiController
|
||||
|
||||
respond_to :json
|
||||
|
||||
def twitter_timelines
|
||||
limit = if params
|
||||
params[:limit]
|
||||
else
|
||||
3
|
||||
end
|
||||
from_account = Setting.find_by(name: 'twitter_name').try(:value) || ENV['TWITTER_NAME']
|
||||
begin
|
||||
@tweet_news = Feed.twitter.user_timeline(from_account, count: limit)
|
||||
rescue Twitter::Error::BadRequest => e
|
||||
STDERR.puts "[WARNING] Unable to retrieve the twitter feed, please check your ENV configuration. Details: #{e.message}"
|
||||
render status: :no_content
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,10 +0,0 @@
|
||||
class Feed
|
||||
mattr_accessor :twitter do
|
||||
Twitter::REST::Client.new do |config|
|
||||
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
|
||||
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
|
||||
config.access_token = ENV['TWITTER_ACCESS_TOKEN']
|
||||
config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET']
|
||||
end
|
||||
end
|
||||
end
|
@ -54,12 +54,8 @@ RECAPTCHA_SECRET_KEY: ''
|
||||
# Projects comments
|
||||
DISQUS_SHORTNAME:
|
||||
|
||||
# Twitter sharing & last tweet on home page
|
||||
# Twitter sharing
|
||||
TWITTER_NAME: 'FablabGrenoble'
|
||||
TWITTER_CONSUMER_KEY: ''
|
||||
TWITTER_CONSUMER_SECRET: ''
|
||||
TWITTER_ACCESS_TOKEN: ''
|
||||
TWITTER_ACCESS_TOKEN_SECRET: ''
|
||||
|
||||
# Facebook sharing
|
||||
FACEBOOK_APP_ID: ''
|
||||
@ -102,4 +98,3 @@ MAX_IMPORT_SIZE: '5242880'
|
||||
MAX_IMAGE_SIZE: '10485760'
|
||||
# 20971520 = 20 megabytes
|
||||
MAX_CAO_SIZE: '20971520'
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
Feed.twitter = Twitter::REST::Client.new do |config|
|
||||
config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
|
||||
config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
|
||||
config.access_token = ENV['TWITTER_ACCESS_TOKEN']
|
||||
config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET']
|
||||
end
|
@ -72,7 +72,6 @@ Rails.application.routes.draw do
|
||||
|
||||
# for homepage
|
||||
get '/last_subscribed/:last' => 'members#last_subscribed'
|
||||
get '/feeds/twitter_timelines' => 'feeds#twitter_timelines'
|
||||
|
||||
get 'pricing' => 'pricing#index'
|
||||
put 'pricing' => 'pricing#update'
|
||||
|
@ -99,7 +99,7 @@ Valid stripe API keys are still required, even if you don't require online payme
|
||||
|
||||
FABLAB_WITHOUT_INVOICES
|
||||
|
||||
If set to 'true', the invoices will be disabled.
|
||||
If set to 'true', the invoices will be disabled.
|
||||
This is useful if you have your own invoicing system and you want to prevent Fab-manager from generating and sending invoices to members.
|
||||
**Very important**: if you disable invoices, you still have to configure VAT in the interface to prevent errors in accounting and prices.
|
||||
<a name="PHONE_REQUIRED"></a>
|
||||
@ -167,15 +167,8 @@ See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
|
||||
|
||||
TWITTER_NAME
|
||||
|
||||
Identifier of the Twitter account, from witch the last tweet will be fetched and displayed on the home page.
|
||||
This value can be graphically overridden during the application's lifecycle in Admin/Customization/Home page/Twitter Feed.
|
||||
Identifier of the Twitter account for Twitter share project, event or training
|
||||
It will also be used for [Twitter Card analytics](https://dev.twitter.com/cards/analytics).
|
||||
<a name="TWITTER_CONSUMER_KEY"></a><a name="TWITTER_CONSUMER_SECRET"></a><a name="TWITTER_ACCESS_TOKEN"></a><a name="TWITTER_ACCESS_TOKEN_SECRET"></a>
|
||||
|
||||
TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN & TWITTER_ACCESS_TOKEN_SECRET
|
||||
|
||||
Keys and secrets to access the twitter API.
|
||||
Retrieve them from https://apps.twitter.co.
|
||||
<a name="FACEBOOK_APP_ID"></a>
|
||||
|
||||
FACEBOOK_APP_ID
|
||||
@ -358,7 +351,7 @@ Accordingly, `RAILS_LOCALE` and `APP_LOCALE` must be configured to `ach`.
|
||||
|
||||
OPENLAB_APP_ID, OPENLAB_APP_SECRET
|
||||
|
||||
This configuration is optional and can only work in production mode.
|
||||
This configuration is optional and can only work in production mode.
|
||||
It allows you to display a shared projects gallery and to share your projects with other fablabs.
|
||||
Send an email to **contact@fab-manager.com** to get your OpenLab client's credentials.
|
||||
<a name="OPENLAB_DEFAULT"></a>
|
||||
|
@ -40,10 +40,6 @@ RECAPTCHA_SECRET_KEY=
|
||||
DISQUS_SHORTNAME=
|
||||
|
||||
TWITTER_NAME=FablabGrenoble
|
||||
TWITTER_CONSUMER_KEY=
|
||||
TWITTER_CONSUMER_SECRET=
|
||||
TWITTER_ACCESS_TOKEN=
|
||||
TWITTER_ACCESS_TOKEN_SECRET=
|
||||
|
||||
FACEBOOK_APP_ID=
|
||||
|
||||
|
@ -212,8 +212,8 @@ configure_env_file()
|
||||
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
|
||||
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_PLANS FABLAB_WITHOUT_SPACES FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_INVOICES \
|
||||
PHONE_REQUIRED USER_CONFIRMATION_NEEDED_TO_SIGN_IN EVENTS_IN_CALENDAR SLOT_DURATION DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
|
||||
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS GA_ID RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME TWITTER_CONSUMER_KEY TWITTER_CONSUMER_SECRET \
|
||||
TWITTER_ACCESS_TOKEN TWITTER_ACCESS_TOKEN_SECRET FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
|
||||
SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS GA_ID RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
|
||||
FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
|
||||
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE MESSAGEFORMAT_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \
|
||||
WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT OPENLAB_APP_ID OPENLAB_APP_SECRET OPENLAB_DEFAULT)
|
||||
for variable in "${variables[@]}"; do
|
||||
@ -331,4 +331,3 @@ setup()
|
||||
}
|
||||
|
||||
setup "$@"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user