Commit 50529cbc authored by Yamagishi Kazutoshi's avatar Yamagishi Kazutoshi Committed by Eugen Rochko

Upgrade Rails to version 5.2.0 (#5898)

parent 8e88a183
...@@ -5,12 +5,12 @@ ruby '>= 2.3.0', '< 2.6.0' ...@@ -5,12 +5,12 @@ ruby '>= 2.3.0', '< 2.6.0'
gem 'pkg-config', '~> 1.2' gem 'pkg-config', '~> 1.2'
gem 'puma', '~> 3.10' gem 'puma', '~> 3.11'
gem 'rails', '~> 5.1.4' gem 'rails', '~> 5.2.0'
gem 'hamlit-rails', '~> 0.2' gem 'hamlit-rails', '~> 0.2'
gem 'pg', '~> 0.20' gem 'pg', '~> 1.0'
gem 'pghero', '~> 1.7' gem 'pghero', '~> 2.1'
gem 'dotenv-rails', '~> 2.2' gem 'dotenv-rails', '~> 2.2'
gem 'aws-sdk-s3', '~> 1.8', require: false gem 'aws-sdk-s3', '~> 1.8', require: false
...@@ -23,14 +23,14 @@ gem 'streamio-ffmpeg', '~> 3.0' ...@@ -23,14 +23,14 @@ gem 'streamio-ffmpeg', '~> 3.0'
gem 'active_model_serializers', '~> 0.10' gem 'active_model_serializers', '~> 0.10'
gem 'addressable', '~> 2.5' gem 'addressable', '~> 2.5'
gem 'bootsnap' gem 'bootsnap', '~> 1.3'
gem 'browser' gem 'browser'
gem 'charlock_holmes', '~> 0.7.6' gem 'charlock_holmes', '~> 0.7.6'
gem 'iso-639' gem 'iso-639'
gem 'chewy', '~> 5.0' gem 'chewy', '~> 5.0'
gem 'cld3', '~> 3.2.0' gem 'cld3', '~> 3.2.0'
gem 'devise', '~> 4.4' gem 'devise', '~> 4.4'
gem 'devise-two-factor', '~> 3.0' gem 'devise-two-factor', '~> 3.0', git: 'https://github.com/ykzts/devise-two-factor.git', branch: 'rails-5.2'
group :pam_authentication, optional: true do group :pam_authentication, optional: true do
gem 'devise_pam_authenticatable2', '~> 9.1' gem 'devise_pam_authenticatable2', '~> 9.1'
...@@ -41,7 +41,7 @@ gem 'omniauth-cas', '~> 1.1' ...@@ -41,7 +41,7 @@ gem 'omniauth-cas', '~> 1.1'
gem 'omniauth-saml', '~> 1.10' gem 'omniauth-saml', '~> 1.10'
gem 'omniauth', '~> 1.2' gem 'omniauth', '~> 1.2'
gem 'doorkeeper', '~> 4.2' gem 'doorkeeper', '~> 4.3'
gem 'fast_blank', '~> 1.0' gem 'fast_blank', '~> 1.0'
gem 'fastimage' gem 'fastimage'
gem 'goldfinger', '~> 2.1' gem 'goldfinger', '~> 2.1'
...@@ -50,50 +50,50 @@ gem 'redis-namespace', '~> 1.5' ...@@ -50,50 +50,50 @@ gem 'redis-namespace', '~> 1.5'
gem 'htmlentities', '~> 4.3' gem 'htmlentities', '~> 4.3'
gem 'http', '~> 3.0' gem 'http', '~> 3.0'
gem 'http_accept_language', '~> 2.1' gem 'http_accept_language', '~> 2.1'
gem 'httplog', '~> 0.99' gem 'httplog', '~> 1.0'
gem 'idn-ruby', require: 'idn' gem 'idn-ruby', require: 'idn'
gem 'kaminari', '~> 1.1' gem 'kaminari', '~> 1.1'
gem 'link_header', '~> 0.0' gem 'link_header', '~> 0.0'
gem 'mime-types', '~> 3.1' gem 'mime-types', '~> 3.1'
gem 'nokogiri', '~> 1.8' gem 'nokogiri', '~> 1.8'
gem 'nsa', '~> 0.2' gem 'nsa', '~> 0.2'
gem 'oj', '~> 3.3' gem 'oj', '~> 3.4'
gem 'ostatus2', '~> 2.0' gem 'ostatus2', '~> 2.0'
gem 'ox', '~> 2.8' gem 'ox', '~> 2.8'
gem 'pundit', '~> 1.1' gem 'pundit', '~> 1.1'
gem 'premailer-rails' gem 'premailer-rails'
gem 'rack-attack', '~> 5.0' gem 'rack-attack', '~> 5.2'
gem 'rack-cors', '~> 0.4', require: 'rack/cors' gem 'rack-cors', '~> 1.0', require: 'rack/cors'
gem 'rack-timeout', '~> 0.4' gem 'rack-timeout', '~> 0.4'
gem 'rails-i18n', '~> 5.0' gem 'rails-i18n', '~> 5.1'
gem 'rails-settings-cached', '~> 0.6' gem 'rails-settings-cached', '~> 0.6'
gem 'redis', '~> 3.3', require: ['redis', 'redis/connection/hiredis'] gem 'redis', '~> 4.0', require: ['redis', 'redis/connection/hiredis']
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock' gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
gem 'rqrcode', '~> 0.10' gem 'rqrcode', '~> 0.10'
gem 'ruby-oembed', '~> 0.12', require: 'oembed' gem 'ruby-oembed', '~> 0.12', require: 'oembed'
gem 'ruby-progressbar', '~> 1.4' gem 'ruby-progressbar', '~> 1.4'
gem 'sanitize', '~> 4.6.4' gem 'sanitize', '~> 4.6'
gem 'sidekiq', '~> 5.0' gem 'sidekiq', '~> 5.1'
gem 'sidekiq-scheduler', '~> 2.1' gem 'sidekiq-scheduler', '~> 2.2'
gem 'sidekiq-unique-jobs', '~> 5.0' gem 'sidekiq-unique-jobs', '~> 5.0'
gem 'sidekiq-bulk', '~>0.1.1' gem 'sidekiq-bulk', '~>0.1.1'
gem 'simple-navigation', '~> 4.0' gem 'simple-navigation', '~> 4.0'
gem 'simple_form', '~> 3.4' gem 'simple_form', '~> 4.0'
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie' gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
gem 'stoplight', '~> 2.1.3' gem 'stoplight', '~> 2.1.3'
gem 'strong_migrations' gem 'strong_migrations', '~> 0.2'
gem 'tty-command' gem 'tty-command'
gem 'tty-prompt' gem 'tty-prompt'
gem 'twitter-text', '~> 1.14' gem 'twitter-text', '~> 1.14'
gem 'tzinfo-data', '~> 1.2017' gem 'tzinfo-data', '~> 1.2018'
gem 'webpacker', '~> 3.0' gem 'webpacker', '~> 3.4'
gem 'webpush' gem 'webpush'
gem 'json-ld-preloaded', '~> 2.2.1' gem 'json-ld-preloaded', '~> 2.2'
gem 'rdf-normalize', '~> 0.3.1' gem 'rdf-normalize', '~> 0.3'
group :development, :test do group :development, :test do
gem 'fabrication', '~> 2.18' gem 'fabrication', '~> 2.20'
gem 'fuubar', '~> 2.2' gem 'fuubar', '~> 2.2'
gem 'i18n-tasks', '~> 0.9', require: false gem 'i18n-tasks', '~> 0.9', require: false
gem 'pry-rails', '~> 0.3' gem 'pry-rails', '~> 0.3'
...@@ -105,15 +105,15 @@ group :production, :test do ...@@ -105,15 +105,15 @@ group :production, :test do
end end
group :test do group :test do
gem 'capybara', '~> 2.15' gem 'capybara', '~> 2.18'
gem 'climate_control', '~> 0.2' gem 'climate_control', '~> 0.2'
gem 'faker', '~> 1.7' gem 'faker', '~> 1.8'
gem 'microformats', '~> 4.0' gem 'microformats', '~> 4.0'
gem 'rails-controller-testing', '~> 1.0' gem 'rails-controller-testing', '~> 1.0'
gem 'rspec-sidekiq', '~> 3.0' gem 'rspec-sidekiq', '~> 3.0'
gem 'simplecov', '~> 0.14', require: false gem 'simplecov', '~> 0.14', require: false
gem 'webmock', '~> 3.0' gem 'webmock', '~> 3.3'
gem 'parallel_tests', '~> 2.17' gem 'parallel_tests', '~> 2.21'
end end
group :development do group :development do
...@@ -121,12 +121,12 @@ group :development do ...@@ -121,12 +121,12 @@ group :development do
gem 'annotate', '~> 2.7' gem 'annotate', '~> 2.7'
gem 'better_errors', '~> 2.4' gem 'better_errors', '~> 2.4'
gem 'binding_of_caller', '~> 0.7' gem 'binding_of_caller', '~> 0.7'
gem 'bullet', '~> 5.5' gem 'bullet', '~> 5.7'
gem 'letter_opener', '~> 1.4' gem 'letter_opener', '~> 1.4'
gem 'letter_opener_web', '~> 1.3' gem 'letter_opener_web', '~> 1.3'
gem 'memory_profiler' gem 'memory_profiler'
gem 'rubocop', require: false gem 'rubocop', require: false
gem 'brakeman', '~> 4.0', require: false gem 'brakeman', '~> 4.2', require: false
gem 'bundler-audit', '~> 0.6', require: false gem 'bundler-audit', '~> 0.6', require: false
gem 'scss_lint', '~> 0.55', require: false gem 'scss_lint', '~> 0.55', require: false
...@@ -137,6 +137,6 @@ group :development do ...@@ -137,6 +137,6 @@ group :development do
end end
group :production do group :production do
gem 'lograge', '~> 0.7' gem 'lograge', '~> 0.9'
gem 'redis-rails', '~> 5.0' gem 'redis-rails', '~> 5.0'
end end
This diff is collapsed.
...@@ -7,9 +7,6 @@ class Api::Web::PushSubscriptionsController < Api::BaseController ...@@ -7,9 +7,6 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
protect_from_forgery with: :exception protect_from_forgery with: :exception
def create def create
params.require(:subscription).require(:endpoint)
params.require(:subscription).require(:keys).require([:auth, :p256dh])
active_session = current_session active_session = current_session
unless active_session.web_push_subscription.nil? unless active_session.web_push_subscription.nil?
...@@ -29,12 +26,12 @@ class Api::Web::PushSubscriptionsController < Api::BaseController ...@@ -29,12 +26,12 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
}, },
} }
data.deep_merge!(params[:data]) if params[:data] data.deep_merge!(data_params) if params[:data]
web_subscription = ::Web::PushSubscription.create!( web_subscription = ::Web::PushSubscription.create!(
endpoint: params[:subscription][:endpoint], endpoint: subscription_params[:endpoint],
key_p256dh: params[:subscription][:keys][:p256dh], key_p256dh: subscription_params[:keys][:p256dh],
key_auth: params[:subscription][:keys][:auth], key_auth: subscription_params[:keys][:auth],
data: data data: data
) )
...@@ -44,12 +41,22 @@ class Api::Web::PushSubscriptionsController < Api::BaseController ...@@ -44,12 +41,22 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
end end
def update def update
params.require([:id, :data]) params.require([:id])
web_subscription = ::Web::PushSubscription.find(params[:id]) web_subscription = ::Web::PushSubscription.find(params[:id])
web_subscription.update!(data: params[:data]) web_subscription.update!(data: data_params)
render json: web_subscription.as_payload render json: web_subscription.as_payload
end end
private
def subscription_params
@subscription_params ||= params.require(:subscription).permit(:endpoint, keys: [:auth, :p256dh])
end
def data_params
@data_params ||= params.require(:data).permit(:alerts)
end
end end
...@@ -9,7 +9,7 @@ class Settings::FollowerDomainsController < ApplicationController ...@@ -9,7 +9,7 @@ class Settings::FollowerDomainsController < ApplicationController
def show def show
@account = current_account @account = current_account
@domains = current_account.followers.reorder('MIN(follows.id) DESC').group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10) @domains = current_account.followers.reorder(Arel.sql('MIN(follows.id) DESC')).group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
end end
def update def update
......
...@@ -244,11 +244,11 @@ class Account < ApplicationRecord ...@@ -244,11 +244,11 @@ class Account < ApplicationRecord
end end
def domains def domains
reorder(nil).pluck('distinct accounts.domain') reorder(nil).pluck(Arel.sql('distinct accounts.domain'))
end end
def inboxes def inboxes
urls = reorder(nil).where(protocol: :activitypub).pluck("distinct coalesce(nullif(accounts.shared_inbox_url, ''), accounts.inbox_url)") urls = reorder(nil).where(protocol: :activitypub).pluck(Arel.sql("distinct coalesce(nullif(accounts.shared_inbox_url, ''), accounts.inbox_url)"))
DeliveryFailureTracker.filter(urls) DeliveryFailureTracker.filter(urls)
end end
......
...@@ -81,8 +81,6 @@ class Notification < ApplicationRecord ...@@ -81,8 +81,6 @@ class Notification < ApplicationRecord
end end
end end
private
def activity_types_from_types(types) def activity_types_from_types(types)
types.map { |type| TYPE_CLASS_MAP[type.to_sym] }.compact types.map { |type| TYPE_CLASS_MAP[type.to_sym] }.compact
end end
......
...@@ -322,7 +322,7 @@ class Status < ApplicationRecord ...@@ -322,7 +322,7 @@ class Status < ApplicationRecord
self.in_reply_to_account_id = carried_over_reply_to_account_id self.in_reply_to_account_id = carried_over_reply_to_account_id
self.conversation_id = thread.conversation_id if conversation_id.nil? self.conversation_id = thread.conversation_id if conversation_id.nil?
elsif conversation_id.nil? elsif conversation_id.nil?
create_conversation self.conversation = Conversation.new
end end
end end
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle') load Gem.bin_path('bundler', 'bundle')
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname'
require 'fileutils' require 'fileutils'
include FileUtils include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = File.expand_path('..', __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname'
require 'fileutils' require 'fileutils'
include FileUtils include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = File.expand_path('..', __dir__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
...@@ -18,6 +17,9 @@ chdir APP_ROOT do ...@@ -18,6 +17,9 @@ chdir APP_ROOT do
system! 'gem install bundler --conservative' system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install') system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
system('bin/yarn')
puts "\n== Updating database ==" puts "\n== Updating database =="
system! 'bin/rails db:migrate' system! 'bin/rails db:migrate'
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
# ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
# This file was generated by Bundler. ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development"
#
# The application 'webpack' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname" require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
...@@ -14,4 +10,6 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", ...@@ -14,4 +10,6 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
require "rubygems" require "rubygems"
require "bundler/setup" require "bundler/setup"
load Gem.bin_path("webpacker", "webpack") require "webpacker"
require "webpacker/webpack_runner"
Webpacker::WebpackRunner.run(ARGV)
#!/usr/bin/env ruby #!/usr/bin/env ruby
# frozen_string_literal: true
# ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
# This file was generated by Bundler. ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development"
#
# The application 'webpack-dev-server' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname" require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
...@@ -14,4 +10,6 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", ...@@ -14,4 +10,6 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
require "rubygems" require "rubygems"
require "bundler/setup" require "bundler/setup"
load Gem.bin_path("webpacker", "webpack-dev-server") require "webpacker"
require "webpacker/dev_server_runner"
Webpacker::DevServerRunner.run(ARGV)
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec "yarnpkg #{ARGV.join(' ')}" unless Dir.exist?('node_modules')
rescue Errno::ENOENT
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end
...@@ -23,7 +23,7 @@ require_relative '../lib/mastodon/redis_config' ...@@ -23,7 +23,7 @@ require_relative '../lib/mastodon/redis_config'
module Mastodon module Mastodon
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1 config.load_defaults 5.2
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
...@@ -85,15 +85,6 @@ module Mastodon ...@@ -85,15 +85,6 @@ module Mastodon
config.active_job.queue_adapter = :sidekiq config.active_job.queue_adapter = :sidekiq
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/@:username', headers: :any, methods: [:get], credentials: false
resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :patch, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
resource '/oauth/token', headers: :any, methods: [:post], credentials: false
end
end
config.middleware.use Rack::Attack config.middleware.use Rack::Attack
config.middleware.use Rack::Deflater config.middleware.use Rack::Deflater
......
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap' require 'bootsnap' # Speed up boot time by caching expensive operations.
Bootsnap.setup( Bootsnap.setup(
cache_dir: 'tmp/cache', cache_dir: 'tmp/cache',
......
# frozen_string_literal: true # frozen_string_literal: true
lock '3.10.0' lock '3.10.1'
set :repo_url, ENV.fetch('REPO', 'https://github.com/tootsuite/mastodon.git') set :repo_url, ENV.fetch('REPO', 'https://github.com/tootsuite/mastodon.git')
set :branch, ENV.fetch('BRANCH', 'master') set :branch, ENV.fetch('BRANCH', 'master')
......
...@@ -13,13 +13,14 @@ Rails.application.configure do ...@@ -13,13 +13,14 @@ Rails.application.configure do
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp/caching-dev.txt').exist? if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.cache_store = :redis_store, ENV['REDIS_URL'], REDIS_CACHE_PARAMS config.cache_store = :redis_store, ENV['REDIS_URL'], REDIS_CACHE_PARAMS
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}", 'Cache-Control' => "public, max-age=#{2.days.to_i}",
} }
else else
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
......
...@@ -15,6 +15,10 @@ Rails.application.configure do ...@@ -15,6 +15,10 @@ Rails.application.configure do
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.action_controller.asset_host = ENV['CDN_HOST'] if ENV.key?('CDN_HOST') config.action_controller.asset_host = ENV['CDN_HOST'] if ENV.key?('CDN_HOST')
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since # Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this. # Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
......
...@@ -15,7 +15,7 @@ Rails.application.configure do ...@@ -15,7 +15,7 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
} }
config.assets.digest = false config.assets.digest = false
......
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |p|
# p.default_src :self, :https
# p.font_src :self, :https, :data
# p.img_src :self, :https, :data
# p.object_src :none
# p.script_src :self, :https
# p.style_src :self, :https, :unsafe_inline
#
# # Specify URI for violation reports
# # p.report_uri "/csp-violation-report-endpoint"
# end
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/@:username',
headers: :any,
methods: [:get],
credentials: false
resource '/api/*',
headers: :any,
methods: [:post, :put, :delete, :get, :patch, :options],
credentials: false,
expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
resource '/oauth/token',
headers: :any,
methods: [:post],
credentials: false
end
end
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180402040909) do ActiveRecord::Schema.define(version: 2018_04_02_040909) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql" enable_extension "plpgsql"
create_table "account_domain_blocks", force: :cascade do |t| create_table "account_domain_blocks", force: :cascade do |t|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment