مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
style(rubocop): Style/TrailingCommaInArrayLiteral
هذا الالتزام موجود في:
@@ -125,6 +125,9 @@ Style/MultilineBlockChain:
|
||||
Exclude:
|
||||
- "spec/**/*.rb"
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
||||
|
||||
@@ -45,8 +45,16 @@ class ServersController < ApplicationController
|
||||
extra_params = [:spam_threshold, :spam_failure_threshold, :postmaster_address]
|
||||
|
||||
if current_user.admin?
|
||||
extra_params += [:send_limit, :allow_sender, :privacy_mode, :log_smtp_data, :outbound_spam_threshold,
|
||||
:message_retention_days, :raw_message_retention_days, :raw_message_retention_size]
|
||||
extra_params += [
|
||||
:send_limit,
|
||||
:allow_sender,
|
||||
:privacy_mode,
|
||||
:log_smtp_data,
|
||||
:outbound_spam_threshold,
|
||||
:message_retention_days,
|
||||
:raw_message_retention_days,
|
||||
:raw_message_retention_size,
|
||||
]
|
||||
end
|
||||
|
||||
if @server.update(safe_params(*extra_params))
|
||||
|
||||
@@ -111,9 +111,11 @@ class DNSResolver
|
||||
def dns(raise_timeout_errors: false)
|
||||
Resolv::DNS.open(nameserver: @nameservers,
|
||||
raise_timeout_errors: raise_timeout_errors) do |dns|
|
||||
dns.timeouts = [Postal::Config.dns.timeout,
|
||||
dns.timeouts = [
|
||||
Postal::Config.dns.timeout,
|
||||
Postal::Config.dns.timeout / 2,
|
||||
Postal::Config.dns.timeout / 2]
|
||||
Postal::Config.dns.timeout / 2,
|
||||
]
|
||||
yield dns
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ class ReplySeparator
|
||||
/^>*\s*On.{10,200}wrote:\s*$.*/m,
|
||||
/^>*\s*Sent from my.*/m,
|
||||
/^>*\s*=== Please reply above this line ===.*/m,
|
||||
/(^>.*\n?){10,}/
|
||||
/(^>.*\n?){10,}/,
|
||||
].freeze
|
||||
|
||||
def self.separate(text)
|
||||
|
||||
@@ -155,7 +155,7 @@ module SMTPServer
|
||||
[
|
||||
"250-My capabilities are",
|
||||
Postal::Config.smtp_server.tls_enabled? && !@tls ? "250-STARTTLS" : nil,
|
||||
"250 AUTH CRAM-MD5 PLAIN LOGIN"
|
||||
"250 AUTH CRAM-MD5 PLAIN LOGIN",
|
||||
].compact
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ module Worker
|
||||
# @return [Array<Class>]
|
||||
JOBS = [
|
||||
Jobs::ProcessQueuedMessagesJob,
|
||||
Jobs::ProcessWebhookRequestsJob
|
||||
Jobs::ProcessWebhookRequestsJob,
|
||||
].freeze
|
||||
|
||||
# An array of tasks that should be processed
|
||||
@@ -41,7 +41,7 @@ module Worker
|
||||
PruneSuppressionListsScheduledTask,
|
||||
PruneWebhookRequestsScheduledTask,
|
||||
SendNotificationsScheduledTask,
|
||||
TidyQueuedMessagesTask
|
||||
TidyQueuedMessagesTask,
|
||||
].freeze
|
||||
|
||||
# @param [Integer] thread_count The number of worker threads to run in this process
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
# 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
|
||||
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn,
|
||||
]
|
||||
|
||||
@@ -66,7 +66,7 @@ RSpec.describe DNSResolver do
|
||||
it "returns a list of TXT records" do
|
||||
expect(resolver.txt("dnstest.postalserver.io").sort).to eq [
|
||||
"an example txt record",
|
||||
"another example"
|
||||
"another example",
|
||||
]
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ RSpec.describe DNSResolver do
|
||||
it "returns a list of TXT records" do
|
||||
expect(resolver.txt("dnstest.postalserver.io", raise_timeout_errors: true).sort).to eq [
|
||||
"an example txt record",
|
||||
"another example"
|
||||
"another example",
|
||||
]
|
||||
end
|
||||
|
||||
@@ -120,7 +120,7 @@ RSpec.describe DNSResolver do
|
||||
it "returns a list of MX records" do
|
||||
expect(resolver.mx("dnstest.postalserver.io")).to eq [
|
||||
[10, "mx1.dnstest.postalserver.io"],
|
||||
[20, "mx2.dnstest.postalserver.io"]
|
||||
[20, "mx2.dnstest.postalserver.io"],
|
||||
]
|
||||
end
|
||||
|
||||
@@ -133,7 +133,7 @@ RSpec.describe DNSResolver do
|
||||
it "returns a list of MX records" do
|
||||
expect(resolver.mx("dnstest.postalserver.io", raise_timeout_errors: true)).to eq [
|
||||
[10, "mx1.dnstest.postalserver.io"],
|
||||
[20, "mx2.dnstest.postalserver.io"]
|
||||
[20, "mx2.dnstest.postalserver.io"],
|
||||
]
|
||||
end
|
||||
|
||||
@@ -150,7 +150,7 @@ RSpec.describe DNSResolver do
|
||||
it "returns the nameserver names that are authoritative for the given domain" do
|
||||
expect(resolver.effective_ns("postalserver.io").sort).to eq [
|
||||
"prestigious-honeybadger.katapultdns.com",
|
||||
"the-cake-is-a-lie.katapultdns.com"
|
||||
"the-cake-is-a-lie.katapultdns.com",
|
||||
]
|
||||
end
|
||||
|
||||
@@ -163,7 +163,7 @@ RSpec.describe DNSResolver do
|
||||
it "returns a list of NS records" do
|
||||
expect(resolver.effective_ns("postalserver.io", raise_timeout_errors: true).sort).to eq [
|
||||
"prestigious-honeybadger.katapultdns.com",
|
||||
"the-cake-is-a-lie.katapultdns.com"
|
||||
"the-cake-is-a-lie.katapultdns.com",
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ module Postal
|
||||
it "returns a value for postal.smtp_relays" do
|
||||
expect(config.postal.smtp_relays).to eq [
|
||||
{ "host" => "1.2.3.4", "port" => 25, "ssl_mode" => "Auto" },
|
||||
{ "host" => "2.2.2.2", "port" => 2525, "ssl_mode" => "None" }
|
||||
{ "host" => "2.2.2.2", "port" => 2525, "ssl_mode" => "None" },
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ module SMTPClient
|
||||
have_attributes(ip_address: "2a00::67a0:a::1234"),
|
||||
have_attributes(ip_address: "2a00::67a0:a::2345"),
|
||||
have_attributes(ip_address: "1.2.3.4"),
|
||||
have_attributes(ip_address: "2.3.4.5")
|
||||
have_attributes(ip_address: "2.3.4.5"),
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -43,7 +43,7 @@ module SMTPClient
|
||||
it "returns ipv4 endpoints" do
|
||||
expect(server.endpoints).to match [
|
||||
have_attributes(ip_address: "1.2.3.4"),
|
||||
have_attributes(ip_address: "2.3.4.5")
|
||||
have_attributes(ip_address: "2.3.4.5"),
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -57,7 +57,7 @@ module SMTPClient
|
||||
it "returns ipv6 endpoints" do
|
||||
expect(server.endpoints).to match [
|
||||
have_attributes(ip_address: "2a00::67a0:a::1234"),
|
||||
have_attributes(ip_address: "2a00::67a0:a::2345")
|
||||
have_attributes(ip_address: "2a00::67a0:a::2345"),
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ module SMTPServer
|
||||
describe "EHLO" do
|
||||
it "returns the capabilities" do
|
||||
expect(client.handle("EHLO test.example.com")).to eq ["250-My capabilities are",
|
||||
"250 AUTH CRAM-MD5 PLAIN LOGIN"]
|
||||
"250 AUTH CRAM-MD5 PLAIN LOGIN",]
|
||||
end
|
||||
|
||||
context "when TLS is enabled" do
|
||||
@@ -27,7 +27,7 @@ module SMTPServer
|
||||
allow(Postal::Config.smtp_server).to receive(:tls_enabled?).and_return(true)
|
||||
expect(client.handle("EHLO test.example.com")).to eq ["250-My capabilities are",
|
||||
"250-STARTTLS",
|
||||
"250 AUTH CRAM-MD5 PLAIN LOGIN"]
|
||||
"250 AUTH CRAM-MD5 PLAIN LOGIN",]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -209,7 +209,7 @@ describe Domain do
|
||||
"postmaster@example.com",
|
||||
"admin@example.com",
|
||||
"administrator@example.com",
|
||||
"hostmaster@example.com"
|
||||
"hostmaster@example.com",
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -180,8 +180,10 @@ RSpec.describe SMTPSender do
|
||||
|
||||
it "includes both endpoints in the array of endpoints tried" do
|
||||
sender.start
|
||||
expect(sender.endpoints).to match([have_attributes(ip_address: "1.2.3.4"),
|
||||
have_attributes(ip_address: "2.3.4.5")])
|
||||
expect(sender.endpoints).to match([
|
||||
have_attributes(ip_address: "1.2.3.4"),
|
||||
have_attributes(ip_address: "2.3.4.5"),
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم