Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/now 2.4 #34

Open
wants to merge 27 commits into
base: v2.4.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.production.sample
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,13 @@ STREAMING_CLUSTER_NUM=1
# http_proxy=http://gateway.local:8118
# Access control for hidden service.
# ALLOW_ACCESS_TO_HIDDEN_SERVICE=true

# Facebook
FACEBOOK_APP_ID=xxxxxxxx
FACEBOOK_APP_SECRET=xxxxxxxx
FACEBOOK_CALLBACK_URL=http://example.com/auth/auth/facebook/callback
FACEBOOK_PIXEL_ID=xxxxxxxx

#GitHub
GITHUB_KEY=xxxxxxx
GITHUB_SECRET=xxxxxxxxxxxxxx
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ gem 'webpush'
gem 'json-ld', '~> 2.2'
gem 'rdf-normalize', '~> 0.3'

# Added by Kibousoft
gem 'ruby-bbcode'
gem 'omniauth-github', '~> 1.3.0'
gem 'omniauth-facebook', '~> 4.0.0'
gem 'react-rails-img'
gem 'json'
gem 'twitter-bootstrap-rails'
gem 'therubyracer'
gem 'jquery-rails'

group :development, :test do
gem 'fabrication', '~> 2.20'
gem 'fuubar', '~> 2.2'
Expand Down
70 changes: 65 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ GEM
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.2)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.12)
benchmark-ips (2.7.2)
better_errors (2.4.0)
Expand Down Expand Up @@ -146,6 +150,7 @@ GEM
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.2)
colorize (0.8.1)
commonjs (0.2.7)
concurrent-ruby (1.0.5)
connection_pool (2.2.1)
crack (0.4.3)
Expand Down Expand Up @@ -205,10 +210,11 @@ GEM
et-orbi (1.1.0)
tzinfo
excon (0.62.0)
execjs (2.7.0)
fabrication (2.20.1)
faker (1.8.7)
i18n (>= 0.7)
faraday (0.15.0)
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
fast_blank (1.0.0)
fastimage (2.1.1)
Expand Down Expand Up @@ -285,12 +291,16 @@ GEM
ipaddress (0.8.3)
iso-639 (0.2.8)
jmespath (1.4.0)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.1.0)
json-ld (2.2.1)
multi_json (~> 1.12)
rdf (>= 2.2.8, < 4.0)
jsonapi-renderer (0.2.0)
jwt (2.1.0)
jwt (1.5.6)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
Expand All @@ -305,12 +315,20 @@ GEM
kaminari-core (1.1.1)
launchy (2.4.3)
addressable (~> 2.3)
less (2.6.0)
commonjs (~> 0.2.7)
less-rails (2.8.0)
actionpack (>= 4.0)
less (~> 2.6.0)
sprockets (> 2, < 4)
tilt
letter_opener (1.6.0)
launchy (~> 2.2)
letter_opener_web (1.3.4)
actionmailer (>= 3.2)
letter_opener (~> 1.0)
railties (>= 3.2)
libv8 (3.16.14.19)
link_header (0.0.8)
lograge (0.10.0)
actionpack (>= 4)
Expand Down Expand Up @@ -340,6 +358,7 @@ GEM
minitest (5.11.3)
msgpack (1.2.4)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
necromancer (0.4.0)
net-ldap (0.16.1)
Expand All @@ -356,6 +375,12 @@ GEM
concurrent-ruby (~> 1.0.0)
sidekiq (>= 3.5.0)
statsd-ruby (~> 1.2.0)
oauth2 (1.4.0)
faraday (>= 0.8, < 0.13)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.5.1)
omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0)
Expand All @@ -364,6 +389,14 @@ GEM
addressable (~> 2.3)
nokogiri (~> 1.5)
omniauth (~> 1.2)
omniauth-facebook (4.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-github (1.3.0)
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-oauth2 (1.5.0)
oauth2 (~> 1.1)
omniauth (~> 1.2)
omniauth-saml (1.10.0)
omniauth (~> 1.3, >= 1.3.2)
ruby-saml (~> 1.7)
Expand Down Expand Up @@ -468,6 +501,14 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.3.3)
rdf (>= 2.2, < 4.0)
react-rails (2.4.6)
babel-transpiler (>= 0.7.0)
connection_pool
execjs
railties (>= 3.2)
tilt
react-rails-img (0.1.6)
react-rails
redis (4.0.1)
redis-actionpack (5.0.2)
actionpack (>= 4.0, < 6)
Expand All @@ -487,6 +528,7 @@ GEM
redis-store (>= 1.2, < 2)
redis-store (1.5.0)
redis (>= 2.2, < 5)
ref (2.0.0)
request_store (1.4.1)
rack (>= 1.4)
responders (2.4.0)
Expand Down Expand Up @@ -523,6 +565,8 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-bbcode (2.0.2)
activesupport (>= 3.2.3)
ruby-progressbar (1.9.0)
ruby-saml (1.7.2)
nokogiri (>= 1.5.10)
Expand Down Expand Up @@ -589,6 +633,9 @@ GEM
unicode-display_width (~> 1.1, >= 1.1.1)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.20.0)
thread (0.2.2)
thread_safe (0.3.6)
Expand All @@ -610,6 +657,11 @@ GEM
tty-screen (~> 0.6.4)
wisper (~> 2.0.0)
tty-screen (0.6.4)
twitter-bootstrap-rails (4.0.0)
actionpack (~> 5.0, >= 5.0.1)
execjs (~> 2.7)
less-rails (~> 2.8, >= 2.8.0)
railties (~> 5.0, >= 5.0.1)
twitter-text (1.14.7)
unf (~> 0.1.0)
tzinfo (1.2.5)
Expand All @@ -631,9 +683,9 @@ GEM
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
webpush (0.3.3)
webpush (0.3.2)
hkdf (~> 0.2)
jwt (~> 2.0)
jwt
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand Down Expand Up @@ -691,6 +743,8 @@ DEPENDENCIES
i18n-tasks (~> 0.9)
idn-ruby
iso-639
jquery-rails
json
json-ld (~> 2.2)
kaminari (~> 1.1)
letter_opener (~> 1.4)
Expand All @@ -707,6 +761,8 @@ DEPENDENCIES
oj (~> 3.5)
omniauth (~> 1.2)
omniauth-cas (~> 1.1)
omniauth-facebook (~> 4.0.0)
omniauth-github (~> 1.3.0)
omniauth-saml (~> 1.10)
ostatus2 (~> 2.0)
ox (~> 2.9)
Expand All @@ -730,13 +786,15 @@ DEPENDENCIES
rails-i18n (~> 5.1)
rails-settings-cached (~> 0.6)
rdf-normalize (~> 0.3)
react-rails-img
redis (~> 4.0)
redis-namespace (~> 1.5)
redis-rails (~> 5.0)
rqrcode (~> 0.10)
rspec-rails (~> 3.7)
rspec-sidekiq (~> 3.0)
rubocop (~> 0.55)
ruby-bbcode
ruby-progressbar (~> 1.4)
sanitize (~> 4.6)
scss_lint (~> 0.57)
Expand All @@ -752,8 +810,10 @@ DEPENDENCIES
stoplight (~> 2.1.3)
streamio-ffmpeg (~> 3.0)
strong_migrations (~> 0.2)
therubyracer
tty-command (~> 0.8)
tty-prompt (~> 0.16)
twitter-bootstrap-rails
twitter-text (~> 1.14)
tzinfo-data (~> 1.2018)
webmock (~> 3.3)
Expand All @@ -764,4 +824,4 @@ RUBY VERSION
ruby 2.5.0p0

BUNDLED WITH
1.16.2
1.16.3
10 changes: 10 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
4 changes: 4 additions & 0 deletions app/assets/javascripts/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jQuery(function() {
$("a[rel~=popover], .has-popover").popover();
$("a[rel~=tooltip], .has-tooltip").tooltip();
});
7 changes: 7 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/
6 changes: 6 additions & 0 deletions app/assets/stylesheets/bootstrap_and_overrides.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
=require twitter-bootstrap-static/bootstrap

Static version of css will use Glyphicons sprites by default
=require twitter-bootstrap-static/sprites
*/
51 changes: 30 additions & 21 deletions app/controllers/auth/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
# frozen_string_literal: true

class Auth::OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_action :verify_authenticity_token
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.from_omniauth(request.env["omniauth.auth"])

def self.provides_callback_for(provider)
provider_id = provider.to_s.chomp '_oauth2'

define_method provider do
@user = User.find_for_oauth(request.env['omniauth.auth'], current_user)
if @user.errors.any?
reason = @user.errors.full_messages.join(' / ')
set_flash_message(:alert, :failure, kind: "Facebook", reason: reason)
redirect_to new_user_session_path and return
end

if @user.persisted?
sign_in_and_redirect @user, event: :authentication
set_flash_message(:notice, :success, kind: provider_id.capitalize) if is_navigational_format?
else
session["devise.#{provider}_data"] = request.env['omniauth.auth']
redirect_to new_user_registration_url
end
if @user.present?
p "Login Success"
sign_in @user
redirect_to root_path
set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to root_path
end
end

Devise.omniauth_configs.each_key do |provider|
provides_callback_for provider
end
def github
@user = User.from_omniauth(request.env["omniauth.auth"])

def after_sign_in_path_for(resource)
if resource.email_verified?
root_path
else
finish_signup_path
if @user.present?
sign_in @user
set_flash_message(:notice, :success, :kind => "GitHub") if is_navigational_format?
redirect_to root_path and return
end

failure_reason = if @user.errors.any? @user.errors.full_messages.join(' / '); else nil end
set_flash_message(:notice, :failure, kind: "GitHub", reason: failure_reason)
redirect_to new_user_session_path
end

def failure
redirect_to root_path
end
end
Loading