[Rails] Update to 7 and run app:update

This commit is contained in:
Earlopain 2022-10-10 13:22:35 +02:00
parent e3575a6efe
commit fbc06182cc
No known key found for this signature in database
GPG Key ID: 237AA8F8D0D0577F
16 changed files with 352 additions and 284 deletions

View File

@ -2,7 +2,7 @@ source 'https://rubygems.org/'
gem 'dotenv-rails', require: 'dotenv/rails-now' gem 'dotenv-rails', require: 'dotenv/rails-now'
gem "rails", "~> 6.1" gem "rails", "~> 7.0"
gem "pg" gem "pg"
gem "dalli", :platforms => :ruby gem "dalli", :platforms => :ruby
gem "simple_form" gem "simple_form"
@ -37,9 +37,6 @@ gem 'elasticsearch-rails'
gem 'mailgun-ruby' gem 'mailgun-ruby'
gem 'resolv' gem 'resolv'
gem 'net-smtp'
gem 'net-pop'
gem 'net-imap'
group :production, :staging do group :production, :staging do
gem 'unicorn', :platforms => :ruby gem 'unicorn', :platforms => :ruby

View File

@ -9,79 +9,85 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.1.6.1) actioncable (7.0.4)
actionpack (= 6.1.6.1) actionpack (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.6.1) actionmailbox (7.0.4)
actionpack (= 6.1.6.1) actionpack (= 7.0.4)
activejob (= 6.1.6.1) activejob (= 7.0.4)
activerecord (= 6.1.6.1) activerecord (= 7.0.4)
activestorage (= 6.1.6.1) activestorage (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.6.1) net-imap
actionpack (= 6.1.6.1) net-pop
actionview (= 6.1.6.1) net-smtp
activejob (= 6.1.6.1) actionmailer (7.0.4)
activesupport (= 6.1.6.1) actionpack (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activesupport (= 7.0.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.6.1) actionpack (7.0.4)
actionview (= 6.1.6.1) actionview (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.6.1) actiontext (7.0.4)
actionpack (= 6.1.6.1) actionpack (= 7.0.4)
activerecord (= 6.1.6.1) activerecord (= 7.0.4)
activestorage (= 6.1.6.1) activestorage (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.6.1) actionview (7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.12) active_model_serializers (0.10.13)
actionpack (>= 4.1, < 6.2) actionpack (>= 4.1, < 7.1)
activemodel (>= 4.1, < 6.2) activemodel (>= 4.1, < 7.1)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (6.1.6.1) activejob (7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.6.1) activemodel (7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
activemodel-serializers-xml (1.0.2) activemodel-serializers-xml (1.0.2)
activemodel (> 5.x) activemodel (> 5.x)
activesupport (> 5.x) activesupport (> 5.x)
builder (~> 3.1) builder (~> 3.1)
activerecord (6.1.6.1) activerecord (7.0.4)
activemodel (= 6.1.6.1) activemodel (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
activestorage (6.1.6.1) activestorage (7.0.4)
actionpack (= 6.1.6.1) actionpack (= 7.0.4)
activejob (= 6.1.6.1) activejob (= 7.0.4)
activerecord (= 6.1.6.1) activerecord (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
marcel (~> 1.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (6.1.6.1) activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
zeitwerk (~> 2.3) addressable (2.8.1)
addressable (2.8.0) public_suffix (>= 2.0.2, < 6.0)
public_suffix (>= 2.0.2, < 5.0) bcrypt (3.1.18)
bcrypt (3.1.16) bootsnap (1.13.0)
bootsnap (1.9.3) msgpack (~> 1.2)
msgpack (~> 1.0)
brpoplpush-redis_script (0.1.2) brpoplpush-redis_script (0.1.2)
concurrent-ruby (~> 1.0, >= 1.0.5) concurrent-ruby (~> 1.0, >= 1.0.5)
redis (>= 1.0, <= 5.0) redis (>= 1.0, <= 5.0)
@ -93,18 +99,17 @@ GEM
cityhash (0.9.0) cityhash (0.9.0)
coderay (1.1.3) coderay (1.1.3)
concurrent-ruby (1.1.10) concurrent-ruby (1.1.10)
connection_pool (2.2.5) connection_pool (2.3.0)
crack (0.4.5) crack (0.4.5)
rexml rexml
crass (1.0.6) crass (1.0.6)
dalli (3.1.5) dalli (3.2.2)
diff-lcs (1.5.0) diff-lcs (1.5.0)
digest (3.1.0)
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6) dotenv (2.8.1)
dotenv-rails (2.7.6) dotenv-rails (2.8.1)
dotenv (= 2.7.6) dotenv (= 2.8.1)
railties (>= 3.2) railties (>= 3.2)
draper (4.0.2) draper (4.0.2)
actionpack (>= 5.0) actionpack (>= 5.0)
@ -113,44 +118,48 @@ GEM
activesupport (>= 5.0) activesupport (>= 5.0)
request_store (>= 1.0) request_store (>= 1.0)
ruby2_keywords ruby2_keywords
elasticsearch (7.16.1) elasticsearch (7.17.1)
elasticsearch-api (= 7.16.1) elasticsearch-api (= 7.17.1)
elasticsearch-transport (= 7.16.1) elasticsearch-transport (= 7.17.1)
elasticsearch-api (7.16.1) elasticsearch-api (7.17.1)
multi_json multi_json
elasticsearch-model (7.2.0) elasticsearch-model (7.2.1)
activesupport (> 3) activesupport (> 3)
elasticsearch (~> 7) elasticsearch (~> 7)
hashie hashie
elasticsearch-rails (7.2.0) elasticsearch-rails (7.2.1)
elasticsearch-transport (7.16.1) elasticsearch-transport (7.17.1)
faraday (~> 1) faraday (~> 1)
multi_json multi_json
erubi (1.10.0) erubi (1.11.0)
factory_bot (6.2.0) factory_bot (6.2.1)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
faraday (1.8.0) faraday (1.10.2)
faraday-em_http (~> 1.0) faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0) faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1) faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1) faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0) faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1) faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0) faraday-patron (~> 1.0)
faraday-rack (~> 1.0) faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3) faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4) ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0) faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0) faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0) faraday-excon (1.1.0)
faraday-httpclient (1.0.1) faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1) faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0) faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0) faraday-patron (1.0.0)
faraday-rack (1.0.0) faraday-rack (1.0.0)
ffaker (2.20.0) faraday-retry (1.0.3)
ffi (1.15.4) ffaker (2.21.0)
ffi (1.15.4-x64-mingw32) ffi (1.15.5)
ffi (1.15.5-x64-mingw32)
get_process_mem (0.2.7) get_process_mem (0.2.7)
ffi (~> 1.0) ffi (~> 1.0)
globalid (1.0.0) globalid (1.0.0)
@ -158,20 +167,20 @@ GEM
hashdiff (1.0.1) hashdiff (1.0.1)
hashie (5.0.0) hashie (5.0.0)
http-accept (1.7.0) http-accept (1.7.0)
http-cookie (1.0.4) http-cookie (1.0.5)
domain_name (~> 0.5) domain_name (~> 0.5)
httparty (0.20.0) httparty (0.20.0)
mime-types (~> 3.0) mime-types (~> 3.0)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
i18n (1.12.0) i18n (1.12.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
json (2.6.1) json (2.6.2)
jsonapi-renderer (0.2.2) jsonapi-renderer (0.2.2)
kgio (2.11.4) kgio (2.11.4)
listen (3.7.0) listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.18.0) loofah (2.19.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@ -183,89 +192,82 @@ GEM
method_source (1.0.0) method_source (1.0.0)
mime-types (3.4.1) mime-types (3.4.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2021.1115) mime-types-data (3.2022.0105)
mini_mime (1.1.2) mini_mime (1.1.2)
mini_portile2 (2.8.0) mini_portile2 (2.8.0)
minitest (5.16.2) minitest (5.16.3)
mocha (1.13.0) mocha (1.15.0)
mock_redis (0.29.0) mock_redis (0.34.0)
ruby2_keywords ruby2_keywords
msgpack (1.4.2) msgpack (1.6.0)
multi_json (1.15.0) multi_json (1.15.0)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.1.1) multipart-post (2.2.3)
net-imap (0.2.3) net-imap (0.3.1)
digest
net-protocol net-protocol
strscan net-pop (0.1.2)
net-pop (0.1.1)
digest
net-protocol net-protocol
timeout
net-protocol (0.1.3) net-protocol (0.1.3)
timeout timeout
net-smtp (0.3.1) net-smtp (0.3.2)
digest
net-protocol net-protocol
timeout
netrc (0.11.0) netrc (0.11.0)
newrelic_rpm (8.2.0) newrelic_rpm (8.10.1)
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.13.8) nokogiri (1.13.8)
mini_portile2 (~> 2.8.0) mini_portile2 (~> 2.8.0)
racc (~> 1.4) racc (~> 1.4)
pg (1.2.3) pg (1.4.3)
pg (1.2.3-x64-mingw32) pry (0.14.1)
pry (0.13.1)
coderay (~> 1.1) coderay (~> 1.1)
method_source (~> 1.0) method_source (~> 1.0)
pry-byebug (3.9.0) pry-byebug (3.10.1)
byebug (~> 11.0) byebug (~> 11.0)
pry (~> 0.13.0) pry (>= 0.13, < 0.15)
public_suffix (4.0.6) public_suffix (5.0.0)
puma (5.6.4) puma (5.6.5)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.6.0) racc (1.6.0)
rack (2.2.4) rack (2.2.4)
rack-proxy (0.7.0) rack-proxy (0.7.4)
rack rack
rack-test (2.0.2) rack-test (2.0.2)
rack (>= 1.3) rack (>= 1.3)
rails (6.1.6.1) rails (7.0.4)
actioncable (= 6.1.6.1) actioncable (= 7.0.4)
actionmailbox (= 6.1.6.1) actionmailbox (= 7.0.4)
actionmailer (= 6.1.6.1) actionmailer (= 7.0.4)
actionpack (= 6.1.6.1) actionpack (= 7.0.4)
actiontext (= 6.1.6.1) actiontext (= 7.0.4)
actionview (= 6.1.6.1) actionview (= 7.0.4)
activejob (= 6.1.6.1) activejob (= 7.0.4)
activemodel (= 6.1.6.1) activemodel (= 7.0.4)
activerecord (= 6.1.6.1) activerecord (= 7.0.4)
activestorage (= 6.1.6.1) activestorage (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.6.1) railties (= 7.0.4)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3) rails-html-sanitizer (1.4.3)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.1.6.1) railties (7.0.4)
actionpack (= 6.1.6.1) actionpack (= 7.0.4)
activesupport (= 6.1.6.1) activesupport (= 7.0.4)
method_source method_source
rake (>= 12.2) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5)
raindrops (0.20.0) raindrops (0.20.0)
rake (13.0.6) rake (13.0.6)
rb-fsevent (0.11.0) rb-fsevent (0.11.2)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
recaptcha (5.8.1) recaptcha (5.12.3)
json json
redis (4.6.0) redis (4.8.0)
request_store (1.5.0) request_store (1.5.1)
rack (>= 1.4) rack (>= 1.4)
resolv (0.2.1) resolv (0.2.1)
responders (3.0.1) responders (3.0.1)
@ -292,13 +294,13 @@ GEM
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
semantic_range (3.0.0) semantic_range (3.0.0)
shoulda-context (2.0.0) shoulda-context (2.0.0)
shoulda-matchers (5.1.0) shoulda-matchers (5.2.0)
activesupport (>= 5.2.0) activesupport (>= 5.2.0)
sidekiq (6.4.1) sidekiq (6.5.7)
connection_pool (>= 2.2.2) connection_pool (>= 2.2.5)
rack (~> 2.0) rack (~> 2.0)
redis (>= 4.2.0) redis (>= 4.5.0, < 5)
sidekiq-unique-jobs (7.1.12) sidekiq-unique-jobs (7.1.27)
brpoplpush-redis_script (> 0.1.1, <= 2.0.0) brpoplpush-redis_script (> 0.1.1, <= 2.0.0)
concurrent-ruby (~> 1.0, >= 1.0.5) concurrent-ruby (~> 1.0, >= 1.0.5)
sidekiq (>= 5.0, < 8.0) sidekiq (>= 5.0, < 8.0)
@ -306,32 +308,23 @@ GEM
simple_form (5.1.0) simple_form (5.1.0)
actionpack (>= 5.2) actionpack (>= 5.2)
activemodel (>= 5.2) activemodel (>= 5.2)
sprockets (4.1.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
streamio-ffmpeg (3.0.2) streamio-ffmpeg (3.0.2)
multi_json (~> 1.8) multi_json (~> 1.8)
strscan (3.0.3)
thor (1.2.1) thor (1.2.1)
timecop (0.9.4) timecop (0.9.5)
timeout (0.2.0) timeout (0.3.0)
tzinfo (2.0.4) tzinfo (2.0.5)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.8) unf_ext (0.0.8.2)
unf_ext (0.0.8-x64-mingw32)
unicorn (6.1.0) unicorn (6.1.0)
kgio (~> 2.6) kgio (~> 2.6)
raindrops (~> 0.7) raindrops (~> 0.7)
unicorn-worker-killer (0.4.5) unicorn-worker-killer (0.4.5)
get_process_mem (~> 0) get_process_mem (~> 0)
unicorn (>= 4, < 7) unicorn (>= 4, < 7)
webmock (3.14.0) webmock (3.18.1)
addressable (>= 2.8.0) addressable (>= 2.8.0)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0) hashdiff (>= 0.4.0, < 2.0.0)
@ -345,7 +338,7 @@ GEM
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
whenever (1.0.0) whenever (1.0.0)
chronic (>= 0.6.3) chronic (>= 0.6.3)
zeitwerk (2.6.0) zeitwerk (2.6.1)
PLATFORMS PLATFORMS
ruby ruby
@ -373,14 +366,11 @@ DEPENDENCIES
memoist memoist
mocha mocha
mock_redis mock_redis
net-imap
net-pop
net-smtp
newrelic_rpm newrelic_rpm
pg pg
pry-byebug pry-byebug
puma puma
rails (~> 6.1) rails (~> 7.0)
recaptcha recaptcha
redis redis
request_store request_store

View File

@ -1,4 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot" require_relative "../config/boot"
require "rails/commands" require "rails/commands"

View File

@ -9,8 +9,8 @@ def system!(*args)
end end
FileUtils.chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically. # This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome. # This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file. # Add necessary setup steps to this file.
puts '== Installing dependencies ==' puts '== Installing dependencies =='

View File

@ -1,29 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'sprockets' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("sprockets", "sprockets")

View File

@ -1,17 +1,21 @@
require_relative 'boot' require_relative "boot"
require "rails"
require "active_record/railtie"
#require "active_storage/engine"
require "action_controller/railtie"
require "action_view/railtie"
require "action_mailer/railtie"
require "active_job/railtie"
#require "action_cable/engine"
#require "action_mailbox/engine"
#require "action_text/engine"
require "rails/test_unit/railtie"
#require "sprockets/railtie"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action_text/engine"
require "action_view/railtie"
# require "action_cable/engine"
require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups) Bundler.require(*Rails.groups)
require_relative "danbooru_default_config" require_relative "danbooru_default_config"
@ -22,16 +26,8 @@ require 'elasticsearch/rails/instrumentation'
module Danbooru module Danbooru
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 '6.1' config.load_defaults 6.1
config.active_record.schema_format = :sql config.active_record.schema_format = :sql
config.encoding = "utf-8"
config.filter_parameters += [:password, :password_hash, :api_key]
#config.assets.enabled = true
#config.assets.version = '1.0'
config.autoload_paths += %W(#{config.root}/app/presenters #{config.root}/app/logical #{config.root}/app/mailers #{config.root}/app/indexes)
config.plugins = [:all]
config.time_zone = 'UTC'
config.action_mailer.perform_deliveries = true
config.log_tags = [->(req) {"PID:#{Process.pid}"}] config.log_tags = [->(req) {"PID:#{Process.pid}"}]
config.action_controller.action_on_unpermitted_parameters = :raise config.action_controller.action_on_unpermitted_parameters = :raise
config.force_ssl = true config.force_ssl = true
@ -60,7 +56,15 @@ module Danbooru
host: Danbooru.config.hostname, host: Danbooru.config.hostname,
} }
end end
end
I18n.enforce_available_locales = false config.i18n.enforce_available_locales = false
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
end
end end

View File

@ -1,4 +1,4 @@
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/setup" # Speed up boot time by caching expensive operations. require "bootsnap/setup" # Speed up boot time by caching expensive operations.

View File

@ -1,5 +1,5 @@
# Load the Rails application. # Load the Rails application.
require_relative 'application' require_relative "application"
Dotenv.load(Rails.root + ".env.local") Dotenv.load(Rails.root + ".env.local")

View File

@ -14,10 +14,13 @@ Rails.application.configure do
# Show full error reports. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled. # Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching. # Run rails dev:cache to toggle caching.
# Does not affect the cache_store # Does not affect the cache_store
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.action_controller.enable_fragment_cache_logging = true config.action_controller.enable_fragment_cache_logging = true
@ -55,10 +58,6 @@ Rails.application.configure do
# Annotate rendered view with file names. # Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true # config.action_view.annotate_rendered_view_with_filenames = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Uncomment if you wish to allow Action Cable access from any origin. # Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true # config.action_cable.disable_request_forgery_protection = true

View File

@ -22,14 +22,14 @@ Rails.application.configure do
# 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?
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = 'http://assets.example.com' # config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true # config.force_ssl = true
@ -77,7 +77,7 @@ Rails.application.configure do
# Use a different logger for distributed setups. # Use a different logger for distributed setups.
# require "syslog/logger" # require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
if ENV["RAILS_LOG_TO_STDOUT"].present? if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT) logger = ActiveSupport::Logger.new(STDOUT)
@ -87,25 +87,4 @@ Rails.application.configure do
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end end

View File

@ -8,17 +8,18 @@ require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Eager loading loads your whole application. When running a single test locally,
# just for the purpose of running a single test. If you are using a tool that # this probably isn't necessary. It's a good idea to do in a continuous integration
# preloads Rails for running tests, you may have to set it to true. # system, or in some way before deploying your code.
config.eager_load = false config.eager_load = ENV["CI"].present?
# 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.to_i}" "Cache-Control" => "public, max-age=#{1.hour.to_i}"
} }
# Show full error reports and disable caching. # Show full error reports and disable caching.
@ -52,9 +53,4 @@ Rails.application.configure do
# Annotate rendered view with file names. # Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true # config.action_view.annotate_rendered_view_with_filenames = true
# config.logger = Logger.new(STDOUT)
# config.log_level = :info
end end

View File

@ -1,36 +1,31 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy # Define an application-wide content security policy.
# For further information see the following documentation # See the Securing Rails Applications Guide for more information:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # https://guides.rubyonrails.org/security.html#content-security-policy-header
Rails.application.config.content_security_policy do |policy| Rails.application.configure do
policy.default_src :self config.content_security_policy do |policy|
policy.script_src :self, 'ads.dragonfru.it', 'js-agent.newrelic.com', 'bam.nr-data.net', 'https://www.google.com/recaptcha/', 'https://www.gstatic.com/recaptcha/', 'https://www.recaptcha.net/' policy.default_src :self
policy.style_src :self, :unsafe_inline policy.script_src :self, 'ads.dragonfru.it', 'js-agent.newrelic.com', 'bam.nr-data.net', 'https://www.google.com/recaptcha/', 'https://www.gstatic.com/recaptcha/', 'https://www.recaptcha.net/'
policy.connect_src :self, 'ads.dragonfru.it', 'bam.nr-data.net', 'plausible.dragonfru.it' policy.style_src :self, :unsafe_inline
policy.object_src :self, 'static1.e621.net', 'static1.e926.net' policy.connect_src :self, 'ads.dragonfru.it', 'bam.nr-data.net', 'plausible.dragonfru.it'
policy.media_src :self, 'static1.e621.net', 'static1.e926.net' policy.object_src :self, 'static1.e621.net', 'static1.e926.net'
policy.frame_ancestors :none policy.media_src :self, 'static1.e621.net', 'static1.e926.net'
policy.frame_src 'https://www.google.com/recaptcha/', 'https://www.recaptcha.net/' policy.frame_ancestors :none
policy.font_src :self policy.frame_src 'https://www.google.com/recaptcha/', 'https://www.recaptcha.net/'
policy.img_src :self, :data, 'static1.e621.net', 'static1.e926.net', 'ads.dragonfru.it' policy.font_src :self
policy.child_src :none policy.img_src :self, :data, 'static1.e621.net', 'static1.e926.net', 'ads.dragonfru.it'
policy.form_action :self, 'discord.e621.net', 'discord.com' policy.child_src :none
# # If you are using webpack-dev-server then specify webpack-dev-server host policy.form_action :self, 'discord.e621.net', 'discord.com'
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint"
end
# # Specify URI for violation reports # Generate session nonces for permitted importmap and inline scripts
# policy.report_uri "/csp-violation" config.content_security_policy_nonce_generator = ->(request) { SecureRandom.base64(16) }
end config.content_security_policy_nonce_directives = %w(script-src)
# If you are using UJS then enable automatic nonce generation # Report violations without enforcing the policy.
Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } config.content_security_policy_report_only = false
end
# Set the nonce only to specific directives
Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
# 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 = false

View File

@ -7,9 +7,9 @@
# Rails.application.config.middleware.insert_before 0, Rack::Cors do # Rails.application.config.middleware.insert_before 0, Rack::Cors do
# allow do # allow do
# origins 'example.com' # origins "example.com"
# #
# resource '*', # resource "*",
# headers: :any, # headers: :any,
# methods: [:get, :post, :put, :patch, :delete, :options, :head] # methods: [:get, :post, :put, :patch, :delete, :options, :head]
# end # end

View File

@ -1,6 +1,8 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [ Rails.application.config.filter_parameters += [
:password, :passw, :api_key, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
] ]

View File

@ -4,13 +4,13 @@
# are locale specific, and you may define rules for as many different # are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default: # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular 'person', 'people' # inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
# These inflection rules are supported but not enabled by default: # These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym "RESTful"
# end # end

View File

@ -0,0 +1,135 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `7.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
# `button_to` view helper will render `<button>` element, regardless of whether
# or not the content is passed as the first argument or as a block.
# Rails.application.config.action_view.button_to_generates_button_tag = true
# `stylesheet_link_tag` view helper will not render the media attribute by default.
# Rails.application.config.action_view.apply_stylesheet_media_default = false
# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
# Changing this default means invalidate all encrypted messages generated by
# your application and, all the encrypted cookies. Only change this after you
# rotated all the messages using the key rotator.
#
# See upgrading guide for more information on how to build a rotator.
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
# Change the digest class for ActiveSupport::Digest.
# Changing this default means that for example Etags change and
# various cache keys leading to cache invalidation.
# Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
# implementation.
# Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
# Calls `Rails.application.executor.wrap` around test cases.
# This makes test cases behave closer to an actual request or job.
# Several features that are normally disabled in test, such as Active Record query cache
# and asynchronous queries will then be enabled.
# Rails.application.config.active_support.executor_around_test_case = true
# Define the isolation level of most of Rails internal state.
# If you use a fiber based server or job processor, you should set it to `:fiber`.
# Otherwise the default of `:thread` if preferable.
# Rails.application.config.active_support.isolation_level = :thread
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
# Rails.application.config.action_mailer.smtp_timeout = 5
# The ActiveStorage video previewer will now use scene change detection to generate
# better preview images (rather than the previous default of using the first frame
# of the video).
# Rails.application.config.active_storage.video_preview_arguments =
# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
# Automatically infer `inverse_of` for associations with a scope.
# Rails.application.config.active_record.automatic_scope_inversing = true
# Raise when running tests if fixtures contained foreign key violations
# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
# Disable partial inserts.
# This default means that all columns will be referenced in INSERT queries
# regardless of whether they have a default or not.
# Rails.application.config.active_record.partial_inserts = false
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
# Rails.application.config.action_controller.raise_on_open_redirects = true
# Change the variant processor for Active Storage.
# Changing this default means updating all places in your code that
# generate variants to use image processing macros and ruby-vips
# operations. See the upgrading guide for detail on the changes required.
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
# Rails.application.config.active_storage.variant_processor = :vips
# Enable parameter wrapping for JSON.
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
# To disable parameter wrapping entirely, set this config to `false`.
# Rails.application.config.action_controller.wrap_parameters_by_default = true
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
#
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
# more information.
# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
# Change the default headers to disable browsers' flawed legacy XSS protection.
# Rails.application.config.action_dispatch.default_headers = {
# "X-Frame-Options" => "SAMEORIGIN",
# "X-XSS-Protection" => "0",
# "X-Content-Type-Options" => "nosniff",
# "X-Download-Options" => "noopen",
# "X-Permitted-Cross-Domain-Policies" => "none",
# "Referrer-Policy" => "strict-origin-when-cross-origin"
# }
# ** Please read carefully, this must be configured in config/application.rb **
# Change the format of the cache entry.
# Changing this default means that all new cache entries added to the cache
# will have a different format that is not supported by Rails 6.1 applications.
# Only change this value after your application is fully deployed to Rails 7.0
# and you have no plans to rollback.
# When you're ready to change format, add this to `config/application.rb` (NOT this file):
# config.active_support.cache_format_version = 7.0
# Cookie serializer: 2 options
#
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
# is `:marshal`. The default for new apps is `:json`.
#
# Rails.application.config.action_dispatch.cookies_serializer = :json
#
#
# To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
#
# Rails transparently deserializes existing (Marshal-serialized) cookies on read and
# re-writes them in the JSON format.
#
# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
# initializer or to `config/application.rb`.
#
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
#
#
# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
#
# If you have configured the serializer elsewhere, you can remove this section of the file.
#
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.