mail_grabber 1.0.0.rc1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/README.md +1 -1
- data/lib/mail_grabber/database_helper.rb +11 -10
- data/lib/mail_grabber/delivery_method.rb +1 -1
- data/lib/mail_grabber/error.rb +2 -2
- data/lib/mail_grabber/version.rb +1 -1
- data/lib/mail_grabber/web/application.rb +9 -9
- data/lib/mail_grabber/web/application_helper.rb +1 -1
- data/lib/mail_grabber/web/application_router.rb +5 -5
- data/lib/mail_grabber/web/assets/javascripts/application.js +130 -521
- data/lib/mail_grabber/web/assets/javascripts/dom.js +86 -0
- data/lib/mail_grabber/web/assets/javascripts/message_attachment.js +36 -0
- data/lib/mail_grabber/web/assets/javascripts/message_content.js +114 -0
- data/lib/mail_grabber/web/assets/javascripts/message_html_part.js +26 -0
- data/lib/mail_grabber/web/assets/javascripts/message_inline_attachments.js +21 -0
- data/lib/mail_grabber/web/assets/javascripts/message_list.js +54 -0
- data/lib/mail_grabber/web/assets/javascripts/message_metadata.js +23 -0
- data/lib/mail_grabber/web/assets/javascripts/utilities.js +65 -0
- data/lib/mail_grabber/web/assets/javascripts/variables.js +24 -0
- data/lib/mail_grabber/web/assets/javascripts/web.js +6 -0
- data/lib/mail_grabber/web/views/index.html.erb +10 -0
- data/lib/mail_grabber/web.rb +2 -1
- data/lib/mail_grabber.rb +1 -1
- metadata +18 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aea5e39deacb823607303c62537b8eced611a1e121f3c0f098532b4aba5c2914
|
4
|
+
data.tar.gz: 8921cffcefaa54d1238acfdc5a1d8977d5ea45093470817a4829fec4fc2e850c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 176f7dcea3dd597e1b9a7ef0178e60f6e457dc08a9bba0655c7a722ab944b659eb5ec02aef67840e48169d386a550b66272e36e0f71c1d1d1d37ea99f3fd0d27
|
7
|
+
data.tar.gz: f89030ad607b1bd7ae29377b7c1adcaceb3cc9d78d3cc439f28e8c27a9ac20cb2568ecaea5e41809352cd1d39fd2f430a1a7f5c7038dcb99c8f8f6af56c0e1ec
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,44 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## 1.2.0 (2022-05-26)
|
4
|
+
|
5
|
+
### Changes
|
6
|
+
|
7
|
+
* Drop Ruby 2.6 support.
|
8
|
+
* Fix some grammar issues and typos.
|
9
|
+
* Update bundler and gems.
|
10
|
+
|
11
|
+
|
12
|
+
## 1.1.0 (2021-12-31)
|
13
|
+
|
14
|
+
### Changes
|
15
|
+
|
16
|
+
* Add Ruby 3.1 support.
|
17
|
+
* Drop Ruby 2.5 support.
|
18
|
+
* Replace Travis with GitHub Actions.
|
19
|
+
* Update bundler and gems.
|
20
|
+
|
21
|
+
### Bug fixes
|
22
|
+
|
23
|
+
* Update apparition gem from github to fix issues.
|
24
|
+
|
25
|
+
|
26
|
+
## 1.0.0 (2021-04-02)
|
27
|
+
|
28
|
+
### Changes
|
29
|
+
|
30
|
+
* Update documentation.
|
31
|
+
* Change javascript to hide HTML tab if mail does not have HTML part.
|
32
|
+
* Refactoring the JavaScript code.
|
33
|
+
* Change the documentation uri in the gemspec file.
|
34
|
+
* Update .rubocop.yml.
|
35
|
+
* Update gems.
|
36
|
+
|
37
|
+
### Bug fixes
|
38
|
+
|
39
|
+
* Fix 3x load message list when reload tab and infinite scroll was used.
|
40
|
+
|
41
|
+
|
3
42
|
## 1.0.0.rc1 (2021-03-20)
|
4
43
|
|
5
44
|
* Implement MailGrabber methods and functionality. See [README.md](https://github.com/MailToolbox/mail_grabber/blob/main/README.md)
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://badge.fury.io/rb/mail_grabber)
|
4
4
|
[](https://github.com/MailToolbox/mail_grabber/blob/main/LICENSE.txt)
|
5
5
|
[](https://github.com/rubocop-hq/rubocop)
|
6
|
-
[](https://github.com/MailToolbox/mail_grabber/actions/workflows/mail_grabber_ci.yml)
|
7
7
|
[](https://codeclimate.com/github/MailToolbox/mail_grabber/maintainability)
|
8
8
|
[](https://codeclimate.com/github/MailToolbox/mail_grabber/test_coverage)
|
9
9
|
|
@@ -20,9 +20,9 @@ module MailGrabber
|
|
20
20
|
|
21
21
|
# Create connection to the SQLite3 database. Use foreign_keys pragmas that
|
22
22
|
# we can use DELETE CASCADE option. It accepts block to execute queries.
|
23
|
-
# If something goes wrong then it
|
24
|
-
# Also ensure to close the database (important to close database if we
|
25
|
-
#
|
23
|
+
# If something goes wrong, then it raises a database helper error.
|
24
|
+
# Also ensure to close the database (important to close database if we don't
|
25
|
+
# want to see database busy errors).
|
26
26
|
def connection
|
27
27
|
database = open_database
|
28
28
|
database.foreign_keys = 'ON'
|
@@ -43,8 +43,8 @@ module MailGrabber
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# Create connection and execute many queries in transaction. It accepts
|
46
|
-
# block to execute queries. If something goes wrong it rolls back the
|
47
|
-
# changes and
|
46
|
+
# block to execute queries. If something goes wrong, it rolls back the
|
47
|
+
# changes and raises a database helper error.
|
48
48
|
def connection_execute_transaction
|
49
49
|
connection do |db|
|
50
50
|
db.transaction
|
@@ -158,8 +158,8 @@ module MailGrabber
|
|
158
158
|
object.cid if object.respond_to?(:cid)
|
159
159
|
end
|
160
160
|
|
161
|
-
# Extract all parts from the Mail::Message object. If it is not multipart
|
162
|
-
# then it returns
|
161
|
+
# Extract all parts from the Mail::Message object. If it is not multipart,
|
162
|
+
# then it returns with the original object in an Array.
|
163
163
|
#
|
164
164
|
# @param [Mail::Message] message
|
165
165
|
#
|
@@ -168,7 +168,7 @@ module MailGrabber
|
|
168
168
|
message.multipart? ? message.all_parts : [message]
|
169
169
|
end
|
170
170
|
|
171
|
-
# Extract MIME type of the Mail::Part object. If it is nil then it returns
|
171
|
+
# Extract MIME type of the Mail::Part object. If it is nil, then it returns
|
172
172
|
# with text/plain value.
|
173
173
|
#
|
174
174
|
# @param [Mail::Part] object
|
@@ -228,8 +228,9 @@ module MailGrabber
|
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
231
|
-
# Open a database connection with the database. Also it checks that the
|
232
|
-
# database is
|
231
|
+
# Open a database connection with the database. Also, it checks that the
|
232
|
+
# database is existing or not. If it does not exist, then it creates a new
|
233
|
+
# one.
|
233
234
|
#
|
234
235
|
# @return [SQLite3::Database] a database object
|
235
236
|
def open_database
|
data/lib/mail_grabber/error.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module MailGrabber
|
4
4
|
class Error < StandardError
|
5
|
-
# Specific error class for errors if database error happen
|
5
|
+
# Specific error class for errors if database error happen.
|
6
6
|
class DatabaseHelperError < Error; end
|
7
7
|
|
8
|
-
# Specific error class for errors if parameter is not given
|
8
|
+
# Specific error class for errors if parameter is not given.
|
9
9
|
class WrongParameter < Error; end
|
10
10
|
end
|
11
11
|
end
|
data/lib/mail_grabber/version.rb
CHANGED
@@ -13,7 +13,7 @@ module MailGrabber
|
|
13
13
|
attr_reader :request, :response
|
14
14
|
|
15
15
|
# Method to call MailGrabber::Web::Application. This method will call the
|
16
|
-
# initialize method and returns
|
16
|
+
# initialize method and returns with response of the application.
|
17
17
|
#
|
18
18
|
# @param [Hash] env the environment variables
|
19
19
|
#
|
@@ -23,7 +23,7 @@ module MailGrabber
|
|
23
23
|
new(env).response.finish
|
24
24
|
end
|
25
25
|
|
26
|
-
# Initialize web application request and response then process the given
|
26
|
+
# Initialize web application request and response, then process the given
|
27
27
|
# request.
|
28
28
|
#
|
29
29
|
# @param [Hash] env the environment variables
|
@@ -34,7 +34,7 @@ module MailGrabber
|
|
34
34
|
process_request
|
35
35
|
end
|
36
36
|
|
37
|
-
# Extract env['PATH_INFO'] value. If the path info is empty then it will
|
37
|
+
# Extract env['PATH_INFO'] value. If the path info is empty, then it will
|
38
38
|
# return with root path.
|
39
39
|
#
|
40
40
|
# @return [String] path the requested path or the root path if this value
|
@@ -43,7 +43,7 @@ module MailGrabber
|
|
43
43
|
@path ||= request.path_info.empty? ? '/' : request.path_info
|
44
44
|
end
|
45
45
|
|
46
|
-
# This method returns
|
46
|
+
# This method returns with extracted request parameters.
|
47
47
|
#
|
48
48
|
# @return [Hash] params
|
49
49
|
def params
|
@@ -64,12 +64,12 @@ module MailGrabber
|
|
64
64
|
request.script_name
|
65
65
|
end
|
66
66
|
|
67
|
-
# Parse the routes of the ApplicationRouter and tries to find matching
|
67
|
+
# Parse the routes of the ApplicationRouter and tries to find a matching
|
68
68
|
# route for the request method, which was defined in the
|
69
|
-
# get, post, put, patch or delete blocks. If the 'extracted_params' is
|
70
|
-
# then it could not
|
71
|
-
# route then it saves the params and call the given block. If it cannot
|
72
|
-
# find anything then it will set response with 404 Not Found.
|
69
|
+
# get, post, put, patch or delete blocks. If the 'extracted_params' is
|
70
|
+
# nil, then it could not find any defined routes. If it can find a defined
|
71
|
+
# route, then it saves the params and call the given block. If it cannot
|
72
|
+
# find anything, then it will set the response with 404 Not Found.
|
73
73
|
def process_request
|
74
74
|
self.class.routes[request_method].each do |route|
|
75
75
|
extracted_params = route.extract_params(path)
|
@@ -4,7 +4,7 @@ module MailGrabber
|
|
4
4
|
module Web
|
5
5
|
# Helper module for views
|
6
6
|
module ApplicationHelper
|
7
|
-
# This method helps us that e.g. we can load style or
|
7
|
+
# This method helps us that e.g. we can load style or JavaScript files
|
8
8
|
# when we are running this application standalone or in Ruby on Rails.
|
9
9
|
def root_path
|
10
10
|
script_name.to_s
|
@@ -9,13 +9,13 @@ module MailGrabber
|
|
9
9
|
|
10
10
|
Route =
|
11
11
|
Struct.new(:pattern, :block) do
|
12
|
-
# Extract parameters from the given path. All routes
|
12
|
+
# Extract parameters from the given path. All routes have a
|
13
13
|
# path pattern which helps to the router to find which block it should
|
14
|
-
# execute. If path contains request parameters like '/test/1' then
|
15
|
-
# it will match with the '/test/:id' pattern. In this case it will
|
14
|
+
# execute. If the path contains request parameters like '/test/1' then
|
15
|
+
# it will match with the '/test/:id' pattern. In this case, it will
|
16
16
|
# return with '{"id" => "1"}' hash. If it is just a simple path like
|
17
|
-
# '/' and it has a pattern to match then it will return with '{}'.
|
18
|
-
# In the other case it will return with nil.
|
17
|
+
# '/' and it has a pattern to match, then it will return with '{}'.
|
18
|
+
# In the other case, it will return with nil.
|
19
19
|
#
|
20
20
|
# @param [String] path
|
21
21
|
#
|