مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
style(rubocop): Lint/IneffectiveAccessModifier
هذا الالتزام موجود في:
@@ -68,7 +68,9 @@ class IPPoolRule < ApplicationRecord
|
|||||||
errors.add :ip_pool_id, "must belong to the organization"
|
errors.add :ip_pool_id, "must belong to the organization"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.address_matches?(condition, address)
|
class << self
|
||||||
|
|
||||||
|
def address_matches?(condition, address)
|
||||||
address = Postal::Helpers.strip_name_from_address(address)
|
address = Postal::Helpers.strip_name_from_address(address)
|
||||||
if condition =~ /@/
|
if condition =~ /@/
|
||||||
parts = address.split("@")
|
parts = address.split("@")
|
||||||
@@ -83,3 +85,5 @@ class IPPoolRule < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|||||||
@@ -219,7 +219,9 @@ class Route < ApplicationRecord
|
|||||||
errors.add :base, "Additional routes are not permitted unless the primary route is an actual endpoint"
|
errors.add :base, "Additional routes are not permitted unless the primary route is an actual endpoint"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_name_and_domain(name, domain)
|
class << self
|
||||||
|
|
||||||
|
def find_by_name_and_domain(name, domain)
|
||||||
route = Route.includes(:domain).where(name: name, domains: { name: domain }).first
|
route = Route.includes(:domain).where(name: name, domains: { name: domain }).first
|
||||||
if route.nil?
|
if route.nil?
|
||||||
route = Route.includes(:domain).where(name: "*", domains: { name: domain }).first
|
route = Route.includes(:domain).where(name: "*", domains: { name: domain }).first
|
||||||
@@ -228,3 +230,5 @@ class Route < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|||||||
@@ -252,7 +252,9 @@ module Postal
|
|||||||
records.first&.address&.to_s&.downcase
|
records.first&.address&.to_s&.downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.ssl_context_with_verify
|
class << self
|
||||||
|
|
||||||
|
def ssl_context_with_verify
|
||||||
@ssl_context_with_verify ||= begin
|
@ssl_context_with_verify ||= begin
|
||||||
c = OpenSSL::SSL::SSLContext.new
|
c = OpenSSL::SSL::SSLContext.new
|
||||||
c.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
c.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||||
@@ -262,7 +264,7 @@ module Postal
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.ssl_context_without_verify
|
def ssl_context_without_verify
|
||||||
@ssl_context_without_verify ||= begin
|
@ssl_context_without_verify ||= begin
|
||||||
c = OpenSSL::SSL::SSLContext.new
|
c = OpenSSL::SSL::SSLContext.new
|
||||||
c.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
c.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||||
@@ -270,11 +272,11 @@ module Postal
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.default_helo_hostname
|
def default_helo_hostname
|
||||||
Postal.config.dns.helo_hostname || Postal.config.dns.smtp_server_hostname || "localhost"
|
Postal.config.dns.helo_hostname || Postal.config.dns.smtp_server_hostname || "localhost"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.relay_hosts
|
def relay_hosts
|
||||||
hosts = Postal.config.smtp_relays.map do |relay|
|
hosts = Postal.config.smtp_relays.map do |relay|
|
||||||
next unless relay.hostname.present?
|
next unless relay.hostname.present?
|
||||||
|
|
||||||
@@ -288,4 +290,6 @@ module Postal
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -195,22 +195,26 @@ module Postal
|
|||||||
self.class.logger
|
self.class.logger
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.logger
|
class << self
|
||||||
|
|
||||||
|
def logger
|
||||||
Postal.logger_for(:worker)
|
Postal.logger_for(:worker)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.job_channel
|
def job_channel
|
||||||
@channel ||= Postal::RabbitMQ.create_channel
|
@channel ||= Postal::RabbitMQ.create_channel
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.job_queue(name)
|
def job_queue(name)
|
||||||
@job_queues ||= {}
|
@job_queues ||= {}
|
||||||
@job_queues[name] ||= job_channel.queue("deliver-jobs-#{name}", durable: true, arguments: { "x-message-ttl" => 60_000 })
|
@job_queues[name] ||= job_channel.queue("deliver-jobs-#{name}", durable: true, arguments: { "x-message-ttl" => 60_000 })
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.local_ip?(ip)
|
def local_ip?(ip)
|
||||||
!!(ip =~ /\A(127\.|fe80:|::)/)
|
!!(ip =~ /\A(127\.|fe80:|::)/)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم