gitlab-mail_room 0.0.20 → 0.0.23
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 +1 -4
- data/spec/lib/delivery/letter_opener_spec.rb +2 -1
- data/spec/lib/delivery/logger_spec.rb +2 -1
- metadata +14 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fa8e5569da85c3fa57acd7d2729af8f67429f281f13cc87fdbfdd8d533f3ee9
|
4
|
+
data.tar.gz: 50d4dccc94549ff477922d7318115e1992a87566e6d159d50f046015cf875e10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e4d8fe88a968459036de06624cd917b3e68a6f4bf5a5cd1bcbb9e0d466dcff8608cead170a8e813f45bcccc2b5c342d603732b9520314d8792c23e4523d91ff
|
7
|
+
data.tar.gz: 5de2450bbd78041a19c4996ebaa74b2497af0e7362c4e6e5338ccc10a740bc4cc13a508bd3cc7cea55a7eabd7da25365b544d7baa0e33dd134c40b0bd1a0f577
|
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
@@ -18,12 +18,9 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
20
|
gem.add_dependency "net-imap", ">= 0.2.1"
|
21
|
-
gem.add_dependency "oauth2", "
|
21
|
+
gem.add_dependency "oauth2", [">= 1.4.4", "< 3"]
|
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.23
|
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
|
@@ -28,16 +28,22 @@ dependencies:
|
|
28
28
|
name: oauth2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.4.4
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 1.4.4
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: jwt
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +58,6 @@ dependencies:
|
|
52
58
|
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
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
61
|
- !ruby/object:Gem::Dependency
|
70
62
|
name: rake
|
71
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -341,7 +333,7 @@ files:
|
|
341
333
|
homepage: http://github.com/tpitale/mail_room
|
342
334
|
licenses: []
|
343
335
|
metadata: {}
|
344
|
-
post_install_message:
|
336
|
+
post_install_message:
|
345
337
|
rdoc_options: []
|
346
338
|
require_paths:
|
347
339
|
- lib
|
@@ -356,8 +348,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
348
|
- !ruby/object:Gem::Version
|
357
349
|
version: '0'
|
358
350
|
requirements: []
|
359
|
-
rubygems_version: 3.
|
360
|
-
signing_key:
|
351
|
+
rubygems_version: 3.4.7
|
352
|
+
signing_key:
|
361
353
|
specification_version: 4
|
362
354
|
summary: mail_room will proxy email (gmail) from IMAP to a callback URL, logger, or
|
363
355
|
letter_opener
|