mirror of
https://github.com/moebooru/moebooru
synced 2025-08-30 13:37:48 +00:00
Update to rails 7.1
This commit is contained in:
parent
d03e129e04
commit
20db9f876c
5
Gemfile
5
Gemfile
@ -1,10 +1,9 @@
|
|||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem "rails", "~> 7.0.1"
|
gem "rails", "~> 7.1.2"
|
||||||
|
|
||||||
gem "sprockets-rails"
|
gem "sprockets-rails"
|
||||||
# TODO: remove github once 1.2.2 (or later) is released
|
gem 'jsbundling-rails', github: 'rails/jsbundling-rails', tag: 'v1.2.2'
|
||||||
gem 'jsbundling-rails', github: 'rails/jsbundling-rails', branch: 'main'
|
|
||||||
gem "terser"
|
gem "terser"
|
||||||
|
|
||||||
gem "pg"
|
gem "pg"
|
||||||
|
172
Gemfile.lock
172
Gemfile.lock
@ -1,82 +1,92 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: https://github.com/rails/jsbundling-rails.git
|
remote: https://github.com/rails/jsbundling-rails.git
|
||||||
revision: ddebd51a4128654ab3720ecf7f201c621c8cdc22
|
revision: ff78e2b7e1002e6d7ae4cd12f422766db1762a31
|
||||||
branch: main
|
tag: v1.2.2
|
||||||
specs:
|
specs:
|
||||||
jsbundling-rails (1.2.1)
|
jsbundling-rails (1.2.2)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.0.8)
|
actioncable (7.1.2)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (7.0.8)
|
zeitwerk (~> 2.6)
|
||||||
actionpack (= 7.0.8)
|
actionmailbox (7.1.2)
|
||||||
activejob (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
activerecord (= 7.0.8)
|
activejob (= 7.1.2)
|
||||||
activestorage (= 7.0.8)
|
activerecord (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activestorage (= 7.1.2)
|
||||||
|
activesupport (= 7.1.2)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
actionmailer (7.0.8)
|
actionmailer (7.1.2)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
actionview (= 7.0.8)
|
actionview (= 7.1.2)
|
||||||
activejob (= 7.0.8)
|
activejob (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.2)
|
||||||
actionpack (7.0.8)
|
actionpack (7.1.2)
|
||||||
actionview (= 7.0.8)
|
actionview (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
rack (~> 2.0, >= 2.2.4)
|
nokogiri (>= 1.8.5)
|
||||||
|
racc
|
||||||
|
rack (>= 2.2.4)
|
||||||
|
rack-session (>= 1.0.1)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.6)
|
||||||
actiontext (7.0.8)
|
actiontext (7.1.2)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
activerecord (= 7.0.8)
|
activerecord (= 7.1.2)
|
||||||
activestorage (= 7.0.8)
|
activestorage (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.0.8)
|
actionview (7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.11)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.6)
|
||||||
activejob (7.0.8)
|
activejob (7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.0.8)
|
activemodel (7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
activerecord (7.0.8)
|
activerecord (7.1.2)
|
||||||
activemodel (= 7.0.8)
|
activemodel (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
activestorage (7.0.8)
|
timeout (>= 0.4.0)
|
||||||
actionpack (= 7.0.8)
|
activestorage (7.1.2)
|
||||||
activejob (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
activerecord (= 7.0.8)
|
activejob (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activerecord (= 7.1.2)
|
||||||
|
activesupport (= 7.1.2)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
mini_mime (>= 1.1.0)
|
activesupport (7.1.2)
|
||||||
activesupport (7.0.8)
|
base64
|
||||||
|
bigdecimal
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
connection_pool (>= 2.2.5)
|
||||||
|
drb
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
|
mutex_m
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
addressable (2.8.6)
|
addressable (2.8.6)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
base64 (0.2.0)
|
base64 (0.2.0)
|
||||||
|
bigdecimal (3.1.5)
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
coderay (1.1.3)
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.2.2)
|
concurrent-ruby (1.2.2)
|
||||||
@ -86,6 +96,8 @@ GEM
|
|||||||
dalli (3.2.6)
|
dalli (3.2.6)
|
||||||
date (3.3.4)
|
date (3.3.4)
|
||||||
diff-lcs (1.5.0)
|
diff-lcs (1.5.0)
|
||||||
|
drb (2.2.0)
|
||||||
|
ruby2_keywords
|
||||||
erubi (1.12.0)
|
erubi (1.12.0)
|
||||||
exception_notification (4.5.0)
|
exception_notification (4.5.0)
|
||||||
actionmailer (>= 5.2, < 8)
|
actionmailer (>= 5.2, < 8)
|
||||||
@ -97,6 +109,10 @@ GEM
|
|||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
i18n-js (3.0.11)
|
i18n-js (3.0.11)
|
||||||
i18n (>= 0.6.6, < 2)
|
i18n (>= 0.6.6, < 2)
|
||||||
|
io-console (0.7.1)
|
||||||
|
irb (1.11.0)
|
||||||
|
rdoc
|
||||||
|
reline (>= 0.3.8)
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
@ -114,6 +130,7 @@ GEM
|
|||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
mini_portile2 (2.8.5)
|
mini_portile2 (2.8.5)
|
||||||
minitest (5.20.0)
|
minitest (5.20.0)
|
||||||
|
mutex_m (0.2.0)
|
||||||
net-imap (0.4.9.1)
|
net-imap (0.4.9.1)
|
||||||
date
|
date
|
||||||
net-protocol
|
net-protocol
|
||||||
@ -133,29 +150,36 @@ GEM
|
|||||||
pry (0.14.2)
|
pry (0.14.2)
|
||||||
coderay (~> 1.1)
|
coderay (~> 1.1)
|
||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
|
psych (5.1.2)
|
||||||
|
stringio
|
||||||
public_suffix (5.0.4)
|
public_suffix (5.0.4)
|
||||||
puma (6.4.1)
|
puma (6.4.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
racc (1.7.3)
|
racc (1.7.3)
|
||||||
rack (2.2.8)
|
rack (3.0.8)
|
||||||
rack-mini-profiler (3.3.0)
|
rack-mini-profiler (3.3.0)
|
||||||
rack (>= 1.2.0)
|
rack (>= 1.2.0)
|
||||||
|
rack-session (2.0.0)
|
||||||
|
rack (>= 3.0.0)
|
||||||
rack-test (2.1.0)
|
rack-test (2.1.0)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rails (7.0.8)
|
rackup (2.1.0)
|
||||||
actioncable (= 7.0.8)
|
rack (>= 3)
|
||||||
actionmailbox (= 7.0.8)
|
webrick (~> 1.8)
|
||||||
actionmailer (= 7.0.8)
|
rails (7.1.2)
|
||||||
actionpack (= 7.0.8)
|
actioncable (= 7.1.2)
|
||||||
actiontext (= 7.0.8)
|
actionmailbox (= 7.1.2)
|
||||||
actionview (= 7.0.8)
|
actionmailer (= 7.1.2)
|
||||||
activejob (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
activemodel (= 7.0.8)
|
actiontext (= 7.1.2)
|
||||||
activerecord (= 7.0.8)
|
actionview (= 7.1.2)
|
||||||
activestorage (= 7.0.8)
|
activejob (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activemodel (= 7.1.2)
|
||||||
|
activerecord (= 7.1.2)
|
||||||
|
activestorage (= 7.1.2)
|
||||||
|
activesupport (= 7.1.2)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.0.8)
|
railties (= 7.1.2)
|
||||||
rails-controller-testing (1.0.5)
|
rails-controller-testing (1.0.5)
|
||||||
actionpack (>= 5.0.1.rc1)
|
actionpack (>= 5.0.1.rc1)
|
||||||
actionview (>= 5.0.1.rc1)
|
actionview (>= 5.0.1.rc1)
|
||||||
@ -170,14 +194,20 @@ GEM
|
|||||||
rails-i18n (7.0.8)
|
rails-i18n (7.0.8)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
railties (>= 6.0.0, < 8)
|
railties (>= 6.0.0, < 8)
|
||||||
railties (7.0.8)
|
railties (7.1.2)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.2)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.2)
|
||||||
method_source
|
irb
|
||||||
|
rackup (>= 1.0.0)
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0, >= 1.2.2)
|
||||||
zeitwerk (~> 2.5)
|
zeitwerk (~> 2.6)
|
||||||
rake (13.1.0)
|
rake (13.1.0)
|
||||||
|
rdoc (6.6.2)
|
||||||
|
psych (>= 4.0.0)
|
||||||
|
reline (0.4.2)
|
||||||
|
io-console (~> 0.5)
|
||||||
|
ruby2_keywords (0.0.5)
|
||||||
sitemap_generator (6.3.0)
|
sitemap_generator (6.3.0)
|
||||||
builder (~> 3.0)
|
builder (~> 3.0)
|
||||||
sprockets (4.2.1)
|
sprockets (4.2.1)
|
||||||
@ -187,12 +217,14 @@ GEM
|
|||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
activesupport (>= 5.2)
|
activesupport (>= 5.2)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
|
stringio (3.1.0)
|
||||||
terser (1.1.20)
|
terser (1.1.20)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
thor (1.3.0)
|
thor (1.3.0)
|
||||||
timeout (0.4.1)
|
timeout (0.4.1)
|
||||||
tzinfo (2.0.6)
|
tzinfo (2.0.6)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
|
webrick (1.8.1)
|
||||||
websocket-driver (0.7.6)
|
websocket-driver (0.7.6)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
@ -221,7 +253,7 @@ DEPENDENCIES
|
|||||||
pry
|
pry
|
||||||
puma
|
puma
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (~> 7.0.1)
|
rails (~> 7.1.2)
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
rails-i18n
|
rails-i18n
|
||||||
sitemap_generator
|
sitemap_generator
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class NoteController < ApplicationController
|
class NoteController < ApplicationController
|
||||||
layout "default", :only => [:index, :history, :search]
|
layout "default", :only => [:index, :history, :search]
|
||||||
before_action :post_member_only, :only => [:destroy, :update, :revert]
|
before_action :post_member_only, :only => [:update, :revert]
|
||||||
helper :post
|
helper :post
|
||||||
|
|
||||||
def search
|
def search
|
||||||
|
@ -343,39 +343,37 @@ class PoolController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Generate a ZIP control file for nginx, and redirect to the ZIP.
|
# Generate a ZIP control file for nginx, and redirect to the ZIP.
|
||||||
if CONFIG["pool_zips"]
|
def zip
|
||||||
def zip
|
if params[:hash].is_a?(String) && params[:hash] =~ /^\h{32}$/
|
||||||
if params[:hash].is_a?(String) && params[:hash] =~ /^\h{32}$/
|
pool_zip = Rails.cache.read("pool_zip:#{params[:hash]}")
|
||||||
pool_zip = Rails.cache.read("pool_zip:#{params[:hash]}")
|
|
||||||
|
|
||||||
return head(:not_found) if pool_zip.nil?
|
return head(:not_found) if pool_zip.nil?
|
||||||
|
|
||||||
Moebooru::SkipCookie.apply(request)
|
Moebooru::SkipCookie.apply(request)
|
||||||
|
|
||||||
if pool_zip[:data].empty?
|
if pool_zip[:data].empty?
|
||||||
pool_zip[:data] = Moebooru::Zip::EMPTY
|
pool_zip[:data] = Moebooru::Zip::EMPTY
|
||||||
else
|
else
|
||||||
headers['X-Archive-Files'] = 'zip'
|
headers['X-Archive-Files'] = 'zip'
|
||||||
end
|
|
||||||
|
|
||||||
return send_data(pool_zip[:data], type: Mime[:zip], filename: pool_zip[:filename])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
pool = Pool.includes(:pool_posts => :post).find(params[:id])
|
return send_data(pool_zip[:data], type: Mime[:zip], filename: pool_zip[:filename])
|
||||||
|
|
||||||
pool_zip_data = pool.get_zip_data(params).map do |row|
|
|
||||||
"%s %s %s %s\n" % [row[:crc32], row[:file_size], row[:path], row[:filename]]
|
|
||||||
end.join
|
|
||||||
|
|
||||||
hash = Digest::MD5.hexdigest(pool_zip_data)
|
|
||||||
pool_zip = {
|
|
||||||
data: pool_zip_data,
|
|
||||||
filename: pool.get_zip_filename(params),
|
|
||||||
}
|
|
||||||
Rails.cache.write "pool_zip:#{hash}", pool_zip
|
|
||||||
|
|
||||||
redirect_to hash: hash, jpeg: params[:jpeg]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pool = Pool.includes(:pool_posts => :post).find(params[:id])
|
||||||
|
|
||||||
|
pool_zip_data = pool.get_zip_data(params).map do |row|
|
||||||
|
"%s %s %s %s\n" % [row[:crc32], row[:file_size], row[:path], row[:filename]]
|
||||||
|
end.join
|
||||||
|
|
||||||
|
hash = Digest::MD5.hexdigest(pool_zip_data)
|
||||||
|
pool_zip = {
|
||||||
|
data: pool_zip_data,
|
||||||
|
filename: pool.get_zip_filename(params),
|
||||||
|
}
|
||||||
|
Rails.cache.write "pool_zip:#{hash}", pool_zip
|
||||||
|
|
||||||
|
redirect_to hash: hash, jpeg: params[:jpeg]
|
||||||
end
|
end
|
||||||
|
|
||||||
def transfer_metadata
|
def transfer_metadata
|
||||||
|
9
bin/dev
Executable file
9
bin/dev
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if ! command -v foreman &> /dev/null
|
||||||
|
then
|
||||||
|
echo "Installing foreman..."
|
||||||
|
gem install foreman
|
||||||
|
fi
|
||||||
|
|
||||||
|
foreman start -f Procfile.dev
|
@ -5,7 +5,7 @@ require "fileutils"
|
|||||||
APP_ROOT = File.expand_path("..", __dir__)
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*args, exception: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.chdir APP_ROOT do
|
FileUtils.chdir APP_ROOT do
|
||||||
|
@ -12,7 +12,7 @@ Bundler.require(*CONFIG['bundler_groups'])
|
|||||||
|
|
||||||
module Moebooru
|
module Moebooru
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
config.load_defaults 7.0
|
config.load_defaults 7.1
|
||||||
config.active_record.belongs_to_required_by_default = false
|
config.active_record.belongs_to_required_by_default = false
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration can go into files in config/initializers
|
# Application configuration can go into files in config/initializers
|
||||||
|
@ -4,7 +4,7 @@ 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.
|
||||||
|
|
||||||
# Code is not reloaded between requests.
|
# Code is not reloaded between requests.
|
||||||
config.cache_classes = true
|
config.enable_reloading = false
|
||||||
|
|
||||||
# Eager load code on boot. This eager loads most of Rails and
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
# your application in memory, allowing both threaded web servers
|
# your application in memory, allowing both threaded web servers
|
||||||
@ -13,15 +13,14 @@ Rails.application.configure do
|
|||||||
config.eager_load = true
|
config.eager_load = true
|
||||||
|
|
||||||
# Full error reports are disabled and caching is turned on.
|
# Full error reports are disabled and caching is turned on.
|
||||||
config.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
||||||
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
||||||
# config.require_master_key = true
|
# config.require_master_key = true
|
||||||
|
|
||||||
# Disable serving static files from the `/public` folder by default since
|
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
||||||
# 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?
|
||||||
|
|
||||||
# Compress CSS using a preprocessor.
|
# Compress CSS using a preprocessor.
|
||||||
@ -50,21 +49,31 @@ Rails.application.configure do
|
|||||||
# config.action_cable.url = "wss://example.com/cable"
|
# config.action_cable.url = "wss://example.com/cable"
|
||||||
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
||||||
|
|
||||||
|
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
||||||
|
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
||||||
|
# config.assume_ssl = true
|
||||||
|
|
||||||
# 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 = CONFIG["secure"]
|
config.force_ssl = CONFIG["secure"]
|
||||||
|
|
||||||
# Include generic and useful information about system operation, but avoid logging too much
|
# Log to STDOUT by default
|
||||||
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
config.logger = ActiveSupport::Logger.new(STDOUT)
|
||||||
config.log_level = :warn
|
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
||||||
|
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
config.log_tags = [ :request_id ]
|
config.log_tags = [ :request_id ]
|
||||||
|
|
||||||
|
# Info include generic and useful information about system operation, but avoids logging too much
|
||||||
|
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
||||||
|
# want to log everything, set the level to "debug".
|
||||||
|
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
||||||
|
|
||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||||
# config.active_job.queue_adapter = :resque
|
# config.active_job.queue_adapter = :resque
|
||||||
# config.active_job.queue_name_prefix = "moebooru_production"
|
# config.active_job.queue_name_prefix = "moebooru_production"
|
||||||
|
|
||||||
config.action_mailer.perform_caching = false
|
config.action_mailer.perform_caching = false
|
||||||
@ -80,29 +89,33 @@ Rails.application.configure do
|
|||||||
# Don't log any deprecations.
|
# Don't log any deprecations.
|
||||||
config.active_support.report_deprecations = false
|
config.active_support.report_deprecations = false
|
||||||
|
|
||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
||||||
config.log_formatter = ::Logger::Formatter.new
|
|
||||||
|
|
||||||
# Use a different logger for distributed setups.
|
|
||||||
# require "syslog/logger"
|
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
|
||||||
|
|
||||||
if true || ENV["RAILS_LOG_TO_STDOUT"].present?
|
|
||||||
logger = ActiveSupport::Logger.new(STDOUT)
|
|
||||||
logger.formatter = config.log_formatter
|
|
||||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
||||||
end
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
# Enable DNS rebinding protection and other `Host` header attacks.
|
||||||
|
# config.hosts = [
|
||||||
|
# "example.com", # Allow requests from example.com
|
||||||
|
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||||
|
# ]
|
||||||
|
# Skip DNS rebinding protection for the default health check endpoint.
|
||||||
|
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||||
|
|
||||||
config.action_mailer.delivery_method = :sendmail
|
config.action_mailer.delivery_method = :sendmail
|
||||||
|
|
||||||
config.middleware.use ExceptionNotification::Rack,
|
config.middleware.use ExceptionNotification::Rack,
|
||||||
:ignore_exceptions => %w(ActionController::UnknownHttpMethod ActionController::BadRequest ActionController::ParameterMissing ActionController::InvalidAuthenticityToken ActionDispatch::Http::MimeNegotiation::InvalidType ActionDispatch::Http::Parameters::ParseError) + ExceptionNotifier.ignored_exceptions,
|
:ignore_exceptions =>
|
||||||
|
%w(
|
||||||
|
ActionController::UnknownHttpMethod
|
||||||
|
ActionController::BadRequest
|
||||||
|
ActionController::ParameterMissing
|
||||||
|
ActionController::InvalidAuthenticityToken
|
||||||
|
ActionDispatch::Http::MimeNegotiation::InvalidType
|
||||||
|
ActionDispatch::Http::Parameters::ParseError
|
||||||
|
) + ExceptionNotifier.ignored_exceptions,
|
||||||
:email => {
|
:email => {
|
||||||
:email_prefix => "[#{CONFIG["app_name"]}] ",
|
:email_prefix => "[#{CONFIG["app_name"]}] ",
|
||||||
:sender_address => "notifier <#{CONFIG["email_from"]}>",
|
:sender_address => "notifier <#{CONFIG["email_from"]}>",
|
||||||
:exception_recipients => CONFIG["admin_contact"]
|
:exception_recipients => CONFIG["admin_contact"]
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -8,12 +8,13 @@ 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.
|
# While tests run files are not watched, reloading is not necessary.
|
||||||
config.cache_classes = true
|
config.enable_reloading = false
|
||||||
|
|
||||||
# Eager loading loads your whole application. When running a single test locally,
|
# Eager loading loads your entire application. When running a single test locally,
|
||||||
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
# this is usually not necessary, and can slow down your test suite. However, it's
|
||||||
# system, or in some way before deploying your code.
|
# recommended that you enable it in continuous integration systems to ensure eager
|
||||||
|
# loading is working properly before deploying your code.
|
||||||
config.eager_load = ENV["CI"].present?
|
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.
|
||||||
@ -23,13 +24,13 @@ Rails.application.configure do
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
# Use default cache because some tests depend on caching to work
|
# Use default cache because some tests depend on caching to work
|
||||||
# config.cache_store = :null_store
|
# config.cache_store = :null_store
|
||||||
|
|
||||||
# Raise exceptions instead of rendering exception templates.
|
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
||||||
config.action_dispatch.show_exceptions = false
|
config.action_dispatch.show_exceptions = :rescuable
|
||||||
|
|
||||||
# Disable request forgery protection in test environment.
|
# Disable request forgery protection in test environment.
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
@ -58,4 +59,7 @@ 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
|
||||||
|
|
||||||
|
# Raise error when a before_action's only/except options reference missing actions
|
||||||
|
config.action_controller.raise_on_missing_callback_actions = true
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# 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.configure do
|
# Rails.application.configure do
|
||||||
# config.content_security_policy do |policy|
|
# config.content_security_policy do |policy|
|
||||||
@ -16,11 +16,10 @@
|
|||||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# # Generate session nonces for permitted importmap and inline scripts
|
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
||||||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||||
# config.content_security_policy_nonce_directives = %w(script-src)
|
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
||||||
#
|
#
|
||||||
# # Report CSP violations to a specified URI. See:
|
# # Report violations without enforcing the policy.
|
||||||
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
|
||||||
# # config.content_security_policy_report_only = true
|
# # config.content_security_policy_report_only = true
|
||||||
# end
|
# end
|
||||||
|
@ -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 partially matched (e.g. passw matches password) and 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 += [
|
||||||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
||||||
]
|
]
|
||||||
|
@ -1,117 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
# Rails.application.config.active_support.cache_format_version = 7.0
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
|
|
||||||
# was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.
|
|
||||||
#
|
|
||||||
# If you're confident all your cookies are JSON formatted, you can switch to the `:json` formatter.
|
|
||||||
#
|
|
||||||
# Continue to use `:marshal` for backward-compatibility with old cookies.
|
|
||||||
#
|
|
||||||
# If you have configured the serializer elsewhere, you can remove this.
|
|
||||||
#
|
|
||||||
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
|
|
||||||
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
# }
|
|
@ -1,11 +1,13 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Define an application-wide HTTP permissions policy. For further
|
# Define an application-wide HTTP permissions policy. For further
|
||||||
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
||||||
#
|
|
||||||
# Rails.application.config.permissions_policy do |f|
|
# Rails.application.config.permissions_policy do |policy|
|
||||||
# f.camera :none
|
# policy.camera :none
|
||||||
# f.gyroscope :none
|
# policy.gyroscope :none
|
||||||
# f.microphone :none
|
# policy.microphone :none
|
||||||
# f.usb :none
|
# policy.usb :none
|
||||||
# f.fullscreen :self
|
# policy.fullscreen :self
|
||||||
# f.payment :self, "https://secure.example.com"
|
# policy.payment :self, "https://secure.example.com"
|
||||||
# end
|
# end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user