1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2025-12-01 05:43:04 +00:00

chore: upgrade rails to 7.0 and other dependencies

هذا الالتزام موجود في:
Adam Cooke
2024-02-23 14:24:17 +00:00
ملتزم من قبل Adam Cooke
الأصل cfc1c9b73e
التزام ecd09a2445
27 ملفات معدلة مع 439 إضافات و250 حذوفات

12
Gemfile
عرض الملف

@@ -3,15 +3,12 @@
source "https://rubygems.org"
gem "authie"
gem "autoprefixer-rails"
gem "basic_ssl"
gem "bcrypt"
gem "changey"
gem "chronic"
gem "dotenv-rails"
gem "dynamic_form"
gem "encrypto_signo"
gem "execjs", "~> 2.7", "< 2.8"
gem "foreman"
gem "gelf"
gem "haml"
gem "hashie"
@@ -26,11 +23,10 @@ gem "nifty-utils"
gem "nilify_blanks"
gem "nio4r"
gem "puma"
gem "rails", "= 6.1.7.6"
gem "resolv", "~> 0.2.1"
gem "rails", "= 7.0.8.1"
gem "resolv"
gem "secure_headers"
gem "sentry-rails"
gem "sentry-ruby"
gem "turbolinks", "~> 5"
group :development, :assets do
@@ -40,10 +36,6 @@ group :development, :assets do
gem "uglifier", ">= 1.3.0"
end
group :development, :test do
gem "byebug"
end
group :development do
gem "annotate"
gem "database_cleaner", require: false

عرض الملف

@@ -1,82 +1,85 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (>= 2.7.1)
actionmailer (6.1.7.6)
actionpack (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activesupport (= 6.1.7.6)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.6)
actionview (= 6.1.7.6)
activesupport (= 6.1.7.6)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.6)
actionpack (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.6)
activesupport (= 6.1.7.6)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.6)
activesupport (= 6.1.7.6)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.3.6)
activemodel (6.1.7.6)
activesupport (= 6.1.7.6)
activerecord (6.1.7.6)
activemodel (= 6.1.7.6)
activesupport (= 6.1.7.6)
activestorage (6.1.7.6)
actionpack (= 6.1.7.6)
activejob (= 6.1.7.6)
activerecord (= 6.1.7.6)
activesupport (= 6.1.7.6)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.6)
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0)
ast (2.4.2)
authie (3.4.0)
secure_random_string
authie (4.1.3)
activerecord (>= 6.1, < 8.0)
autoprefixer-rails (10.4.13.0)
execjs (~> 2)
basic_ssl (1.0.3)
bcrypt (3.1.18)
base64 (0.2.0)
bcrypt (3.1.20)
bigdecimal (3.1.6)
builder (3.2.4)
byebug (11.1.3)
changey (1.1.0)
activerecord (>= 4.2, < 7)
chronic (0.10.2)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
@@ -96,13 +99,13 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.3)
date (3.3.4)
deep_merge (1.2.2)
diff-lcs (1.5.0)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
dotenv (3.0.2)
dotenv-rails (3.0.2)
dotenv (= 3.0.2)
railties (>= 6.1)
dynamic_form (1.3.1)
actionview (> 5.2.0)
activemodel (> 5.2.0)
@@ -115,12 +118,11 @@ GEM
factory_bot (~> 6.4)
railties (>= 5.0.0)
ffi (1.15.5)
foreman (0.87.2)
gelf (3.1.0)
json
globalid (1.2.1)
activesupport (>= 6.1)
haml (6.1.1)
haml (6.3.0)
temple (>= 0.8.2)
thor
tilt
@@ -134,7 +136,8 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.6.3)
jwt (2.7.0)
jwt (2.8.0)
base64
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
@@ -161,22 +164,22 @@ GEM
net-smtp
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.22.2)
moonrope (2.0.2)
deep_merge (~> 1.0)
json
rack (>= 1.4)
mysql2 (0.5.5)
net-imap (0.3.4)
mysql2 (0.5.6)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
net-protocol (0.2.2)
timeout
net-smtp (0.3.3)
net-smtp (0.4.0.1)
net-protocol
nifty-utils (1.1.7)
nilify_blanks (1.4.0)
@@ -197,24 +200,23 @@ GEM
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8)
rack (2.2.8.1)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.6)
actioncable (= 6.1.7.6)
actionmailbox (= 6.1.7.6)
actionmailer (= 6.1.7.6)
actionpack (= 6.1.7.6)
actiontext (= 6.1.7.6)
actionview (= 6.1.7.6)
activejob (= 6.1.7.6)
activemodel (= 6.1.7.6)
activerecord (= 6.1.7.6)
activestorage (= 6.1.7.6)
activesupport (= 6.1.7.6)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
bundler (>= 1.15.0)
railties (= 6.1.7.6)
sprockets-rails (>= 2.0.0)
railties (= 7.0.8.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
@@ -222,16 +224,17 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.6)
actionpack (= 6.1.7.6)
activesupport (= 6.1.7.6)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.1.0)
regexp_parser (2.7.0)
resolv (0.2.2)
resolv (0.3.0)
rexml (3.2.5)
rouge (4.2.0)
rspec (3.12.0)
@@ -283,11 +286,10 @@ GEM
sprockets-rails
tilt
secure_headers (6.5.0)
secure_random_string (1.0.0)
sentry-rails (5.8.0)
sentry-rails (5.16.1)
railties (>= 5.0)
sentry-ruby (~> 5.8.0)
sentry-ruby (5.8.0)
sentry-ruby (~> 5.16.1)
sentry-ruby (5.16.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
shoulda-matchers (6.1.0)
activesupport (>= 5.2.0)
@@ -298,11 +300,11 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
temple (0.10.0)
temple (0.10.3)
thor (1.3.0)
tilt (2.1.0)
tilt (2.3.0)
timecop (0.9.8)
timeout (0.3.2)
timeout (0.4.1)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
@@ -330,10 +332,7 @@ DEPENDENCIES
annotate
authie
autoprefixer-rails
basic_ssl
bcrypt
byebug
changey
chronic
coffee-rails (~> 5.0)
database_cleaner
@@ -342,7 +341,6 @@ DEPENDENCIES
encrypto_signo
execjs (~> 2.7, < 2.8)
factory_bot_rails
foreman
gelf
haml
hashie
@@ -358,8 +356,8 @@ DEPENDENCIES
nilify_blanks
nio4r
puma
rails (= 6.1.7.6)
resolv (~> 0.2.1)
rails (= 7.0.8.1)
resolv
rspec
rspec-rails
rubocop
@@ -367,7 +365,6 @@ DEPENDENCIES
sass-rails
secure_headers
sentry-rails
sentry-ruby
shoulda-matchers
timecop
turbolinks (~> 5)

عرض الملف

@@ -109,7 +109,8 @@ class ApplicationController < ActionController::Base
auth_session.invalidate!
reset_session
end
Authie::Session.start(self, user: user)
create_auth_session(user)
@current_user = user
end

عرض الملف

@@ -19,7 +19,7 @@ class MessagesController < ApplicationController
@message.from = "test@#{domain.name}"
end
end
@message.subject = "Test Message at #{Time.zone.now.to_s(:long)}"
@message.subject = "Test Message at #{Time.zone.now.to_fs(:long)}"
@message.plain_body = "This is a message to test the delivery of messages through Postal."
end

عرض الملف

@@ -8,13 +8,7 @@ module HasAuthentication
has_secure_password
validates :password, length: { minimum: 8, allow_blank: true }
when_attribute :password_digest, changes_to: :anything do
before_save do
self.password_reset_token = nil
self.password_reset_token_valid_until = nil
end
end
before_save :clear_password_reset_token_on_password_change
end
class_methods do
@@ -42,6 +36,15 @@ module HasAuthentication
AppMailer.password_reset(self, return_to).deliver
end
private
def clear_password_reset_token_on_password_change
return unless password_digest_changed?
self.password_reset_token = nil
self.password_reset_token_valid_until = nil
end
end
# -*- SkipSchemaAnnotations

عرض الملف

@@ -39,7 +39,7 @@ class Credential < ApplicationRecord
return if type == "SMTP-IP"
return if persisted?
self.key = SecureRandomString.new(24)
self.key = SecureRandom.alphanumeric(24)
end
def to_param

عرض الملف

@@ -61,17 +61,7 @@ class Domain < ApplicationRecord
scope :verified, -> { where.not(verified_at: nil) }
when_attribute :verification_method, changes_to: :anything do
before_save do
if verification_method == "DNS"
self.verification_token = Nifty::Utils::RandomString.generate(length: 32)
elsif verification_method == "Email"
self.verification_token = rand(999_999).to_s.ljust(6, "0")
else
self.verification_token = nil
end
end
end
before_save :update_verification_token_on_method_change
def verified?
verified_at.present?
@@ -168,4 +158,18 @@ class Domain < ApplicationRecord
false
end
private
def update_verification_token_on_method_change
return unless verification_method_changed?
if verification_method == "DNS"
self.verification_token = Nifty::Utils::RandomString.generate(length: 32)
elsif verification_method == "Email"
self.verification_token = rand(999_999).to_s.ljust(6, "0")
else
self.verification_token = nil
end
end
end

عرض الملف

@@ -35,12 +35,7 @@ class Webhook < ApplicationRecord
scope :enabled, -> { where(enabled: true) }
after_save :save_events
when_attribute :all_events, changes_to: true do
after_save do
webhook_events.destroy_all
end
end
after_save :destroy_events_when_all_events_enabled
def events
@events ||= webhook_events.map(&:event)
@@ -50,13 +45,22 @@ class Webhook < ApplicationRecord
@events = value.map(&:to_s).select(&:present?)
end
private
def save_events
return unless @events
@events.each do |event|
webhook_events.where(event: event).first_or_create!
end
webhook_events.where.not(event: @events).destroy_all
end
def destroy_events_when_all_events_enabled
return unless all_events
webhook_events.destroy_all
end
end

عرض الملف

@@ -63,7 +63,7 @@
%ul.domainList__properties
- if domain.verified?
%li.domainList__verificationTime Verified on #{domain.verified_at.to_s(:long)}
%li.domainList__verificationTime Verified on #{domain.verified_at.to_fs(:long)}
- else
%li= link_to "Verify this domain", [:verify, organization, @server, domain], :class => "domainList__verificationLink"
%li.domainList__links

عرض الملف

@@ -11,7 +11,7 @@
%p
This message has been held. By releasing the message, we will allow it to continue on its way to its destination.
- if @message.hold_expiry
It will be held until #{@message.hold_expiry.to_s(:long)}.
It will be held until #{@message.hold_expiry.to_fs(:long)}.
%p.buttonSet
= link_to "Release message", retry_organization_server_message_path(organization, @server, message.id), :class => "button button--small", :remote => true, :method => :post
= link_to "Cancel hold", cancel_hold_organization_server_message_path(organization, @server, message.id), :class => "button button--small button--danger", :remote => true, :method => :post
@@ -33,7 +33,7 @@
%li.deliveryList__item
.deliveryList__top
.deliveryList__time
= delivery.timestamp.to_s(:long)
= delivery.timestamp.to_fs(:long)
.deliveryList__status
- if delivery.sent_with_ssl
= image_tag 'icons/lock.svg', :class => 'deliveryList__secure'

عرض الملف

@@ -17,7 +17,7 @@
%dd= message.mail_from || "none"
.messageList__meta
%p.messageList__timestamp= message.timestamp.in_time_zone.to_s(:long)
%p.messageList__timestamp= message.timestamp.in_time_zone.to_fs(:long)
%p.messageList__status
- if message.read?
%span.label.label--purple Opened

عرض الملف

@@ -23,7 +23,7 @@
= link_to @message.rcpt_to || "[blank]", send("#{@message.scope}_organization_server_messages_path", organization, @server, :query => "to: #{@message.rcpt_to}"), :class => 'u-link'
%dl
%dt Received
%dd= @message.timestamp.in_time_zone.to_s(:long)
%dd= @message.timestamp.in_time_zone.to_fs(:long)
.navBar.navBar--tertiary
%ul

عرض الملف

@@ -11,7 +11,7 @@
- for entry in @entries.reverse
- if entry.is_a?(Postal::MessageDB::Delivery)
%li.messageActivity__event
%p.messageActivity__timestamp= entry.timestamp.to_s(:long)
%p.messageActivity__timestamp= entry.timestamp.to_fs(:long)
.messageActivity__details.messageActivity--detailsDelivery
%p.messageActivity__subject
=# entry.status.underscore.humanize
@@ -21,20 +21,20 @@
- elsif entry.is_a?(Postal::MessageDB::Click)
%li.messageActivity__event
%p.messageActivity__timestamp= entry.timestamp.to_s(:long)
%p.messageActivity__timestamp= entry.timestamp.to_fs(:long)
.messageActivity__details.messageActivity--detailsClick
%p.messageActivity__subject Click for #{entry.url}
%p.messageActivity__extra Clicked from #{entry.ip_address} (#{entry.user_agent})
- elsif entry.is_a?(Postal::MessageDB::Load)
%li.messageActivity__event
%p.messageActivity__timestamp= entry.timestamp.to_s(:long)
%p.messageActivity__timestamp= entry.timestamp.to_fs(:long)
.messageActivity__details.messageActivity--detailsLoad
%p.messageActivity__subject Message Viewed
%p.messageActivity__extra Opened from #{entry.ip_address} (#{entry.user_agent})
%li.messageActivity__event
%p.messageActivity__timestamp= @message.timestamp.to_s(:long)
%p.messageActivity__timestamp= @message.timestamp.to_fs(:long)
.messageActivity__details
%p.messageActivity__subject
Message received by Postal

عرض الملف

@@ -22,9 +22,9 @@
%p.suppressionList__address= link_to suppression['address'], outgoing_organization_server_messages_path(organization, @server, :query => "to: #{suppression['address']}")
%p.suppressionList__reason= suppression['reason'].capitalize
.suppressionList__right
%p.suppressionList__timestamp Added #{Time.zone.at(suppression['timestamp']).to_s(:long)}
%p.suppressionList__timestamp Added #{Time.zone.at(suppression['timestamp']).to_fs(:long)}
%p.suppressionList__timestamp
Expires #{Time.zone.at(suppression['keep_until']).to_s(:long)}
Expires #{Time.zone.at(suppression['keep_until']).to_fs(:long)}
- if suppression['keep_until'] < Time.now.to_f
%span.u-red expired
= render 'shared/message_db_pagination', :data => @suppressions, :name => "suppression"

عرض الملف

@@ -35,7 +35,7 @@
%li #{@first_date.strftime("%A at %l%P")} &rarr;
%li Today at #{Time.now.strftime("%l%P")}
- else
%li #{@first_date.to_date.to_s(:long)} &rarr;
%li #{@first_date.to_date.to_fs(:long)} &rarr;
%li Today
.titleWithLinks.u-margin
@@ -44,4 +44,3 @@
%li= link_to "View message queue", [:queue, organization, @server], :class => 'titleWithLinks__link'
%li= link_to "View full e-mail history", [:outgoing, organization, @server, :messages], :class => 'titleWithLinks__link'
= render 'messages/list', :messages => @messages

عرض الملف

@@ -17,7 +17,7 @@ Bundler.require(*Rails.groups)
module Postal
class Application < Rails::Application
config.load_defaults 6.0
config.load_defaults 7.0
# Disable most generators
config.generators do |g|

عرض الملف

@@ -2,9 +2,6 @@
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
$stdout.sync = true
$stderr.sync = true
require "bundler/setup" # Set up gems listed in the Gemfile.
require_relative "../lib/postal/config"

عرض الملف

@@ -0,0 +1,26 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap and inline scripts
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end

عرض الملف

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

عرض الملف

@@ -1,23 +0,0 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = true
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = true
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = false

عرض الملف

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

عرض الملف

@@ -0,0 +1,12 @@
# frozen_string_literal: true
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# end

عرض الملف

@@ -0,0 +1,10 @@
# frozen_string_literal: true
# This migration comes from authie (originally 20220502180100)
class AddTwoFactorRequiredToSessions < ActiveRecord::Migration[6.1]
def change
add_column :authie_sessions, :skip_two_factor, :boolean, default: false
end
end

عرض الملف

@@ -0,0 +1,12 @@
# frozen_string_literal: true
# This migration comes from authie (originally 20230627165500)
class AddCountriesToAuthieSessions < ActiveRecord::Migration[6.1]
def change
add_column :authie_sessions, :login_ip_country, :string
add_column :authie_sessions, :two_factored_ip_country, :string
add_column :authie_sessions, :last_activity_ip_country, :string
end
end

عرض الملف

@@ -10,23 +10,22 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2024_02_14_132253) do
ActiveRecord::Schema[7.0].define(version: 2024_02_23_141501) do
create_table "additional_route_endpoints", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "route_id"
t.string "endpoint_type"
t.integer "endpoint_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "address_endpoints", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "server_id"
t.string "uuid"
t.string "address"
t.datetime "last_used_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "last_used_at", precision: nil
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "authie_sessions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
@@ -35,23 +34,27 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.integer "user_id"
t.boolean "active", default: true
t.text "data"
t.datetime "expires_at"
t.datetime "login_at"
t.datetime "expires_at", precision: nil
t.datetime "login_at", precision: nil
t.string "login_ip"
t.datetime "last_activity_at"
t.datetime "last_activity_at", precision: nil
t.string "last_activity_ip"
t.string "last_activity_path"
t.string "user_agent"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.string "user_type"
t.integer "parent_id"
t.datetime "two_factored_at"
t.datetime "two_factored_at", precision: nil
t.string "two_factored_ip"
t.integer "requests", default: 0
t.datetime "password_seen_at"
t.datetime "password_seen_at", precision: nil
t.string "token_hash"
t.string "host"
t.boolean "skip_two_factor", default: false
t.string "login_ip_country"
t.string "two_factored_ip_country"
t.string "last_activity_ip_country"
t.index ["browser_id"], name: "index_authie_sessions_on_browser_id", length: 8
t.index ["token"], name: "index_authie_sessions_on_token", length: 8
t.index ["token_hash"], name: "index_authie_sessions_on_token_hash", length: 8
@@ -64,9 +67,9 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "type"
t.string "name"
t.text "options"
t.datetime "last_used_at", precision: 6
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "last_used_at"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "hold", default: false
t.string "uuid"
end
@@ -77,11 +80,11 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "name"
t.string "verification_token"
t.string "verification_method"
t.datetime "verified_at"
t.datetime "verified_at", precision: nil
t.text "dkim_private_key"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "dns_checked_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "dns_checked_at"
t.string "spf_status"
t.string "spf_error"
t.string "dkim_status"
@@ -109,10 +112,10 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "format"
t.boolean "strip_replies", default: false
t.text "error"
t.datetime "disabled_until", precision: 6
t.datetime "last_used_at", precision: 6
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "disabled_until"
t.datetime "last_used_at"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "include_attachments", default: true
t.integer "timeout"
end
@@ -121,8 +124,8 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.integer "ip_pool_id"
t.string "ipv4"
t.string "ipv6"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.string "hostname"
t.integer "priority"
end
@@ -134,15 +137,15 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.integer "ip_pool_id"
t.text "from_text"
t.text "to_text"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "ip_pools", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "name"
t.string "uuid"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "default", default: false
t.index ["uuid"], name: "index_ip_pools_on_uuid", length: 8
end
@@ -150,14 +153,14 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
create_table "organization_ip_pools", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "organization_id"
t.integer "ip_pool_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "organization_users", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "organization_id"
t.integer "user_id"
t.datetime "created_at", precision: 6
t.datetime "created_at"
t.boolean "admin", default: false
t.boolean "all_servers", default: true
t.string "user_type"
@@ -168,12 +171,12 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "name"
t.string "permalink"
t.string "time_zone"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.integer "ip_pool_id"
t.integer "owner_id"
t.datetime "deleted_at", precision: 6
t.datetime "suspended_at", precision: 6
t.datetime "deleted_at"
t.datetime "suspended_at"
t.string "suspension_reason"
t.index ["permalink"], name: "index_organizations_on_permalink", length: 8
t.index ["uuid"], name: "index_organizations_on_uuid", length: 8
@@ -184,10 +187,10 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.integer "message_id"
t.string "domain"
t.string "locked_by"
t.datetime "locked_at", precision: 6
t.datetime "retry_after"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "locked_at"
t.datetime "retry_after", precision: nil
t.datetime "created_at"
t.datetime "updated_at"
t.integer "ip_address_id"
t.integer "attempts", default: 0
t.integer "route_id"
@@ -206,8 +209,8 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "endpoint_type"
t.string "name"
t.string "spam_mode"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.string "token"
t.string "mode"
t.index ["token"], name: "index_routes_on_token", length: 6
@@ -215,7 +218,7 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
create_table "scheduled_tasks", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "name"
t.datetime "next_run_after"
t.datetime "next_run_after", precision: nil
t.index ["name"], name: "index_scheduled_tasks_on_name", unique: true
end
@@ -225,24 +228,24 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "name"
t.string "mode"
t.integer "ip_pool_id"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.string "permalink"
t.integer "send_limit"
t.datetime "deleted_at", precision: 6
t.datetime "deleted_at"
t.integer "message_retention_days"
t.integer "raw_message_retention_days"
t.integer "raw_message_retention_size"
t.boolean "allow_sender", default: false
t.string "token"
t.datetime "send_limit_approaching_at", precision: 6
t.datetime "send_limit_approaching_notified_at", precision: 6
t.datetime "send_limit_exceeded_at", precision: 6
t.datetime "send_limit_exceeded_notified_at", precision: 6
t.datetime "send_limit_approaching_at"
t.datetime "send_limit_approaching_notified_at"
t.datetime "send_limit_exceeded_at"
t.datetime "send_limit_exceeded_notified_at"
t.decimal "spam_threshold", precision: 8, scale: 2
t.decimal "spam_failure_threshold", precision: 8, scale: 2
t.string "postmaster_address"
t.datetime "suspended_at", precision: 6
t.datetime "suspended_at"
t.decimal "outbound_spam_threshold", precision: 8, scale: 2
t.text "domains_not_to_click_track"
t.string "suspension_reason"
@@ -262,10 +265,10 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "ssl_mode"
t.integer "port"
t.text "error"
t.datetime "disabled_until", precision: 6
t.datetime "last_used_at", precision: 6
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "disabled_until"
t.datetime "last_used_at"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "statistics", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
@@ -279,12 +282,12 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.text "certificate"
t.text "intermediaries"
t.text "key"
t.datetime "expires_at"
t.datetime "renew_after"
t.datetime "expires_at", precision: nil
t.datetime "renew_after", precision: nil
t.string "verification_path"
t.string "verification_string"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["domain"], name: "index_track_certificates_on_domain", length: 8
end
@@ -293,11 +296,11 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.integer "server_id"
t.integer "domain_id"
t.string "name"
t.datetime "dns_checked_at"
t.datetime "dns_checked_at", precision: nil
t.string "dns_status"
t.string "dns_error"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.boolean "ssl_enabled", default: true
t.boolean "track_clicks", default: true
t.boolean "track_loads", default: true
@@ -307,9 +310,9 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
create_table "user_invites", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "uuid"
t.string "email_address"
t.datetime "expires_at", precision: 6
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "expires_at"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["uuid"], name: "index_user_invites_on_uuid", length: 12
end
@@ -321,11 +324,11 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "password_digest"
t.string "time_zone"
t.string "email_verification_token"
t.datetime "email_verified_at"
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "email_verified_at", precision: nil
t.datetime "created_at"
t.datetime "updated_at"
t.string "password_reset_token"
t.datetime "password_reset_token_valid_until"
t.datetime "password_reset_token_valid_until", precision: nil
t.boolean "admin", default: false
t.index ["email_address"], name: "index_users_on_email_address", length: 8
t.index ["uuid"], name: "index_users_on_uuid", length: 8
@@ -334,7 +337,7 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
create_table "webhook_events", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.integer "webhook_id"
t.string "event"
t.datetime "created_at", precision: 6
t.datetime "created_at"
t.index ["webhook_id"], name: "index_webhook_events_on_webhook_id"
end
@@ -346,11 +349,11 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "uuid"
t.text "payload"
t.integer "attempts", default: 0
t.datetime "retry_after", precision: 6
t.datetime "retry_after"
t.text "error"
t.datetime "created_at", precision: 6
t.datetime "created_at"
t.string "locked_by"
t.datetime "locked_at"
t.datetime "locked_at", precision: nil
t.index ["locked_by"], name: "index_webhook_requests_on_locked_by"
end
@@ -359,19 +362,19 @@ ActiveRecord::Schema.define(version: 2024_02_14_132253) do
t.string "uuid"
t.string "name"
t.string "url"
t.datetime "last_used_at"
t.datetime "last_used_at", precision: nil
t.boolean "all_events", default: false
t.boolean "enabled", default: true
t.boolean "sign", default: true
t.datetime "created_at", precision: 6
t.datetime "updated_at", precision: 6
t.datetime "created_at"
t.datetime "updated_at"
t.index ["server_id"], name: "index_webhooks_on_server_id"
end
create_table "worker_roles", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
t.string "role"
t.string "worker"
t.datetime "acquired_at"
t.datetime "acquired_at", precision: nil
t.index ["role"], name: "index_worker_roles_on_role", unique: true
end

عرض الملف

@@ -1,4 +1,7 @@
# frozen_string_literal: true
$stdout.sync = true
$stderr.sync = true
require_relative "../config/environment"
SMTPServer::Server.new(debug: true).run

عرض الملف

@@ -1,5 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$stdout.sync = true
$stderr.sync = true
require_relative "../config/environment"
Worker::Process.new.run