مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
style(rubocop): fix all safe auto correctable offenses
هذا الالتزام موجود في:
@@ -1,2 +1,2 @@
|
||||
require File.expand_path('../../lib/postal/config', __FILE__)
|
||||
require File.expand_path("../lib/postal/config", __dir__)
|
||||
puts Postal.rp_dkim_dns_record
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
#!/usr/bin/env ruby
|
||||
require File.expand_path('../../lib/postal/config', __FILE__)
|
||||
require 'openssl'
|
||||
require 'securerandom'
|
||||
require 'fileutils'
|
||||
require File.expand_path("../lib/postal/config", __dir__)
|
||||
require "openssl"
|
||||
require "securerandom"
|
||||
require "fileutils"
|
||||
|
||||
unless File.directory?(Postal.config_root)
|
||||
FileUtils.mkdir_p(Postal.config_root)
|
||||
end
|
||||
|
||||
unless File.exist?(Postal.config_file_path)
|
||||
content = File.read(Postal.app_root.join('config', 'postal.example.yml'))
|
||||
content.gsub!('{{secretkey}}', SecureRandom.hex(128))
|
||||
File.open(Postal.config_file_path, 'w') { |f| f.write(content) }
|
||||
content = File.read(Postal.app_root.join("config", "postal.example.yml"))
|
||||
content.gsub!("{{secretkey}}", SecureRandom.hex(128))
|
||||
File.write(Postal.config_file_path, content)
|
||||
puts "Created example config file at #{Postal.config_file_path}"
|
||||
end
|
||||
|
||||
unless File.exists?(Postal.signing_key_path)
|
||||
unless File.exist?(Postal.signing_key_path)
|
||||
key = OpenSSL::PKey::RSA.new(1024).to_s
|
||||
File.open(Postal.signing_key_path, 'w') { |f| f.write(key) }
|
||||
File.write(Postal.signing_key_path, key)
|
||||
puts "Created new signing key for DKIM & HTTP requests"
|
||||
end
|
||||
|
||||
|
||||
@@ -10,23 +10,23 @@ if ARGV[0].nil? || ARGV[1].nil?
|
||||
exit 1
|
||||
end
|
||||
|
||||
require_relative '../config/environment'
|
||||
require_relative "../config/environment"
|
||||
|
||||
server = Server.find(ARGV[0])
|
||||
puts "Got server #{server.name}"
|
||||
|
||||
template = File.read(Rails.root.join('resource/postfix-bounce.msg'))
|
||||
template = File.read(Rails.root.join("resource/postfix-bounce.msg"))
|
||||
|
||||
if ARGV[1].to_s =~ /\A(\d+)\z/
|
||||
message = server.message_db.message(ARGV[1].to_i)
|
||||
puts "Got message #{message.id} with token #{message.token}"
|
||||
template.gsub!('{{MSGID}}', message.token)
|
||||
template.gsub!("{{MSGID}}", message.token)
|
||||
else
|
||||
template.gsub!('{{MSGID}}', ARGV[1].to_s)
|
||||
template.gsub!("{{MSGID}}", ARGV[1].to_s)
|
||||
end
|
||||
|
||||
message = server.message_db.new_message
|
||||
message.scope = 'incoming'
|
||||
message.scope = "incoming"
|
||||
message.rcpt_to = "#{server.token}@#{Postal.config.dns.return_path}"
|
||||
message.mail_from = "MAILER-DAEMON@smtp.infra.atech.io"
|
||||
message.raw_message = template
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#!/usr/bin/env ruby
|
||||
trap("INT") { puts ; exit }
|
||||
trap("INT") do
|
||||
puts
|
||||
exit
|
||||
end
|
||||
|
||||
require_relative '../config/environment'
|
||||
require 'postal/user_creator'
|
||||
require_relative "../config/environment"
|
||||
require "postal/user_creator"
|
||||
|
||||
Postal::UserCreator.start do |u|
|
||||
u.admin = true
|
||||
|
||||
8
script/queue_size.rb
Normal file → Executable file
8
script/queue_size.rb
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
require_relative '../lib/postal/config'
|
||||
require 'mysql2'
|
||||
require_relative "../lib/postal/config"
|
||||
require "mysql2"
|
||||
|
||||
client = Mysql2::Client.new(:host => Postal.config.main_db.host, :username => Postal.config.main_db.username, :password => Postal.config.main_db.password, :port => Postal.config.main_db.port, :database => Postal.config.main_db.database)
|
||||
client = Mysql2::Client.new(host: Postal.config.main_db.host, username: Postal.config.main_db.username, password: Postal.config.main_db.password, port: Postal.config.main_db.port, database: Postal.config.main_db.database)
|
||||
result = client.query("SELECT COUNT(id) as size FROM `queued_messages` WHERE retry_after IS NULL OR retry_after <= ADDTIME(UTC_TIMESTAMP(), '30') AND locked_at IS NULL")
|
||||
puts result.to_a.first['size']
|
||||
puts result.to_a.first["size"]
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/usr/bin/env ruby
|
||||
trap("INT") { puts ; exit }
|
||||
|
||||
trap("INT") do
|
||||
puts
|
||||
exit
|
||||
end
|
||||
|
||||
if ARGV[0].nil? || !(ARGV[0] =~ /@/)
|
||||
puts "usage: postal test-app-smtp [email address]"
|
||||
exit 1
|
||||
end
|
||||
|
||||
require_relative '../config/environment'
|
||||
require_relative "../config/environment"
|
||||
|
||||
begin
|
||||
Timeout.timeout(10) do
|
||||
@@ -15,7 +17,7 @@ begin
|
||||
end
|
||||
|
||||
puts "\e[32mMessage has been sent successfully.\e[0m"
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
puts "\e[31mMessage was not delivered successfully to SMTP server.\e[0m"
|
||||
puts "Error: #{e.class} (#{e.message})"
|
||||
puts
|
||||
|
||||
2
script/version.rb
Normal file → Executable file
2
script/version.rb
Normal file → Executable file
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env ruby
|
||||
require File.expand_path('../../lib/postal/version', __FILE__)
|
||||
require File.expand_path("../lib/postal/version", __dir__)
|
||||
puts Postal.version
|
||||
|
||||
2
script/worker.rb
Normal file → Executable file
2
script/worker.rb
Normal file → Executable file
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env ruby
|
||||
require_relative '../config/environment'
|
||||
require_relative "../config/environment"
|
||||
Postal::Worker.new([:main]).work
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم