This Privacy Policy applies to Inklewriter Free or www.inklewriter.com (hereinafter, "us", "we", or "www.inklewriter.com").
11 |
Your privacy is essential
12 |
We collect as little information as possible as a general policy.
13 |
We use no tracker or any other tool to identify, profile, or target visitors.
14 |
We display no paid ads.
15 |
We don't distribute, sell, or trade any personal data to anyone.
16 |
Collected informations
17 |
18 |
Server Logs Inklewriter Free's web server is nginx, which produces standard access logs for every query. Each query log line contains personal datas such as the timestamp of the request, the IP addresses requesting the resource, or the browser used. These logs are kept only for potential technical analysis for a maximum duration of 6 months. They can only be accessed by the system administration team of Inklewriter Free.
19 |
Cookies Inklewriter Free uses Ruby on Rails cookies to identify the users when they log in in order to provide the service. The cookie has no other purposes.
20 |
Database recordsInklewriter Free stores user accounts and stories in postgresql. Users email addresses are used to identify the users in order to provide the service. Email addresses are kept for that single purpose and are optional as users can create accounts using the "@inklewriter" syntax when creating accounts.
30 | <%= f.label :current_password %> (we need your current password to confirm your changes)
31 | <%= f.password_field :current_password, autocomplete: "current-password" %>
32 |
33 |
34 |
35 | <%= f.submit "Update" %>
36 |
37 | <% end %>
38 |
39 |
Cancel my account
40 |
41 |
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
14 | <% end %>
15 |
16 | <%= render "users/shared/links" %>
17 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../config/application', __dir__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a starting point to setup your application.
14 | # Add necessary setup steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies if using Yarn
21 | # system('bin/yarn')
22 |
23 | # puts "\n== Copying sample files =="
24 | # unless File.exist?('config/database.yml')
25 | # cp 'config/database.yml.sample', 'config/database.yml'
26 | # end
27 |
28 | puts "\n== Preparing database =="
29 | system! 'bin/rails db:setup'
30 |
31 | puts "\n== Removing old logs and tempfiles =="
32 | system! 'bin/rails log:clear tmp:clear'
33 |
34 | puts "\n== Restarting application server =="
35 | system! 'bin/rails restart'
36 | end
37 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require 'rubygems'
8 | require 'bundler'
9 |
10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" }
12 | if spring
13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14 | gem 'spring', spring.version
15 | require 'spring/binstub'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a way to update your development environment automatically.
14 | # Add necessary update steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies if using Yarn
21 | # system('bin/yarn')
22 |
23 | puts "\n== Updating database =="
24 | system! 'bin/rails db:migrate'
25 |
26 | puts "\n== Removing old logs and tempfiles =="
27 | system! 'bin/rails log:clear tmp:clear'
28 |
29 | puts "\n== Restarting application server =="
30 | system! 'bin/rails restart'
31 | end
32 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_ROOT = File.expand_path('..', __dir__)
3 | Dir.chdir(APP_ROOT) do
4 | begin
5 | exec "yarnpkg", *ARGV
6 | rescue Errno::ENOENT
7 | $stderr.puts "Yarn executable was not detected in the system."
8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | exit 1
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative 'config/environment'
4 |
5 | run Rails.application
6 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module Freeifwriter
10 | class Application < Rails::Application
11 | # Initialize configuration defaults for originally generated Rails version.
12 | config.load_defaults 5.2
13 |
14 |
15 | config.action_controller.default_protect_from_forgery = false
16 |
17 | # Allow custom 404 500 ...
18 | config.exceptions_app = self.routes
19 |
20 | # Settings in config/environments/* take precedence over those specified here.
21 | # Application configuration can go into files in config/initializers
22 | # -- all .rb files in that directory are automatically loaded after loading
23 | # the framework and any gems in your application.
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
5 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: freeifwriter_production
11 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | /k9WpH/qQtXxKdHNs8s5JjVuvUbx7Oo9hrm33KZG9vXUxs0bJtx57EPtbfm6bBr1R5r2GkuUDt5lzDOS5q1lh8E7ipwbsO/IURWwZ55batxxvLzIS1xBOmsJUNoWFYhwD5BZo01ogmMwVb18aZhgBc/V9JD5LTPFH5Fo9kR4zJDmNi3RvMhMlJVKAxVksfMFXxotTXn60fPzMUx8wO2zDVMeobphymfl31xpIqGYzCFbq8xQ9wAoz8oPyiJqIARPeJTzVq6JlWpHUinzOfMApmqWsZcO/aqoUVgzM2jzdMoRxAO88NLAgF6rpCw97wXvaP8jk0+msWvrgSjWS7Tkw70U556rnj14oKwKX0anSkAyBkRa/zJt/N3BJGOq9TzgCUPtmnF/OXzZRTlojQKt2+PkovmSoVVMuQsj--7nelkeVyPJGsKBYq--6PeU8tZgbVXOeOujdAcT4w==
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | default: &default
2 | adapter: postgresql
3 | encoding: unicode
4 | pool: 5
5 |
6 | development:
7 | <<: *default
8 | database: inklewriter_dev
9 | user: <%= ENV.has_key?('POSTGRES_USER') ? ENV['POSTGRES_USER'] : Rails.application.secrets.db_user %>
10 | password: <%= ENV.has_key?('POSTGRES_PASSWORD') ? ENV['POSTGRES_PASSWORD'] : Rails.application.secrets.db_password %>
11 | host: <%= ENV.has_key?('POSTGRES_HOST') ? ENV['POSTGRES_HOST'] : Rails.application.secrets.dh_host %>
12 |
13 | # Warning: The database defined as "test" will be erased and
14 | # re-generated from your development database when you run "rake".
15 | # Do not set this db to the same as development or production.
16 | test:
17 | <<: *default
18 | database: inklewriter_test
19 | username: <%= ENV["POSTGRES_USER"] %>
20 | password: <%= ENV["POSTGRES_PASSWORD"] %>
21 | host: <%= ENV["POSTGRES_HOST"] %>
22 |
23 | production:
24 | <<: *default
25 | database: inklewriter_prod
26 | username: <%= ENV["POSTGRES_USER"] %>
27 | password: <%= ENV["POSTGRES_PASSWORD"] %>
28 | host: <%= ENV["POSTGRES_HOST"] %>
29 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | config.serve_static_assets = false
13 |
14 | # Show full error reports.
15 | config.consider_all_requests_local = true
16 |
17 | # Enable/disable caching. By default caching is disabled.
18 | # Run rails dev:cache to toggle caching.
19 | if Rails.root.join('tmp', 'caching-dev.txt').exist?
20 | config.action_controller.perform_caching = true
21 |
22 | config.cache_store = :memory_store
23 | config.public_file_server.headers = {
24 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
25 | }
26 | else
27 | config.action_controller.perform_caching = false
28 |
29 | config.cache_store = :null_store
30 | end
31 |
32 | # Store uploaded files on the local file system (see config/storage.yml for options)
33 | config.active_storage.service = :local
34 |
35 | # Don't care if the mailer can't send.
36 | # config.action_mailer.raise_delivery_errors = true
37 |
38 | config.action_mailer.perform_caching = false
39 |
40 | # Print deprecation notices to the Rails logger.
41 | config.active_support.deprecation = :log
42 |
43 | # Raise an error on page load if there are pending migrations.
44 | config.active_record.migration_error = :page_load
45 |
46 | # Highlight code that triggered database queries in logs.
47 | config.active_record.verbose_query_logs = true
48 |
49 | # Debug mode disables concatenation and preprocessing of assets.
50 | # This option may cause significant delays in view rendering with a large
51 | # number of complex assets.
52 | config.assets.debug = true
53 |
54 | # Suppress logger output for asset requests.
55 | config.assets.quiet = true
56 |
57 | # Raises error for missing translations
58 | # config.action_view.raise_on_missing_translations = true
59 |
60 | # Use an evented file watcher to asynchronously detect changes in source code,
61 | # routes, locales, etc. This feature depends on the listen gem.
62 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
63 |
64 | config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
65 |
66 | config.action_mailer.delivery_method = :smtp
67 | config.action_mailer.raise_delivery_errors = true
68 | config.action_mailer.perform_deliveries = false
69 | config.action_mailer.default :charset => "utf-8"
70 |
71 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
72 |
73 | config.action_mailer.smtp_settings = {
74 | address: Rails.application.secrets.mailing_address.present? ? Rails.application.secrets.mailing_address : ENV["MAILING_ADDRESS"],
75 | port: Rails.application.secrets.mailing_port.present? ? Rails.application.secrets.mailing_port : ENV["MAILING_PORT"],
76 | user_name: Rails.application.secrets.mailing_user.present? ? Rails.application.secrets.mailing_user : ENV["MAILING_USER"], #Your SMTP user
77 | password: Rails.application.secrets.mailing_password.present? ? Rails.application.secrets.mailing_password : ENV["MAILING_PASSWORD"], #Your SMTP password
78 | authentication: :login,
79 | enable_starttls_auto: true,
80 | ssl: true,
81 | domain: Rails.application.secrets.mailing_domain.present? ? Rails.application.secrets.mailing_domain : ENV["MAILING_DOMAIN"]
82 | }
83 |
84 | end
85 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19 | # config.require_master_key = true
20 |
21 | # Disable serving static files from the `/public` folder by default since
22 | # Apache or NGINX already handles this.
23 | config.public_file_server.enabled = true
24 |
25 | # Compress JavaScripts and CSS.
26 | config.assets.js_compressor = Uglifier.new(harmony: true)
27 | config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = true
31 |
32 | # caching policy for static assets
33 | config.public_file_server.headers = {
34 | 'Cache-Control' => 'public, max-age=15552000',
35 | 'Expires' => 1.year.from_now.to_formatted_s(:rfc822)
36 | }
37 |
38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39 |
40 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
41 | # config.action_controller.asset_host = 'http://assets.example.com'
42 |
43 | # Specifies the header that your server uses for sending files.
44 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
45 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
46 |
47 | # Store uploaded files on the local file system (see config/storage.yml for options)
48 | config.active_storage.service = :local
49 |
50 | # Mount Action Cable outside main process or domain
51 | # config.action_cable.mount_path = nil
52 | # config.action_cable.url = 'wss://example.com/cable'
53 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
54 |
55 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
56 | # config.force_ssl = true
57 |
58 | # Use the lowest log level to ensure availability of diagnostic information
59 | # when problems arise.
60 | config.log_level = :debug
61 |
62 | # Prepend all log lines with the following tags.
63 | config.log_tags = [ :request_id ]
64 |
65 | # Use a different cache store in production.
66 | # config.cache_store = :mem_cache_store
67 |
68 | # Use a real queuing backend for Active Job (and separate queues per environment)
69 | # config.active_job.queue_adapter = :resque
70 | # config.active_job.queue_name_prefix = "freeifwriter_#{Rails.env}"
71 |
72 | config.action_mailer.perform_caching = false
73 |
74 | # Ignore bad email addresses and do not raise email delivery errors.
75 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
76 | # config.action_mailer.raise_delivery_errors = false
77 |
78 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
79 | # the I18n.default_locale when a translation cannot be found).
80 | config.i18n.fallbacks = true
81 |
82 | # Send deprecation notices to registered listeners.
83 | config.active_support.deprecation = :notify
84 |
85 | # Use default logging formatter so that PID and timestamp are not suppressed.
86 | config.log_formatter = ::Logger::Formatter.new
87 |
88 | # Use a different logger for distributed setups.
89 | # require 'syslog/logger'
90 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
91 |
92 | if ENV["RAILS_LOG_TO_STDOUT"].present?
93 | logger = ActiveSupport::Logger.new(STDOUT)
94 | logger.formatter = config.log_formatter
95 | config.logger = ActiveSupport::TaggedLogging.new(logger)
96 | end
97 |
98 |
99 |
100 | # Do not dump schema after migrations.
101 | config.active_record.dump_schema_after_migration = false
102 |
103 | config.action_mailer.delivery_method = :smtp
104 | config.action_mailer.raise_delivery_errors = true
105 | config.action_mailer.perform_deliveries = true
106 | config.action_mailer.default :charset => "utf-8"
107 |
108 | config.action_mailer.default_url_options = { host: ENV["ACTION_MAILER_HOST"], :protocol => 'https'}
109 |
110 | config.action_mailer.smtp_settings = {
111 | address: ENV["MAILING_ADDRESS"],
112 | port: ENV["MAILING_PORT"],
113 | user_name: ENV["MAILING_USER"], #Your SMTP user
114 | password: ENV["MAILING_PASSWORD"], #Your SMTP password
115 | authentication: :login,
116 | enable_starttls_auto: true,
117 | ssl: true,
118 | domain: ENV["MAILING_DOMAIN"]
119 | }
120 |
121 | end
122 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
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 | config.action_mailer.perform_caching = false
35 |
36 | # Tell Action Mailer not to deliver emails to the real world.
37 | # The :test delivery method accumulates sent emails in the
38 | # ActionMailer::Base.deliveries array.
39 | config.action_mailer.delivery_method = :test
40 |
41 | # Print deprecation notices to the stderr.
42 | config.active_support.deprecation = :stderr
43 |
44 | # Raises error for missing translations
45 | # config.action_view.raise_on_missing_translations = true
46 | end
47 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 | Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets')
11 |
12 | Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.svg *.ttf *.webp *.woff *.woff2 *.eot)
13 |
14 | # Precompile additional assets.
15 | # application.js, application.css, and all non-JS/CSS in the app/assets
16 | # folder are already added.
17 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
18 | Rails.application.config.assets.precompile += %w( ifwriter-main.js )
19 | Rails.application.config.assets.precompile += %w( pages/index.js )
20 | Rails.application.config.assets.precompile += %w( stories/show.js )
21 | Rails.application.config.assets.precompile += %w( emails.css )
22 | Rails.application.config.assets.precompile += %w( devise.css )
23 | Rails.application.config.assets.precompile += %w( errors.css )
24 | Rails.application.config.assets.precompile += %w( inklewriter-convert.js )
25 | Rails.application.config.assets.precompile += %w( inking.css )
26 | Rails.application.config.assets.precompile += %w( inklewriter-read.js )
27 | Rails.application.config.assets.precompile += %w( inklewriter-write.js )
28 | Rails.application.config.assets.precompile += %w( pages.css )
29 | Rails.application.config.assets.precompile += %w( inking.css )
30 | Rails.application.config.assets.precompile += %w( stories.css )
31 | Rails.application.config.assets.precompile += %w( inklewriter.css )
32 | Rails.application.config.assets.precompile += %w( admin/adminpages.css )
33 | Rails.application.config.assets.precompile += %w( users/confirmations.css )
34 | Rails.application.config.assets.precompile += %w( users/sessions.css )
35 | Rails.application.config.assets.precompile += %w( users/registrations.css )
36 | Rails.application.config.assets.precompile += %w( users/unlocks.css )
37 | Rails.application.config.assets.precompile += %w( users/passwords.css )
38 | Rails.application.config.assets.precompile += %w( admin/adminpages/index.js )
39 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
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 to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy
4 | # For further information see the following documentation
5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 |
7 | # Rails.application.config.content_security_policy do |policy|
8 | # policy.default_src :self, :https
9 | # policy.font_src :self, :https, :data
10 | # policy.img_src :self, :https, :data
11 | # policy.object_src :none
12 | # policy.script_src :self, :https
13 | # policy.style_src :self, :https
14 |
15 | # # Specify URI for violation reports
16 | # # policy.report_uri "/csp-violation-report-endpoint"
17 | # end
18 |
19 | # If you are using UJS then enable automatic nonce generation
20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21 |
22 | # Report CSP violations to a specified URI
23 | # For further information see the following documentation:
24 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 | # Rails.application.config.content_security_policy_report_only = true
26 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Use this hook to configure devise mailer, warden hooks and so forth.
4 | # Many of these configuration options can be set straight in your model.
5 | Devise.setup do |config|
6 | # The secret key used by Devise. Devise uses this key to generate
7 | # random tokens. Changing this key will render invalid all existing
8 | # confirmation, reset password and unlock tokens in the database.
9 | # Devise will use the `secret_key_base` as its `secret_key`
10 | # by default. You can change it below and use your own secret key.
11 | # config.secret_key = '3895c1ef7b59bc2d60d0dfd026a3098f1cfb20eb957903c069d82f4a7cccbd85851f7c26e4a22e80ebfcbe2910b29f90cb3a4c07a06c47b1edaea712a41b8a1d'
12 |
13 | # ==> Controller configuration
14 | # Configure the parent class to the devise controllers.
15 | # config.parent_controller = 'DeviseController'
16 |
17 | # ==> Mailer Configuration
18 | # Configure the e-mail address which will be shown in Devise::Mailer,
19 | # note that it will be overwritten if you use your own mailer class
20 | # with default "from" parameter.
21 | config.mailer_sender = 'do-not-reply@inklewriter.com'
22 |
23 | # Configure the class responsible to send e-mails.
24 | config.mailer = 'CustomDeviseMailer'
25 |
26 | # Configure the parent class responsible to send e-mails.
27 | config.parent_mailer = 'ActionMailer::Base'
28 |
29 | # ==> ORM configuration
30 | # Load and configure the ORM. Supports :active_record (default) and
31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
32 | # available as additional gems.
33 | require 'devise/orm/active_record'
34 |
35 | # ==> Configuration for any authentication mechanism
36 | # Configure which keys are used when authenticating a user. The default is
37 | # just :email. You can configure it to use [:username, :subdomain], so for
38 | # authenticating a user, both parameters are required. Remember that those
39 | # parameters are used only when authenticating and not when retrieving from
40 | # session. If you need permissions, you should implement that in a before filter.
41 | # You can also supply a hash where the value is a boolean determining whether
42 | # or not authentication should be aborted when the value is not present.
43 | # config.authentication_keys = [:email]
44 |
45 | # Configure parameters from the request object used for authentication. Each entry
46 | # given should be a request method and it will automatically be passed to the
47 | # find_for_authentication method and considered in your model lookup. For instance,
48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
49 | # The same considerations mentioned for authentication_keys also apply to request_keys.
50 | # config.request_keys = []
51 |
52 | # Configure which authentication keys should be case-insensitive.
53 | # These keys will be downcased upon creating or modifying a user and when used
54 | # to authenticate or find a user. Default is :email.
55 | config.case_insensitive_keys = [:email]
56 |
57 | # Configure which authentication keys should have whitespace stripped.
58 | # These keys will have whitespace before and after removed upon creating or
59 | # modifying a user and when used to authenticate or find a user. Default is :email.
60 | config.strip_whitespace_keys = [:email]
61 |
62 | # Tell if authentication through request.params is enabled. True by default.
63 | # It can be set to an array that will enable params authentication only for the
64 | # given strategies, for example, `config.params_authenticatable = [:database]` will
65 | # enable it only for database (email + password) authentication.
66 | # config.params_authenticatable = true
67 |
68 | # Tell if authentication through HTTP Auth is enabled. False by default.
69 | # It can be set to an array that will enable http authentication only for the
70 | # given strategies, for example, `config.http_authenticatable = [:database]` will
71 | # enable it only for database authentication. The supported strategies are:
72 | # :database = Support basic authentication with authentication key + password
73 | # config.http_authenticatable = false
74 |
75 | # If 401 status code should be returned for AJAX requests. True by default.
76 | config.http_authenticatable_on_xhr = true
77 |
78 | # The realm used in Http Basic Authentication. 'Application' by default.
79 | # config.http_authentication_realm = 'Application'
80 |
81 | # It will change confirmation, password recovery and other workflows
82 | # to behave the same regardless if the e-mail provided was right or wrong.
83 | # Does not affect registerable.
84 | # config.paranoid = true
85 |
86 | # By default Devise will store the user in session. You can skip storage for
87 | # particular strategies by setting this option.
88 | # Notice that if you are skipping storage for all authentication paths, you
89 | # may want to disable generating routes to Devise's sessions controller by
90 | # passing skip: :sessions to `devise_for` in your config/routes.rb
91 | config.skip_session_storage = [:http_auth]
92 |
93 | # By default, Devise cleans up the CSRF token on authentication to
94 | # avoid CSRF token fixation attacks. This means that, when using AJAX
95 | # requests for sign in and sign up, you need to get a new CSRF token
96 | # from the server. You can disable this option at your own risk.
97 | # config.clean_up_csrf_token_on_authentication = false
98 |
99 | # When false, Devise will not attempt to reload routes on eager load.
100 | # This can reduce the time taken to boot the app but if your application
101 | # requires the Devise mappings to be loaded during boot time the application
102 | # won't boot properly.
103 | # config.reload_routes = true
104 |
105 | # ==> Configuration for :database_authenticatable
106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107 | # using other algorithms, it sets how many times you want the password to be hashed.
108 | #
109 | # Limiting the stretches to just one in testing will increase the performance of
110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111 | # a value less than 10 in other environments. Note that, for bcrypt (the default
112 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114 | config.stretches = Rails.env.test? ? 1 : 11
115 |
116 | # Set up a pepper to generate the hashed password.
117 | # config.pepper = '0e2e3a42f864180988088156313d0abda5c57007d3a4ccd3a598c4001db869a8d90d10d771e7e1fccf9405ba9c387bf5ce790da11148362a44987d68b8d25c1a'
118 |
119 | # Send a notification to the original email when the user's email is changed.
120 | # config.send_email_changed_notification = false
121 |
122 | # Send a notification email when the user's password is changed.
123 | # config.send_password_change_notification = false
124 |
125 | # ==> Configuration for :confirmable
126 | # A period that the user is allowed to access the website even without
127 | # confirming their account. For instance, if set to 2.days, the user will be
128 | # able to access the website for two days without confirming their account,
129 | # access will be blocked just in the third day.
130 | # You can also set it to nil, which will allow the user to access the website
131 | # without confirming their account.
132 | # Default is 0.days, meaning the user cannot access the website without
133 | # confirming their account.
134 | # config.allow_unconfirmed_access_for = 2.days
135 |
136 | # A period that the user is allowed to confirm their account before their
137 | # token becomes invalid. For example, if set to 3.days, the user can confirm
138 | # their account within 3 days after the mail was sent, but on the fourth day
139 | # their account can't be confirmed with the token any more.
140 | # Default is nil, meaning there is no restriction on how long a user can take
141 | # before confirming their account.
142 | # config.confirm_within = 3.days
143 |
144 | # If true, requires any email changes to be confirmed (exactly the same way as
145 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
146 | # db field (see migrations). Until confirmed, new email is stored in
147 | # unconfirmed_email column, and copied to email column on successful confirmation.
148 | config.reconfirmable = true
149 |
150 | # Defines which key will be used when confirming an account
151 | # config.confirmation_keys = [:email]
152 |
153 | # ==> Configuration for :rememberable
154 | # The time the user will be remembered without asking for credentials again.
155 | config.remember_for = 2.weeks
156 |
157 | # Invalidates all the remember me tokens when the user signs out.
158 | config.expire_all_remember_me_on_sign_out = true
159 |
160 | # If true, extends the user's remember period when remembered via cookie.
161 | # config.extend_remember_period = false
162 |
163 | # Options to be passed to the created cookie. For instance, you can set
164 | # secure: true in order to force SSL only cookies.
165 | # config.rememberable_options = {}
166 |
167 | # ==> Configuration for :validatable
168 | # Range for password length.
169 | config.password_length = 6..128
170 |
171 | # Email regex used to validate email formats. It simply asserts that
172 | # one (and only one) @ exists in the given string. This is mainly
173 | # to give user feedback and not to assert the e-mail validity.
174 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
175 |
176 | # ==> Configuration for :timeoutable
177 | # The time you want to timeout the user session without activity. After this
178 | # time the user will be asked for credentials again. Default is 30 minutes.
179 | # config.timeout_in = 30.minutes
180 |
181 | # ==> Configuration for :lockable
182 | # Defines which strategy will be used to lock an account.
183 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
184 | # :none = No lock strategy. You should handle locking by yourself.
185 | # config.lock_strategy = :failed_attempts
186 |
187 | # Defines which key will be used when locking and unlocking an account
188 | # config.unlock_keys = [:email]
189 |
190 | # Defines which strategy will be used to unlock an account.
191 | # :email = Sends an unlock link to the user email
192 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
193 | # :both = Enables both strategies
194 | # :none = No unlock strategy. You should handle unlocking by yourself.
195 | # config.unlock_strategy = :both
196 |
197 | # Number of authentication tries before locking an account if lock_strategy
198 | # is failed attempts.
199 | # config.maximum_attempts = 20
200 |
201 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
202 | # config.unlock_in = 1.hour
203 |
204 | # Warn on the last attempt before the account is locked.
205 | # config.last_attempt_warning = true
206 |
207 | # ==> Configuration for :recoverable
208 | #
209 | # Defines which key will be used when recovering the password for an account
210 | # config.reset_password_keys = [:email]
211 |
212 | # Time interval you can reset your password with a reset password key.
213 | # Don't put a too small interval or your users won't have the time to
214 | # change their passwords.
215 | config.reset_password_within = 6.hours
216 |
217 | # When set to false, does not sign a user in automatically after their password is
218 | # reset. Defaults to true, so a user is signed in automatically after a reset.
219 | # config.sign_in_after_reset_password = true
220 |
221 | # ==> Configuration for :encryptable
222 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
223 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
224 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
225 | # for default behavior) and :restful_authentication_sha1 (then you should set
226 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
227 | #
228 | # Require the `devise-encryptable` gem when using anything other than bcrypt
229 | # config.encryptor = :sha512
230 |
231 | # ==> Scopes configuration
232 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
233 | # "users/sessions/new". It's turned off by default because it's slower if you
234 | # are using only default views.
235 | config.scoped_views = true
236 |
237 | # Configure the default scope given to Warden. By default it's the first
238 | # devise role declared in your routes (usually :user).
239 | # config.default_scope = :user
240 |
241 | # Set this configuration to false if you want /users/sign_out to sign out
242 | # only the current scope. By default, Devise signs out all scopes.
243 | # config.sign_out_all_scopes = true
244 |
245 | # ==> Navigation configuration
246 | # Lists the formats that should be treated as navigational. Formats like
247 | # :html, should redirect to the sign in page when the user does not have
248 | # access, but formats like :xml or :json, should return 401.
249 | #
250 | # If you have any extra navigational formats, like :iphone or :mobile, you
251 | # should add them to the navigational formats lists.
252 | #
253 | # The "*/*" below is required to match Internet Explorer requests.
254 | # config.navigational_formats = ['*/*', :html]
255 |
256 | # The default HTTP method used to sign out a resource. Default is :delete.
257 | config.sign_out_via = :delete
258 |
259 | # ==> OmniAuth
260 | # Add a new OmniAuth provider. Check the wiki for more information on setting
261 | # up on your models and hooks.
262 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
263 |
264 | # ==> Warden configuration
265 | # If you want to use other strategies, that are not supported by Devise, or
266 | # change the failure app, you can configure them inside the config.warden block.
267 | #
268 | # config.warden do |manager|
269 | # manager.intercept_401 = false
270 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
271 | # end
272 |
273 | # ==> Mountable engine configurations
274 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
275 | # is mountable, there are some extra configurations to be taken into account.
276 | # The following options are available, assuming the engine is mounted as:
277 | #
278 | # mount MyEngine, at: '/my_engine'
279 | #
280 | # The router that invoked `devise_for`, in the example above, would be:
281 | # config.router_name = :my_engine
282 | #
283 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
284 | # so you need to do it manually. For the users scope, it would be:
285 | # config.omniauth_path_prefix = '/my_engine/users/auth'
286 |
287 | # ==> Turbolinks configuration
288 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
289 | #
290 | # ActiveSupport.on_load(:devise_failure_app) do
291 | # include Turbolinks::Controller
292 | # end
293 |
294 | # ==> Configuration for :registerable
295 |
296 | # When set to false, does not sign a user in automatically after their password is
297 | # changed. Defaults to true, so a user is signed in automatically after changing a password.
298 | # config.sign_in_after_change_password = true
299 | end
300 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/health_check.rb:
--------------------------------------------------------------------------------
1 | HealthCheck.setup do |config|
2 |
3 | # uri prefix (no leading slash)
4 | config.uri = 'health_check'
5 |
6 | # Text output upon success
7 | config.success = 'success'
8 |
9 | # Timeout in seconds used when checking smtp server
10 | config.smtp_timeout = 30.0
11 |
12 | # http status code used when plain text error message is output
13 | # Set to 200 if you want your want to distinguish between partial (text does not include success) and
14 | # total failure of rails application (http status of 500 etc)
15 |
16 | config.http_status_for_error_text = 500
17 |
18 | # http status code used when an error object is output (json or xml)
19 | # Set to 200 if you want your want to distinguish between partial (healthy property == false) and
20 | # total failure of rails application (http status of 500 etc)
21 |
22 | config.http_status_for_error_object = 500
23 |
24 | # bucket names to test connectivity - required only if s3 check used, access permissions can be mixed
25 | config.buckets = {'bucket_name' => [:R, :W, :D]}
26 |
27 | # You can customize which checks happen on a standard health check, eg to set an explicit list use:
28 | config.standard_checks = [ 'database', 'migrations', 'custom' ]
29 |
30 | # Or to exclude one check:
31 | config.standard_checks -= [ 'emailconf' ]
32 |
33 | # You can set what tests are run with the 'full' or 'all' parameter
34 | config.full_checks = ['database', 'migrations', 'custom', 'email', 'cache', 'redis', 'resque-redis', 'sidekiq-redis', 's3']
35 |
36 | # Add one or more custom checks that return a blank string if ok, or an error message if there is an error
37 | config.add_custom_check do
38 | CustomHealthCheck.perform_check # any code that returns blank on success and non blank string upon failure
39 | end
40 |
41 | # Add another custom check with a name, so you can call just specific custom checks. This can also be run using
42 | # the standard 'custom' check.
43 | # You can define multiple tests under the same name - they will be run one after the other.
44 | config.add_custom_check('sometest') do
45 | CustomHealthCheck.perform_another_check # any code that returns blank on success and non blank string upon failure
46 | end
47 |
48 | # max-age of response in seconds
49 | # cache-control is public when max_age > 1 and basic_auth_username is not set
50 | # You can force private without authentication for longer max_age by
51 | # setting basic_auth_username but not basic_auth_password
52 | config.max_age = 1
53 |
54 | # Protect health endpoints with basic auth
55 | # These default to nil and the endpoint is not protected
56 | # config.basic_auth_username = 'my_username'
57 | # config.basic_auth_password = 'my_password'
58 | config.basic_auth_username = nil
59 | config.basic_auth_password = nil
60 |
61 | # Whitelist requesting IPs
62 | # Defaults to blank and allows any IP
63 | config.origin_ip_whitelist = %w(123.123.123.123)
64 |
65 | # http status code used when the ip is not allowed for the request
66 | config.http_status_for_ip_whitelist_error = 403
67 |
68 | # When redis url is non-standard
69 | config.redis_url = 'redis_url'
70 |
71 | # Disable the error message to prevent /health_check from leaking
72 | # sensitive information
73 | # config.include_error_in_response_body = false
74 | end
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
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
17 |
18 | ActiveSupport::Inflector.inflections(:en) do |inflect|
19 | inflect.irregular 'story', 'stories'
20 | end
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 | Mime::Type.register "text/html", :ink
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | Rails.application.config.session_store :cookie_store, key: '_inklewriter_session'
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json]
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
48 | sessions:
49 | signed_in: "Signed in successfully."
50 | signed_out: "Signed out successfully."
51 | already_signed_out: "Signed out successfully."
52 | unlocks:
53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
56 | errors:
57 | messages:
58 | already_confirmed: "was already confirmed, please try signing in"
59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
60 | expired: "has expired, please request a new one"
61 | not_found: "not found"
62 | not_locked: "was not locked"
63 | not_saved:
64 | one: "1 error prohibited this %{resource} from being saved:"
65 | other: "%{count} errors prohibited this %{resource} from being saved:"
66 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | threads threads_count, threads_count
9 |
10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 | #
12 | port ENV.fetch("PORT") { 3000 }
13 |
14 | # Specifies the `environment` that Puma will run in.
15 | #
16 | environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # Specifies the number of `workers` to boot in clustered mode.
19 | # Workers are forked webserver processes. If using threads and workers together
20 | # the concurrency of the application would be max `threads` * `workers`.
21 | # Workers do not work on JRuby or Windows (both of which do not support
22 | # processes).
23 | #
24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # Use the `preload_app!` method when specifying a `workers` number.
27 | # This directive tells Puma to first boot the application and load code
28 | # before forking the application. This takes advantage of Copy On Write
29 | # process behavior so workers use less memory.
30 | #
31 | # preload_app!
32 |
33 | # Allow puma to be restarted by `rails restart` command.
34 | plugin :tmp_restart
35 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | devise_for :users, controllers: { sessions: "users/sessions", registrations: "users/registrations", passwords: "users/passwords"}
3 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
4 | root to: 'pages#index'
5 |
6 |
7 |
8 | resources :stories
9 |
10 | resources :users do
11 | resources :stories
12 | end
13 |
14 | namespace :admin do
15 | get '/', to: 'adminpages#index'
16 | post 'score_search', to: 'adminpages#score_search'
17 | end
18 |
19 | match "/404", :to => "errors#not_found", :via => :all
20 | match "/500", :to => "errors#internal_server_error", :via => :all
21 | get 'health', to: 'pages#health'
22 | get 'privacy', to: 'pages#privacy'
23 |
24 | end
25 |
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | %w[
2 | .ruby-version
3 | .rbenv-vars
4 | tmp/restart.txt
5 | tmp/caching-dev.txt
6 | ].each { |path| Spring.watch(path) }
7 |
--------------------------------------------------------------------------------
/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket
23 |
24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/db/migrate/20190219150520_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DeviseCreateUsers < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :users do |t|
6 | ## Database authenticatable
7 | t.string :email, null: false, default: ""
8 | t.string :encrypted_password, null: false, default: ""
9 |
10 | ## Recoverable
11 | t.string :reset_password_token
12 | t.datetime :reset_password_sent_at
13 |
14 | ## Rememberable
15 | t.datetime :remember_created_at
16 |
17 | ## Trackable
18 | # t.integer :sign_in_count, default: 0, null: false
19 | # t.datetime :current_sign_in_at
20 | # t.datetime :last_sign_in_at
21 | # t.string :current_sign_in_ip
22 | # t.string :last_sign_in_ip
23 |
24 | ## Confirmable
25 | # t.string :confirmation_token
26 | # t.datetime :confirmed_at
27 | # t.datetime :confirmation_sent_at
28 | # t.string :unconfirmed_email # Only if using reconfirmable
29 |
30 | ## Lockable
31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32 | # t.string :unlock_token # Only if unlock strategy is :email or :both
33 | # t.datetime :locked_at
34 |
35 |
36 | t.timestamps null: false
37 | end
38 |
39 | add_index :users, :email, unique: true
40 | add_index :users, :reset_password_token, unique: true
41 | # add_index :users, :confirmation_token, unique: true
42 | # add_index :users, :unlock_token, unique: true
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/db/migrate/20190219160258_add_authentication_token_to_users.rb:
--------------------------------------------------------------------------------
1 | class AddAuthenticationTokenToUsers < ActiveRecord::Migration[5.2]
2 | def change
3 | add_column :users, :authentication_token, :string
4 | add_index :users, :authentication_token
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/db/migrate/20190618142849_create_stories.rb:
--------------------------------------------------------------------------------
1 | class CreateStories < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :stories do |t|
4 | t.references :user, foreign_key: true
5 | t.json :data
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/migrate/20190618215055_add_title_to_stories.rb:
--------------------------------------------------------------------------------
1 | class AddTitleToStories < ActiveRecord::Migration[5.2]
2 | def change
3 | add_column :stories, :title, :string
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20190827143319_add_url_key_to_stories.rb:
--------------------------------------------------------------------------------
1 | class AddUrlKeyToStories < ActiveRecord::Migration[5.2]
2 | def change
3 | add_column :stories, :url_key, :integer
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20201122095701_create_admins.rb:
--------------------------------------------------------------------------------
1 | class CreateAdmins < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :admins do |t|
4 | t.references :user, foreign_key: true
5 |
6 | t.timestamps
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/db/migrate/20201208163624_create_story_stats.rb:
--------------------------------------------------------------------------------
1 | class CreateStoryStats < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :story_stats do |t|
4 | t.integer :stitches
5 | t.integer :with_choice
6 | t.integer :with_condition
7 | t.integer :with_flag
8 | t.float :avg_words
9 | t.integer :total_words
10 | t.integer :advanced_syntax
11 | t.float :score_short
12 | t.float :score_medium
13 | t.float :score_long
14 |
15 | t.timestamps
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/db/migrate/20201208164040_add_foreign_key_to_story_stats.rb:
--------------------------------------------------------------------------------
1 | class AddForeignKeyToStoryStats < ActiveRecord::Migration[5.2]
2 | def change
3 | add_reference :story_stats, :story, foreign_key: true
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20201209165106_add_to_story_stat.rb:
--------------------------------------------------------------------------------
1 | class AddToStoryStat < ActiveRecord::Migration[5.2]
2 | def change
3 | add_column :story_stats, :with_end, :integer
4 | add_column :story_stats, :with_image, :integer
5 | add_column :story_stats, :with_divert, :integer
6 | add_column :story_stats, :with_fake_choice, :integer
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/db/migrate/20201209182413_add_score.rb:
--------------------------------------------------------------------------------
1 | class AddScore < ActiveRecord::Migration[5.2]
2 | def change
3 | remove_column :story_stats, :score_short
4 | remove_column :story_stats, :score_medium
5 | remove_column :story_stats, :score_long
6 | add_column :story_stats, :score, :float
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 2020_12_09_182413) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "admins", force: :cascade do |t|
19 | t.bigint "user_id"
20 | t.datetime "created_at", null: false
21 | t.datetime "updated_at", null: false
22 | t.index ["user_id"], name: "index_admins_on_user_id"
23 | end
24 |
25 | create_table "stories", force: :cascade do |t|
26 | t.bigint "user_id"
27 | t.json "data"
28 | t.datetime "created_at", null: false
29 | t.datetime "updated_at", null: false
30 | t.string "title"
31 | t.integer "url_key"
32 | t.index ["user_id"], name: "index_stories_on_user_id"
33 | end
34 |
35 | create_table "story_stats", force: :cascade do |t|
36 | t.integer "stitches"
37 | t.integer "with_choice"
38 | t.integer "with_condition"
39 | t.integer "with_flag"
40 | t.float "avg_words"
41 | t.integer "total_words"
42 | t.integer "advanced_syntax"
43 | t.datetime "created_at", null: false
44 | t.datetime "updated_at", null: false
45 | t.bigint "story_id"
46 | t.integer "with_end"
47 | t.integer "with_image"
48 | t.integer "with_divert"
49 | t.integer "with_fake_choice"
50 | t.float "score"
51 | t.index ["story_id"], name: "index_story_stats_on_story_id"
52 | end
53 |
54 | create_table "users", force: :cascade do |t|
55 | t.string "email", default: "", null: false
56 | t.string "encrypted_password", default: "", null: false
57 | t.string "reset_password_token"
58 | t.datetime "reset_password_sent_at"
59 | t.datetime "remember_created_at"
60 | t.datetime "created_at", null: false
61 | t.datetime "updated_at", null: false
62 | t.string "authentication_token"
63 | t.index ["authentication_token"], name: "index_users_on_authentication_token"
64 | t.index ["email"], name: "index_users_on_email", unique: true
65 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
66 | end
67 |
68 | add_foreign_key "admins", "users"
69 | add_foreign_key "stories", "users"
70 | add_foreign_key "story_stats", "stories"
71 | end
72 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7 | # Character.create(name: 'Luke', movie: movies.first)
8 |
--------------------------------------------------------------------------------
/db/seeds/development.rb:
--------------------------------------------------------------------------------
1 | user=User.new(
2 | email: "john@the.ripper.com",
3 | password: "john@the.ripper.com"
4 | )
5 | user.save!
6 |
7 | story = user.stories.new(
8 | data: '{"title":"Untitled Story","data":{"stitches":{"onceUponATime":{"content":["Once upon a time...",{"divert":"thereWasAGiantIn"},{"pageNum":1}]},"thereWasAGiantIn":{"content":["There was a giant in the woods."]}},"initial":"onceUponATime","optionMirroring":true,"allowCheckpoints":false,"editorData":{"playPoint":"thereWasAGiantIn","libraryVisible":false,"authorName":"Anonymous","textSize":0}}}',
9 | title: "My first story",
10 | url_key: 1
11 | )
12 | story.save!
--------------------------------------------------------------------------------
/db/seeds/production.rb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/inklewriter/freeinklewriter/ed0a31b40d05d39f05b041188264abf29a902423/db/seeds/production.rb
--------------------------------------------------------------------------------
/db/seeds/test.rb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/inklewriter/freeinklewriter/ed0a31b40d05d39f05b041188264abf29a902423/db/seeds/test.rb
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 |
3 | volumes:
4 | inkledb:
5 |
6 | networks:
7 | inklenet:
8 |
9 | services:
10 |
11 | db:
12 | networks:
13 | - inklenet
14 | env_file: .env
15 | image: postgres
16 | volumes:
17 | - inkledb:/var/lib/postgresql/data/pgdata
18 |
19 | app:
20 | networks:
21 | - inklenet
22 | env_file: .env
23 | build: .
24 | image: albancrommer/inklewriter:latest
25 | volumes:
26 | - .:/usr/src/app
27 | ports:
28 | - "3000:3000"
29 | depends_on:
30 | - db
31 |
32 |
33 |
--------------------------------------------------------------------------------
/entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | # Remove a potentially pre-existing server.pid for Rails.
5 | rm -f /usr/src/app/tmp/pids/server.pid
6 |
7 | # Initialize / update DB
8 | rake db:create db:migrate
9 |
10 | # Then exec the container's main process (what's set as CMD in the Dockerfile).
11 | exec "$@"
12 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/inklewriter/freeinklewriter/ed0a31b40d05d39f05b041188264abf29a902423/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/mailer_previews/custom_devise_mailer_preview.rb:
--------------------------------------------------------------------------------
1 | class CustomDeviseMailerPreview < ActionMailer::Preview
2 |
3 | def password_change
4 | CustomDeviseMailer.password_change(User.all.sample, {})
5 | end
6 |
7 | def reset_password_instructions
8 | CustomDeviseMailer.reset_password_instructions(User.all.sample, "faketoken")
9 | end
10 | end
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/inklewriter/freeinklewriter/ed0a31b40d05d39f05b041188264abf29a902423/lib/tasks/.keep
--------------------------------------------------------------------------------
/lib/tasks/scoring.rake:
--------------------------------------------------------------------------------
1 | desc "Forces a save on all stories to refresh stats and scores"
2 | task :score => :environment do
3 | Story.find_each do |s|
4 | s.save
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/lib/tasks/verify_sanitizing.rake:
--------------------------------------------------------------------------------
1 | desc "Verify that sanitizing does not alter stories JSON"
2 | task :verify_sanitizing => :environment do
3 | mismatches = []
4 | Story.find_each do |s|
5 | unless s.sanitize_s == s.data
6 | mismatches << s.id
7 | end
8 | end
9 | if mismatches.present?
10 | p "These stories show some mismatches"
11 | p mismatches
12 | p "Now let's check all our stories include string