summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
commit9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch)
tree8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /config
parent85a01e35274b8d4d4165a7b26bd7986e211246bb (diff)
parent1853082fcd8c067390c246f9daa01a9b47387497 (diff)
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'config')
-rw-r--r--config/application.rb25
-rw-r--r--config/boot.rb111
-rw-r--r--config/cable.yml10
-rw-r--r--config/database.mysql-sample.yml45
-rw-r--r--config/database.psql-sample.yml51
-rw-r--r--config/environment.rb66
-rw-r--r--config/environments/development.rb49
-rw-r--r--config/environments/production.rb52
-rw-r--r--config/environments/test.rb68
-rw-r--r--config/initializers/activesupport_duration_patch.rb53
-rw-r--r--config/initializers/backtrace_silencers.rb7
-rw-r--r--config/initializers/content_security_policy.rb29
-rw-r--r--config/initializers/exception_notifier.rb6
-rw-r--r--config/initializers/filter_parameter_logging.rb8
-rw-r--r--config/initializers/i18n.rb3
-rw-r--r--config/initializers/inflections.rb18
-rw-r--r--config/initializers/new_framework_defaults_8_1.rb74
-rw-r--r--config/initializers/new_rails_defaults.rb19
-rw-r--r--config/initializers/postgresql_adapter_patch.rb30
-rw-r--r--config/initializers/session_store.rb16
-rw-r--r--config/initializers/xmlparser.rb9
-rw-r--r--config/locales/de.yml6
-rw-r--r--config/locales/en.yml6
-rw-r--r--config/puma.rb42
-rw-r--r--config/routes.rb119
-rw-r--r--config/sphinx.yml3
-rw-r--r--config/storage.yml6
-rw-r--r--config/tinymce.yml8
28 files changed, 522 insertions, 417 deletions
diff --git a/config/application.rb b/config/application.rb
new file mode 100644
index 0000000..0be3396
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,25 @@
1require_relative "boot"
2
3require "rails/all"
4
5Bundler.require(*Rails.groups)
6
7module Cccms
8 class Application < Rails::Application
9 config.load_defaults 8.1
10
11 config.autoload_lib(ignore: %w[assets tasks])
12 Rails.autoloaders.main.ignore(
13 Rails.root.join('lib/chaos_importer.rb'),
14 Rails.root.join('lib/update_importer.rb')
15 )
16
17 config.time_zone = 'Berlin'
18
19 config.i18n.default_locale = :de
20 config.i18n.fallbacks = { en: [:en, :de] }
21
22 config.filter_parameters += [:password, :password_confirmation]
23 config.active_storage.variant_processor = :disabled
24 end
25end
diff --git a/config/boot.rb b/config/boot.rb
index dd5e3b6..2820116 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,110 +1,3 @@
1# Don't change this file! 1ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2# Configure your app in config/environment.rb and config/environments/*.rb
3 2
4RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) 3require "bundler/setup" # Set up gems listed in the Gemfile.
5
6module Rails
7 class << self
8 def boot!
9 unless booted?
10 preinitialize
11 pick_boot.run
12 end
13 end
14
15 def booted?
16 defined? Rails::Initializer
17 end
18
19 def pick_boot
20 (vendor_rails? ? VendorBoot : GemBoot).new
21 end
22
23 def vendor_rails?
24 File.exist?("#{RAILS_ROOT}/vendor/rails")
25 end
26
27 def preinitialize
28 load(preinitializer_path) if File.exist?(preinitializer_path)
29 end
30
31 def preinitializer_path
32 "#{RAILS_ROOT}/config/preinitializer.rb"
33 end
34 end
35
36 class Boot
37 def run
38 load_initializer
39 Rails::Initializer.run(:set_load_path)
40 end
41 end
42
43 class VendorBoot < Boot
44 def load_initializer
45 require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46 Rails::Initializer.run(:install_gem_spec_stubs)
47 Rails::GemDependency.add_frozen_gem_path
48 end
49 end
50
51 class GemBoot < Boot
52 def load_initializer
53 self.class.load_rubygems
54 load_rails_gem
55 require 'initializer'
56 end
57
58 def load_rails_gem
59 if version = self.class.gem_version
60 gem 'rails', version
61 else
62 gem 'rails'
63 end
64 rescue Gem::LoadError => load_error
65 $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66 exit 1
67 end
68
69 class << self
70 def rubygems_version
71 Gem::RubyGemsVersion rescue nil
72 end
73
74 def gem_version
75 if defined? RAILS_GEM_VERSION
76 RAILS_GEM_VERSION
77 elsif ENV.include?('RAILS_GEM_VERSION')
78 ENV['RAILS_GEM_VERSION']
79 else
80 parse_gem_version(read_environment_rb)
81 end
82 end
83
84 def load_rubygems
85 min_version = '1.3.2'
86 require 'rubygems'
87 unless rubygems_version >= min_version
88 $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89 exit 1
90 end
91
92 rescue LoadError
93 $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94 exit 1
95 end
96
97 def parse_gem_version(text)
98 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99 end
100
101 private
102 def read_environment_rb
103 File.read("#{RAILS_ROOT}/config/environment.rb")
104 end
105 end
106 end
107end
108
109# All that for this:
110Rails.boot!
diff --git a/config/cable.yml b/config/cable.yml
new file mode 100644
index 0000000..0c11ddb
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,10 @@
1development:
2 adapter: async
3
4test:
5 adapter: test
6
7production:
8 adapter: redis
9 url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 channel_prefix: cccms_production
diff --git a/config/database.mysql-sample.yml b/config/database.mysql-sample.yml
deleted file mode 100644
index bdb5311..0000000
--- a/config/database.mysql-sample.yml
+++ /dev/null
@@ -1,45 +0,0 @@
1# MySQL. Versions 4.1 and 5.0 are recommended.
2#
3# Install the MySQL driver:
4# gem install mysql
5# On Mac OS X:
6# sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
7# On Mac OS X Leopard:
8# sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
9# This sets the ARCHFLAGS environment variable to your native architecture
10# On Windows:
11# gem install mysql
12# Choose the win32 build.
13# Install MySQL and put its /bin directory on your path.
14#
15# And be sure to use new-style password hashing:
16# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
17development:
18 adapter: mysql
19 encoding: utf8
20 database: mysql_development
21 pool: 5
22 username: root
23 password:
24 socket: /opt/local/var/run/mysql5/mysqld.sock
25
26# Warning: The database defined as "test" will be erased and
27# re-generated from your development database when you run "rake".
28# Do not set this db to the same as development or production.
29test:
30 adapter: mysql
31 encoding: utf8
32 database: mysql_test
33 pool: 5
34 username: root
35 password:
36 socket: /opt/local/var/run/mysql5/mysqld.sock
37
38production:
39 adapter: mysql
40 encoding: utf8
41 database: mysql_production
42 pool: 5
43 username: root
44 password:
45 socket: /opt/local/var/run/mysql5/mysqld.sock
diff --git a/config/database.psql-sample.yml b/config/database.psql-sample.yml
deleted file mode 100644
index db7276e..0000000
--- a/config/database.psql-sample.yml
+++ /dev/null
@@ -1,51 +0,0 @@
1# PostgreSQL. Versions 7.4 and 8.x are supported.
2#
3# Install the ruby-postgres driver:
4# gem install ruby-postgres
5# On Mac OS X:
6# gem install ruby-postgres -- --include=/usr/local/pgsql
7# On Windows:
8# gem install ruby-postgres
9# Choose the win32 build.
10# Install PostgreSQL and put its /bin directory on your path.
11development:
12 adapter: postgresql
13 encoding: unicode
14 database: psql_development
15 pool: 5
16 username: psql
17 password:
18
19 # Connect on a TCP socket. Omitted by default since the client uses a
20 # domain socket that doesn't need configuration. Windows does not have
21 # domain sockets, so uncomment these lines.
22 #host: localhost
23 #port: 5432
24
25 # Schema search path. The server defaults to $user,public
26 #schema_search_path: myapp,sharedapp,public
27
28 # Minimum log levels, in increasing order:
29 # debug5, debug4, debug3, debug2, debug1,
30 # log, notice, warning, error, fatal, and panic
31 # The server defaults to notice.
32 #min_messages: warning
33
34# Warning: The database defined as "test" will be erased and
35# re-generated from your development database when you run "rake".
36# Do not set this db to the same as development or production.
37test:
38 adapter: postgresql
39 encoding: unicode
40 database: psql_test
41 pool: 5
42 username: psql
43 password:
44
45production:
46 adapter: postgresql
47 encoding: unicode
48 database: psql_production
49 pool: 5
50 username: psql
51 password:
diff --git a/config/environment.rb b/config/environment.rb
index ec7ffa9..cac5315 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,63 +1,5 @@
1# Be sure to restart your server when you modify this file 1# Load the Rails application.
2require_relative "application"
2 3
3# Specifies gem version of Rails to use when vendor/rails is not present 4# Initialize the Rails application.
4RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION 5Rails.application.initialize!
5
6# Bootstrap the Rails environment, frameworks, and default configuration
7require File.join(File.dirname(__FILE__), 'boot')
8
9Rails::Initializer.run do |config|
10 # Settings in config/environments/* take precedence over those specified here.
11 # Application configuration should go into files in config/initializers
12 # -- all .rb files in that directory are automatically loaded.
13
14 # Add additional load paths for your own custom dirs
15 # config.load_paths += %W( #{RAILS_ROOT}/extras )
16
17 # Specify gems that this application depends on and have them installed with rake gems:install
18 # config.gem "bj"
19 # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20 # config.gem "sqlite3-ruby", :lib => "sqlite3"
21 # config.gem "aws-s3", :lib => "aws/s3"
22
23 # config.gem "rake", :version => ">= 0.8.3"
24 # config.gem "rack", :version => ">= 0.9.1"
25 config.gem "pg"
26 config.gem "thinking-sphinx", :lib => 'thinking_sphinx', :version => '1.4.3'
27 config.gem "libxml-ruby", :lib => 'xml'
28 config.gem "erdgeist-chaos_calendar", :lib => "chaos_calendar", :source => "http://gems.github.com"
29
30 # Only load the plugins named here, in the order given (default is alphabetical).
31 # :all can be used as a placeholder for all plugins not explicitly named
32 # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
33
34 # Allowed Tags
35 # strong em b i p code pre tt samp kbd var sub sup dfn cite big small
36 # address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dt dd abbr
37 # acronym a img blockquote del ins
38
39 # Allowed Attributes:
40 # href src width height alt cite datetime title class name xml:lang abbr))
41
42 # Add tags to whitelist with:
43 # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
44
45 # Add attributes to whitelist with:
46 # config.action_view.sanitized_allowed_attributes = 'id', 'class', 'style'
47
48 # Activate observers that should always be running
49 # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
50
51 # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
52 # Run "rake -D time" for a list of tasks for finding time zone names.
53 config.time_zone = 'Berlin'
54
55 # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
56 # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
57 config.i18n.default_locale = :de
58end
59
60require 'awesome_patch'
61
62ExceptionNotifier.exception_recipients = %w(hukl@berlin.ccc.de)
63ExceptionNotifier.sender_address = %("CCCMS Error" <error@ccc.de>)
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 85c9a60..56174f8 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,17 +1,40 @@
1# Settings specified here will take precedence over those in config/environment.rb 1require "active_support/core_ext/integer/time"
2 2
3# In the development environment your application's code is reloaded on 3Rails.application.configure do
4# every request. This slows down response time but is perfect for development 4 config.enable_reloading = true
5# since you don't have to restart the webserver when you make code changes. 5 config.eager_load = false
6config.cache_classes = false
7 6
8# Log error messages when you accidentally call methods on nil. 7 config.consider_all_requests_local = true
9config.whiny_nils = true 8 config.server_timing = true
10 9
11# Show full error reports and disable caching 10 if Rails.root.join("tmp/caching-dev.txt").exist?
12config.action_controller.consider_all_requests_local = true 11 config.action_controller.perform_caching = true
13config.action_view.debug_rjs = true 12 config.action_controller.enable_fragment_cache_logging = true
14config.action_controller.perform_caching = false 13 config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
14 else
15 config.action_controller.perform_caching = false
16 end
15 17
16# Don't care if the mailer can't send 18 config.cache_store = :memory_store
17config.action_mailer.raise_delivery_errors = false \ No newline at end of file 19
20 config.action_mailer.raise_delivery_errors = false
21 config.action_mailer.perform_caching = false
22 config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
23
24 config.active_support.deprecation = :log
25
26 config.active_record.migration_error = :page_load
27 config.active_record.verbose_query_logs = true
28 config.active_record.query_log_tags_enabled = true
29
30 config.active_job.verbose_enqueue_logs = true
31 config.action_dispatch.verbose_redirect_logs = true
32 config.action_view.annotate_rendered_view_with_filenames = true
33 config.action_controller.raise_on_missing_callback_actions = true
34
35 config.hosts.clear
36 config.middleware.delete ExceptionNotification::Rack
37
38 config.assets.debug = false
39 config.assets.digest = true
40end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 68ceccd..fced949 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,35 +1,33 @@
1# Settings specified here will take precedence over those in config/environment.rb 1require "active_support/core_ext/integer/time"
2 2
3# The production environment is meant for finished, "live" apps. 3Rails.application.configure do
4# Code is not reloaded between requests 4 config.enable_reloading = false
5config.cache_classes = true 5 config.eager_load = true
6 config.assume_ssl = true
6 7
7# Full error reports are disabled and caching is turned on 8 config.consider_all_requests_local = false
8config.action_controller.consider_all_requests_local = false 9 config.action_controller.perform_caching = true
9config.action_controller.perform_caching = true
10 10
11# See everything in the log (default is :info) 11 config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
12# config.log_level = :debug
13 12
14# Use a different logger for distributed setups 13 config.log_tags = [ :request_id ]
15# config.logger = SyslogLogger.new 14 config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
15 config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
16 16
17# Use a different cache store in production 17 config.active_support.report_deprecations = false
18# config.cache_store = :mem_cache_store
19 18
20# Enable serving of images, stylesheets, and javascripts from an asset server 19 config.action_mailer.delivery_method = :sendmail
21# config.action_controller.asset_host = "http://assets.example.com" 20 config.action_mailer.sendmail_settings = {
21 location: '/usr/sbin/sendmail',
22 arguments: '-i -t'
23 }
24 config.action_mailer.perform_deliveries = true
25 config.action_mailer.raise_delivery_errors = true
26 config.action_mailer.default_url_options = { host: "ccc.de" }
22 27
23# Disable delivery errors, bad email addresses will be ignored 28 config.i18n.fallbacks = true
24# config.action_mailer.raise_delivery_errors = false
25 29
26# Enable threaded mode 30 config.assets.css_compressor = nil
27# config.threadsafe! 31 config.active_record.dump_schema_after_migration = false
28 32 config.active_record.attributes_for_inspect = [ :id ]
29ActionMailer::Base.delivery_method = :sendmail 33end
30ActionMailer::Base.sendmail_settings = {
31 :location => '/usr/sbin/sendmail',
32 :arguments => '-i -t'
33}
34ActionMailer::Base.perform_deliveries = true
35ActionMailer::Base.raise_delivery_errors = true \ No newline at end of file
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 496eb95..bb89065 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,27 +1,55 @@
1# Settings specified here will take precedence over those in config/environment.rb
2
3# The test environment is used exclusively to run your application's 1# The test environment is used exclusively to run your application's
4# test suite. You never need to work with it otherwise. Remember that 2# test suite. You never need to work with it otherwise. Remember that
5# your test database is "scratch space" for the test suite and is wiped 3# your test database is "scratch space" for the test suite and is wiped
6# and recreated between test runs. Don't rely on the data there! 4# and recreated between test runs. Don't rely on the data there!
7config.cache_classes = true 5
6Rails.application.configure do
7 # Settings specified here will take precedence over those in config/application.rb.
8
9 # While tests run files are not watched, reloading is not necessary.
10 config.enable_reloading = false
11
12 # Eager loading loads your entire application. When running a single test locally,
13 # this is usually not necessary, and can slow down your test suite. However, it's
14 # recommended that you enable it in continuous integration systems to ensure eager
15 # loading is working properly before deploying your code.
16 config.eager_load = ENV["CI"].present?
17
18 # Configure public file server for tests with cache-control for performance.
19 config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
20
21 # Show full error reports.
22 config.consider_all_requests_local = true
23 config.cache_store = :null_store
24
25 # Render exception templates for rescuable exceptions and raise for other exceptions.
26 config.action_dispatch.show_exceptions = :rescuable
27
28 # Disable request forgery protection in test environment.
29 config.action_controller.allow_forgery_protection = false
30
31 # Store uploaded files on the local file system in a temporary directory.
32 config.active_storage.service = :test
33
34 # Tell Action Mailer not to deliver emails to the real world.
35 # The :test delivery method accumulates sent emails in the
36 # ActionMailer::Base.deliveries array.
37 config.action_mailer.delivery_method = :test
38
39 # Set host to be used by links generated in mailer templates.
40 config.action_mailer.default_url_options = { host: "example.com" }
8 41
9# Log error messages when you accidentally call methods on nil. 42 # Print deprecation notices to the stderr.
10config.whiny_nils = true 43 config.active_support.deprecation = :stderr
11 44
12# Show full error reports and disable caching 45 # Raises error for missing translations.
13config.action_controller.consider_all_requests_local = true 46 # config.i18n.raise_on_missing_translations = true
14config.action_controller.perform_caching = false
15 47
16# Disable request forgery protection in test environment 48 # Annotate rendered view with file names.
17config.action_controller.allow_forgery_protection = false 49 # config.action_view.annotate_rendered_view_with_filenames = true
18 50
19# Tell Action Mailer not to deliver emails to the real world. 51 # Raise error when a before_action's only/except options reference missing actions.
20# The :test delivery method accumulates sent emails in the 52 config.action_controller.raise_on_missing_callback_actions = true
21# ActionMailer::Base.deliveries array.
22config.action_mailer.delivery_method = :test
23 53
24# Use SQL instead of Active Record's schema dumper when creating the test database. 54 config.assets.raise_runtime_errors = false
25# This is necessary if your schema can't be completely dumped by the schema dumper, 55end
26# like if you have constraints or database-specific column types
27# config.active_record.schema_format = :sql \ No newline at end of file
diff --git a/config/initializers/activesupport_duration_patch.rb b/config/initializers/activesupport_duration_patch.rb
new file mode 100644
index 0000000..c2b431d
--- /dev/null
+++ b/config/initializers/activesupport_duration_patch.rb
@@ -0,0 +1,53 @@
1class Integer
2 def days
3 ActiveSupport::Duration.new(self * 86400, [[:days, self]])
4 end
5 alias :day :days
6
7 def weeks
8 ActiveSupport::Duration.new(self * 7 * 86400, [[:days, self * 7]])
9 end
10 alias :week :weeks
11
12 def hours
13 ActiveSupport::Duration.new(self * 3600, [[:seconds, self * 3600]])
14 end
15 alias :hour :hours
16
17 def minutes
18 ActiveSupport::Duration.new(self * 60, [[:seconds, self * 60]])
19 end
20 alias :minute :minutes
21
22 def seconds
23 ActiveSupport::Duration.new(self, [[:seconds, self]])
24 end
25 alias :second :seconds
26
27 def months
28 ActiveSupport::Duration.new(self * 30 * 86400, [[:months, self]])
29 end
30 alias :month :months
31
32 def years
33 ActiveSupport::Duration.new((self * 365.25 * 86400).to_i, [[:years, self]])
34 end
35 alias :year :years
36end
37
38class Float
39 def days
40 ActiveSupport::Duration.new((self * 86400).to_i, [[:days, self]])
41 end
42 alias :day :days
43
44 def hours
45 ActiveSupport::Duration.new((self * 3600).to_i, [[:seconds, (self * 3600).to_i]])
46 end
47 alias :hour :hours
48
49 def minutes
50 ActiveSupport::Duration.new((self * 60).to_i, [[:seconds, (self * 60).to_i]])
51 end
52 alias :minute :minutes
53end
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
deleted file mode 100644
index c2169ed..0000000
--- a/config/initializers/backtrace_silencers.rb
+++ /dev/null
@@ -1,7 +0,0 @@
1# Be sure to restart your server when you modify this file.
2
3# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
6# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7# Rails.backtrace_cleaner.remove_silencers! \ No newline at end of file
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000..d51d713
--- /dev/null
+++ b/config/initializers/content_security_policy.rb
@@ -0,0 +1,29 @@
1# Be sure to restart your server when you modify this file.
2
3# Define an application-wide content security policy.
4# See the Securing Rails Applications Guide for more information:
5# https://guides.rubyonrails.org/security.html#content-security-policy-header
6
7# Rails.application.configure do
8# config.content_security_policy do |policy|
9# policy.default_src :self, :https
10# policy.font_src :self, :https, :data
11# policy.img_src :self, :https, :data
12# policy.object_src :none
13# policy.script_src :self, :https
14# policy.style_src :self, :https
15# # Specify URI for violation reports
16# # policy.report_uri "/csp-violation-report-endpoint"
17# end
18#
19# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
20# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21# config.content_security_policy_nonce_directives = %w(script-src style-src)
22#
23# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
24# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
25# # config.content_security_policy_nonce_auto = true
26#
27# # Report violations without enforcing the policy.
28# # config.content_security_policy_report_only = true
29# end
diff --git a/config/initializers/exception_notifier.rb b/config/initializers/exception_notifier.rb
new file mode 100644
index 0000000..bc7c385
--- /dev/null
+++ b/config/initializers/exception_notifier.rb
@@ -0,0 +1,6 @@
1Cccms::Application.config.middleware.use ExceptionNotification::Rack,
2 :email => {
3 :email_prefix => "[CCCMS] ",
4 :sender_address => %("CCCMS Error" <error@www.ccc.de>),
5 :exception_recipients => %w(erdgeist@ccc.de)
6 }
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 0000000..c0b717f
--- /dev/null
+++ b/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
1# Be sure to restart your server when you modify this file.
2
3# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4# Use this to limit dissemination of sensitive information.
5# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6Rails.application.config.filter_parameters += [
7 :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
8]
diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb
deleted file mode 100644
index 0190f63..0000000
--- a/config/initializers/i18n.rb
+++ /dev/null
@@ -1,3 +0,0 @@
1require "i18n/backend/fallbacks"
2I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
3I18n.fallbacks.map "en" => ["de"]
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index d531b8b..3860f65 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -1,10 +1,16 @@
1# Be sure to restart your server when you modify this file. 1# Be sure to restart your server when you modify this file.
2 2
3# Add new inflection rules using the following format 3# Add new inflection rules using the following format. Inflections
4# (all these examples are active by default): 4# are locale specific, and you may define rules for as many different
5# ActiveSupport::Inflector.inflections do |inflect| 5# locales as you wish. All of these examples are active by default:
6# inflect.plural /^(ox)$/i, '\1en' 6# ActiveSupport::Inflector.inflections(:en) do |inflect|
7# inflect.singular /^(ox)en/i, '\1' 7# inflect.plural /^(ox)$/i, "\\1en"
8# inflect.irregular 'person', 'people' 8# inflect.singular /^(ox)en/i, "\\1"
9# inflect.irregular "person", "people"
9# inflect.uncountable %w( fish sheep ) 10# inflect.uncountable %w( fish sheep )
10# end 11# end
12
13# These inflection rules are supported but not enabled by default:
14# ActiveSupport::Inflector.inflections(:en) do |inflect|
15# inflect.acronym "RESTful"
16# end
diff --git a/config/initializers/new_framework_defaults_8_1.rb b/config/initializers/new_framework_defaults_8_1.rb
new file mode 100644
index 0000000..8569b5b
--- /dev/null
+++ b/config/initializers/new_framework_defaults_8_1.rb
@@ -0,0 +1,74 @@
1# Be sure to restart your server when you modify this file.
2#
3# This file eases your Rails 8.1 framework defaults upgrade.
4#
5# Uncomment each configuration one by one to switch to the new default.
6# Once your application is ready to run with all new defaults, you can remove
7# this file and set the `config.load_defaults` to `8.1`.
8#
9# Read the Guide for Upgrading Ruby on Rails for more info on each option.
10# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
12###
13# Skips escaping HTML entities and line separators. When set to `false`, the
14# JSON renderer no longer escapes these to improve performance.
15#
16# Example:
17# class PostsController < ApplicationController
18# def index
19# render json: { key: "\u2028\u2029<>&" }
20# end
21# end
22#
23# Renders `{"key":"\u2028\u2029\u003c\u003e\u0026"}` with the previous default, but `{"key":"

<>&"}` with the config
24# set to `false`.
25#
26# Applications that want to keep the escaping behavior can set the config to `true`.
27#++
28# Rails.configuration.action_controller.escape_json_responses = false
29
30###
31# Skips escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON.
32#
33# Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019.
34# As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset.
35#++
36# Rails.configuration.active_support.escape_js_separators_in_json = false
37
38###
39# Raises an error when order dependent finder methods (e.g. `#first`, `#second`) are called without `order` values
40# on the relation, and the model does not have any order columns (`implicit_order_column`, `query_constraints`, or
41# `primary_key`) to fall back on.
42#
43# The current behavior of not raising an error has been deprecated, and this configuration option will be removed in
44# Rails 8.2.
45#++
46# Rails.configuration.active_record.raise_on_missing_required_finder_order_columns = true
47
48###
49# Controls how Rails handles path relative URL redirects.
50# When set to `:raise`, Rails will raise an `ActionController::Redirecting::UnsafeRedirectError`
51# for relative URLs without a leading slash, which can help prevent open redirect vulnerabilities.
52#
53# Example:
54# redirect_to "example.com" # Raises UnsafeRedirectError
55# redirect_to "@attacker.com" # Raises UnsafeRedirectError
56# redirect_to "/safe/path" # Works correctly
57#
58# Applications that want to allow these redirects can set the config to `:log` (previous default)
59# to only log warnings, or `:notify` to send ActiveSupport notifications.
60#++
61# Rails.configuration.action_controller.action_on_path_relative_redirect = :raise
62
63###
64# Use a Ruby parser to track dependencies between Action View templates
65#++
66# Rails.configuration.action_view.render_tracker = :ruby
67
68###
69# When enabled, hidden inputs generated by `form_tag`, `token_tag`, `method_tag`, and the hidden parameter fields
70# included in `button_to` forms will omit the `autocomplete="off"` attribute.
71#
72# Applications that want to keep generating the `autocomplete` attribute for those tags can set it to `false`.
73#++
74# Rails.configuration.action_view.remove_hidden_field_autocomplete = true
diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb
deleted file mode 100644
index 8ec3186..0000000
--- a/config/initializers/new_rails_defaults.rb
+++ /dev/null
@@ -1,19 +0,0 @@
1# Be sure to restart your server when you modify this file.
2
3# These settings change the behavior of Rails 2 apps and will be defaults
4# for Rails 3. You can remove this initializer when Rails 3 is released.
5
6if defined?(ActiveRecord)
7 # Include Active Record class name as root for JSON serialized output.
8 ActiveRecord::Base.include_root_in_json = true
9
10 # Store the full class name (including module namespace) in STI type column.
11 ActiveRecord::Base.store_full_sti_class = true
12end
13
14# Use ISO 8601 format for JSON serialized times and dates.
15ActiveSupport.use_standard_json_time_format = true
16
17# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18# if you're including raw json in an HTML page.
19ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file
diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb
new file mode 100644
index 0000000..57df6a2
--- /dev/null
+++ b/config/initializers/postgresql_adapter_patch.rb
@@ -0,0 +1,30 @@
1require 'active_record/connection_adapters/postgresql_adapter'
2
3module ActiveRecord
4 module ConnectionAdapters
5 class PostgreSQLAdapter
6 def create_database(name, options = {})
7 options = options.reverse_merge(:encoding => "utf8")
8
9 option_string = options.symbolize_keys.inject("") do |memo, (key, value)|
10 memo + case key
11 when :owner
12 " OWNER = \"#{value}\""
13 when :template
14 " TEMPLATE = \"#{value}\""
15 when :encoding
16 " ENCODING = '#{value}'"
17 when :tablespace
18 " TABLESPACE = \"#{value}\""
19 when :connection_limit
20 " CONNECTION LIMIT = #{value}"
21 else
22 ""
23 end
24 end
25
26 execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}"
27 end
28 end
29 end
30end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index b3e1098..507dc3c 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,15 +1 @@
1# Be sure to restart your server when you modify this file. Cccms::Application.config.session_store :cookie_store, :key => '_cccms_session'
2
3# Your secret key for verifying cookie session data integrity.
4# If you change this key, all old sessions will become invalid!
5# Make sure the secret is at least 30 characters and all random,
6# no regular words or you'll be exposed to dictionary attacks.
7ActionController::Base.session = {
8 :key => '_cccms_session',
9 :secret => 'b50f62033369e6039f2ece511f83f10f70301024709e189ab28d42379a26b7bfd0739fb83d89b6b76dba350569e5b9d83ee4abedbd9da468deea963512e4102b'
10}
11
12# Use the database for sessions instead of the cookie-based default,
13# which shouldn't be used to store highly confidential information
14# (create the session table with "rake db:sessions:create")
15# ActionController::Base.session_store = :active_record_store
diff --git a/config/initializers/xmlparser.rb b/config/initializers/xmlparser.rb
index 9c3f1c8..1d5e06d 100644
--- a/config/initializers/xmlparser.rb
+++ b/config/initializers/xmlparser.rb
@@ -1,14 +1,19 @@
1class XML::Node 1class XML::Node
2 def replace_with(other) 2 def replace_with(other)
3 self.next = other 3 self.next = other
4 remove! 4 remove!
5 end 5 end
6end 6end
7 7
8# Builder 3.x escapes content by default. Override _escape to pass text
9# through raw, preserving existing behaviour from the Rails 2 era.
10# Note: require builder first to ensure XmlBase < BasicObject is already
11# defined before we reopen it.
12require 'builder'
8module Builder 13module Builder
9 class XmlBase 14 class XmlBase
10 def _escape(text) 15 def _escape(text)
11 text 16 text
12 end 17 end
13 end 18 end
14end \ No newline at end of file 19end
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 2663948..5f77d79 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -18,12 +18,16 @@ de:
18 abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa] 18 abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
19 month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember] 19 month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
20 abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez] 20 abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
21 order: [ :day, :month, :year ] 21 order:
22 - :day
23 - :month
24 - :year
22 25
23 time: 26 time:
24 formats: 27 formats:
25 default: "%A, %e. %B %Y, %H:%M Uhr" 28 default: "%A, %e. %B %Y, %H:%M Uhr"
26 short: "%e. %B, %H:%M Uhr" 29 short: "%e. %B, %H:%M Uhr"
30 ccc: "%e. %B %Y, %H:%M Uhr"
27 long: "%A, %e. %B %Y, %H:%M Uhr" 31 long: "%A, %e. %B %Y, %H:%M Uhr"
28 time: "%H:%M" 32 time: "%H:%M"
29 33
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 81fa48e..2458d4d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -7,4 +7,8 @@ en:
7 sponsors: sponsors 7 sponsors: sponsors
8 hello: "Hello world" 8 hello: "Hello world"
9 show_tag_headline: "Pages tagged with:" 9 show_tag_headline: "Pages tagged with:"
10 old_ccc_de: the old ccc.de \ No newline at end of file 10 old_ccc_de: the old ccc.de
11
12 time:
13 formats:
14 ccc: "%d %B, %Y %H:%M"
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100644
index 0000000..38c4b86
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,42 @@
1# This configuration file will be evaluated by Puma. The top-level methods that
2# are invoked here are part of Puma's configuration DSL. For more information
3# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
4#
5# Puma starts a configurable number of processes (workers) and each process
6# serves each request in a thread from an internal thread pool.
7#
8# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
9# should only set this value when you want to run 2 or more workers. The
10# default is already 1. You can set it to `auto` to automatically start a worker
11# for each available processor.
12#
13# The ideal number of threads per worker depends both on how much time the
14# application spends waiting for IO operations and on how much you wish to
15# prioritize throughput over latency.
16#
17# As a rule of thumb, increasing the number of threads will increase how much
18# traffic a given process can handle (throughput), but due to CRuby's
19# Global VM Lock (GVL) it has diminishing returns and will degrade the
20# response time (latency) of the application.
21#
22# The default is set to 3 threads as it's deemed a decent compromise between
23# throughput and latency for the average Rails application.
24#
25# Any libraries that use a connection pool or another resource pool should
26# be configured to provide at least as many connections as the number of
27# threads. This includes Active Record's `pool` parameter in `database.yml`.
28threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
29threads threads_count, threads_count
30
31# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
32port ENV.fetch("PORT", 3000)
33
34# Allow puma to be restarted by `bin/rails restart` command.
35plugin :tmp_restart
36
37# Run the Solid Queue supervisor inside of Puma for single-server deployments.
38plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
39
40# Specify the PID file. Defaults to tmp/pids/server.pid in development.
41# In other environments, only set the PID file if requested.
42pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
diff --git a/config/routes.rb b/config/routes.rb
index c2590bd..2df9d46 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,38 +1,87 @@
1ActionController::Routing::Routes.draw do |map| 1Cccms::Application.routes.draw do
2
3 # Handles bare locale root paths: /de and /en (without trailing slash).
4 # Must live outside and before the scope because the scope's /*page_path
5 # catch-all would otherwise consume these before the locale segment is
6 # recognised. Replaces routing-filter's around_recognize hook which
7 # handled this transparently.
8 get '/:locale', to: 'content#render_page',
9 defaults: { page_path: ['home'] },
10 constraints: { locale: /de|en/ }
11
12 # All application routes are scoped under an optional two-letter locale
13 # prefix: /de/... and /en/... Both forms are valid; the prefix is omitted
14 # for the default locale (:de) in generated URLs via default_url_options
15 # in ApplicationController. This replaces the routing-filter gem.
16 #
17 # The locale regex must be kept in sync with config/application.rb
18 # (config.i18n.available_locales) and ApplicationController#set_locale.
19 # Adding a new locale requires updating all three locations.
20 scope '(:locale)', locale: /de|en/ do
21
22 resources :tags
23 resources :occurrences
24 resources :events
25
26 resources :pages do
27 member do
28 get :preview
29 put :sort_images
30 end
31 end
32
33 resources :nodes do
34 member do
35 put :unlock
36 put :publish
37 end
38
39 resources :revisions do
40 collection do
41 post :diff
42 end
43 member do
44 put :restore
45 end
46 end
47 end
48
49 scope '/admin' do
50 resources :assets
51 end
52
53 match '/logout' => 'sessions#destroy', :as => :logout, :via => :delete
54 match '/login' => 'sessions#new', :as => :login, :via => :get
55 match 'admin' => 'admin#index', :as => :admin, :via => :get
56 match 'admin/search' => 'admin#search', :as => :admin_search, :via => :get
57 match 'search' => 'search#index', :as => :search, :via => :get
58
59 resources :users
60
61 resources :menu_items do
62 member do
63 post :sort
64 end
65 end
66
67 resource :session
68
69 get 'rss/updates', :to => 'rss#updates', :as => :rss
70 get 'rss/updates.:format', :to => 'rss#updates', :as => :rss_feed,
71 :constraints => { :format => /xml|rdf/ }
72 get 'rss/recent_changes', :to => 'rss#recent_changes'
73
74 match 'galleries/*page_path' => 'content#render_gallery', :via => :get
75 match '/*page_path' => 'content#render_page', :as => :content, :via => :get
76
77 # Handles /de/ and /en/ (locale root with trailing slash).
78 # The bare-slash case inside the scope is distinct from the /:locale
79 # route above due to trailing slash handling in Rack/Rails routing.
80 get '/', to: 'content#render_page', defaults: { page_path: ['home'] }
81
82 # Handles / (no locale prefix — default locale :de).
83 root to: 'content#render_page', defaults: { page_path: ['home'] }
2 84
3 map.filter :locale
4
5 map.root(
6 :locale => 'de',
7 :controller => 'content',
8 :action => 'render_page',
9 :page_path => ['home']
10 )
11 map.resources :assets
12 map.resources :tags
13 map.resources :occurrences
14 map.resources :events
15 map.resources :pages, :member => {:preview => :get, :sort_images => :put}
16 map.resources :nodes, :member => {:publish => :put, :unlock => :put} do |node|
17 node.resources :revisions, :member => {:restore => :put}, :collection => {:diff => :post}
18 end 85 end
19 map.logout '/logout', :controller => 'sessions', :action => 'destroy' 86
20 map.login '/login', :controller => 'sessions', :action => 'new'
21 map.admin_search 'admin/search', :controller => 'admin', :action => 'search'
22 map.search 'search', :controller => "search", :action => 'index'
23 map.resources :users
24 map.resources :menu_items, :member => {:sort => :post}
25 map.resource :session
26
27 map.rss 'rss/:action', :controller => 'rss'
28 map.rss 'rss/:action.:format', :controller => 'rss'
29
30 map.connect ':controller/:action/:id'
31 map.connect ':controller/:action/:id.:format'
32
33 map.connect 'galleries/*page_path',
34 :controller => 'content', :action => 'render_gallery'
35
36 map.content '/*page_path',
37 :controller => 'content', :action => 'render_page'
38end 87end
diff --git a/config/sphinx.yml b/config/sphinx.yml
index a01c216..3dc9195 100644
--- a/config/sphinx.yml
+++ b/config/sphinx.yml
@@ -8,4 +8,5 @@ production:
8 config_file: "/usr/local/etc/sphinx.conf" 8 config_file: "/usr/local/etc/sphinx.conf"
9 searchd_log_file: "/var/log/searchd.log" 9 searchd_log_file: "/var/log/searchd.log"
10 query_log_file: "/var/log/searchd.query.log" 10 query_log_file: "/var/log/searchd.query.log"
11 pid_file: "/var/run/sphinxsearch/searchd.pid" \ No newline at end of file 11 max_matches: 10000
12 pid_file: "/var/run/sphinxsearch/searchd.pid"
diff --git a/config/storage.yml b/config/storage.yml
new file mode 100644
index 0000000..bfcedc8
--- /dev/null
+++ b/config/storage.yml
@@ -0,0 +1,6 @@
1# Active Storage is not used by this application.
2# This file exists only to satisfy the Active Storage engine initializer.
3# File uploads are handled by the custom FileAttachment concern.
4local:
5 service: Disk
6 root: <%= Rails.root.join("storage") %>
diff --git a/config/tinymce.yml b/config/tinymce.yml
new file mode 100644
index 0000000..c5329cd
--- /dev/null
+++ b/config/tinymce.yml
@@ -0,0 +1,8 @@
1license_key: gpl
2promotion: false
3menubar: false
4plugins:
5 - paste
6toolbar: bold italic underline | bullist numlist | link unlink | blocks | code
7relative_urls: false
8entity_encoding: raw