gitlab-mail_room 0.0.20 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -1
- data/README.md +2 -2
- data/lib/mail_room/delivery/postback.rb +6 -2
- data/lib/mail_room/delivery/que.rb +15 -1
- data/lib/mail_room/version.rb +1 -1
- data/mail_room.gemspec +0 -3
- data/spec/lib/delivery/letter_opener_spec.rb +2 -1
- data/spec/lib/delivery/logger_spec.rb +2 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83e39da2869147d1086529b11cfb371446aa616323dbc5c5212330d12f8fe9f
|
4
|
+
data.tar.gz: 96840ed2fb7347df81ba7c139f02d0613b0041979b28a9ae52c5879452898133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aff0a7be49b42b0d645414385988805d9fc283528876c7605b90c6535a364b40c09b2e2ca8909413238bc20e4a01e55b730c7361cee6db537a72fa60f38f422
|
7
|
+
data.tar.gz: dc9bf6c5edd55071cc512a30fc56981a50119d2f3dc0a02d18a7dfed5ac90160a7500404418ec80ddcc39db3947a091ede405132453312a145ac8886ce8d543a
|
data/.gitlab-ci.yml
CHANGED
@@ -6,6 +6,7 @@ services:
|
|
6
6
|
|
7
7
|
.test-template: &test
|
8
8
|
cache:
|
9
|
+
key: ruby-$RUBY_VERSION
|
9
10
|
paths:
|
10
11
|
- vendor/ruby
|
11
12
|
variables:
|
@@ -22,7 +23,7 @@ services:
|
|
22
23
|
rspec:
|
23
24
|
parallel:
|
24
25
|
matrix:
|
25
|
-
- RUBY_VERSION: [ "2.
|
26
|
+
- RUBY_VERSION: [ "2.6", "2.7", "3.0", "3.1", "3.2" ]
|
26
27
|
<<: *test
|
27
28
|
|
28
29
|
include:
|
data/README.md
CHANGED
@@ -379,8 +379,8 @@ And finally, configure MailRoom to use the postback configuration with the optio
|
|
379
379
|
:delivery_method: postback
|
380
380
|
:delivery_options:
|
381
381
|
:delivery_url: https://example.com/rails/action_mailbox/relay/inbound_emails
|
382
|
-
:
|
383
|
-
:
|
382
|
+
:username: actionmailbox
|
383
|
+
:password: <INGRESS_PASSWORD>
|
384
384
|
```
|
385
385
|
|
386
386
|
## Receiving `postback` in Rails ##
|
@@ -20,8 +20,12 @@ module MailRoom
|
|
20
20
|
|
21
21
|
jwt = initialize_jwt(mailbox.delivery_options)
|
22
22
|
|
23
|
-
username =
|
24
|
-
|
23
|
+
username =
|
24
|
+
mailbox.delivery_options[:username] ||
|
25
|
+
mailbox.delivery_options[:delivery_username]
|
26
|
+
password =
|
27
|
+
mailbox.delivery_options[:password] ||
|
28
|
+
mailbox.delivery_options[:delivery_password]
|
25
29
|
|
26
30
|
logger = mailbox.logger
|
27
31
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'pg'
|
2
2
|
require 'json'
|
3
|
+
require 'charlock_holmes'
|
3
4
|
|
4
5
|
module MailRoom
|
5
6
|
module Delivery
|
@@ -34,7 +35,7 @@ module MailRoom
|
|
34
35
|
# deliver the message by pushing it onto the configured Sidekiq queue
|
35
36
|
# @param message [String] the email message as a string, RFC822 format
|
36
37
|
def deliver(message)
|
37
|
-
queue_job(message)
|
38
|
+
queue_job(utf8_encode_message(message))
|
38
39
|
@options.logger.info({ delivery_method: 'Que', action: 'message pushed' })
|
39
40
|
end
|
40
41
|
|
@@ -58,6 +59,19 @@ module MailRoom
|
|
58
59
|
|
59
60
|
connection.exec(sql, [options.priority, options.job_class, options.queue, JSON.dump(args)])
|
60
61
|
end
|
62
|
+
|
63
|
+
def utf8_encode_message(message)
|
64
|
+
message = message.dup
|
65
|
+
|
66
|
+
message.force_encoding("UTF-8")
|
67
|
+
return message if message.valid_encoding?
|
68
|
+
|
69
|
+
detection = CharlockHolmes::EncodingDetector.detect(message)
|
70
|
+
return message unless detection && detection[:encoding]
|
71
|
+
|
72
|
+
# Convert non-UTF-8 body UTF-8 so it can be dumped as JSON.
|
73
|
+
CharlockHolmes::Converter.convert(message, detection[:encoding], 'UTF-8')
|
74
|
+
end
|
61
75
|
end
|
62
76
|
end
|
63
77
|
end
|
data/lib/mail_room/version.rb
CHANGED
data/mail_room.gemspec
CHANGED
@@ -21,9 +21,6 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency "oauth2", "~> 1.4.4"
|
22
22
|
gem.add_dependency "jwt", ">= 2.0"
|
23
23
|
|
24
|
-
# Pinning io-wait to 0.1.0, which is the last version to support Ruby < 3
|
25
|
-
gem.add_dependency "io-wait", "~> 0.1.0"
|
26
|
-
|
27
24
|
gem.add_development_dependency "rake"
|
28
25
|
gem.add_development_dependency "rspec", "~> 3.9"
|
29
26
|
gem.add_development_dependency "rubocop", "~> 1.11"
|
@@ -4,12 +4,13 @@ require 'mail_room/delivery/letter_opener'
|
|
4
4
|
describe MailRoom::Delivery::LetterOpener do
|
5
5
|
describe '#deliver' do
|
6
6
|
let(:mailbox) {build_mailbox(location: '/tmp/somewhere')}
|
7
|
-
let(:delivery_method) {stub
|
7
|
+
let(:delivery_method) {stub}
|
8
8
|
let(:mail) {stub}
|
9
9
|
|
10
10
|
before :each do
|
11
11
|
Mail.stubs(:read_from_string).returns(mail)
|
12
12
|
::LetterOpener::DeliveryMethod.stubs(:new).returns(delivery_method)
|
13
|
+
delivery_method.stubs(:deliver!)
|
13
14
|
end
|
14
15
|
|
15
16
|
it 'creates a new LetterOpener::DeliveryMethod' do
|
@@ -19,7 +19,8 @@ describe MailRoom::Delivery::Logger do
|
|
19
19
|
let(:mailbox) {build_mailbox(log_path: '/var/log/mail-room.log')}
|
20
20
|
|
21
21
|
it 'creates a new file to append to' do
|
22
|
-
file = stub
|
22
|
+
file = stub
|
23
|
+
file.stubs(:sync=)
|
23
24
|
|
24
25
|
File.expects(:open).with('/var/log/mail-room.log', 'a').returns(file)
|
25
26
|
::Logger.stubs(:new).with(file)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-mail_room
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-imap
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: io-wait
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -341,7 +327,7 @@ files:
|
|
341
327
|
homepage: http://github.com/tpitale/mail_room
|
342
328
|
licenses: []
|
343
329
|
metadata: {}
|
344
|
-
post_install_message:
|
330
|
+
post_install_message:
|
345
331
|
rdoc_options: []
|
346
332
|
require_paths:
|
347
333
|
- lib
|
@@ -356,8 +342,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
342
|
- !ruby/object:Gem::Version
|
357
343
|
version: '0'
|
358
344
|
requirements: []
|
359
|
-
rubygems_version: 3.
|
360
|
-
signing_key:
|
345
|
+
rubygems_version: 3.4.7
|
346
|
+
signing_key:
|
361
347
|
specification_version: 4
|
362
348
|
summary: mail_room will proxy email (gmail) from IMAP to a callback URL, logger, or
|
363
349
|
letter_opener
|