mail_grabber 1.0.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -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 +1 -1
- data/lib/mail_grabber/web/assets/javascripts/dom.js +7 -7
- data/lib/mail_grabber/web/assets/javascripts/message_content.js +1 -1
- data/lib/mail_grabber/web/assets/javascripts/message_html_part.js +1 -1
- data/lib/mail_grabber/web/assets/javascripts/message_list.js +1 -1
- data/lib/mail_grabber/web/assets/javascripts/variables.js +1 -1
- data/lib/mail_grabber/web/assets/javascripts/web.js +1 -1
- data/lib/mail_grabber/web.rb +2 -1
- data/lib/mail_grabber.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dd58a8c4a209377bde0a889539208418aa1245b1b42a3e1799a4976711b01c4
|
4
|
+
data.tar.gz: e8fa33ca7477ff7c0366eb5239f8718e6e1b000693288b282406084489cfa398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f328e5349f02f4a4f0236f85b1712d9795ca9a41b74662d231c781c045f1122fa816dc1d49d10bae9026fd4c4da57fd3f193cef6aa2cb98ad0966367e6d0fb90
|
7
|
+
data.tar.gz: 5eb4c771eefb94b130e601d5be15fe816eb8503d5a0c93997a3c2a2e46b151d6c11e76cee6e38c0665c6c9b6b88009f33b811e6a0e81a775e40165d222787dc3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,35 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## 1.2.1 (2022-05-27)
|
4
|
+
|
5
|
+
### Changes
|
6
|
+
|
7
|
+
* Update rack to version 2.2.3.1 because of security issues.
|
8
|
+
|
9
|
+
|
10
|
+
## 1.2.0 (2022-05-26)
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
* Drop Ruby 2.6 support.
|
15
|
+
* Fix some grammar issues and typos.
|
16
|
+
* Update bundler and gems.
|
17
|
+
|
18
|
+
|
19
|
+
## 1.1.0 (2021-12-31)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
* Add Ruby 3.1 support.
|
24
|
+
* Drop Ruby 2.5 support.
|
25
|
+
* Replace Travis with GitHub Actions.
|
26
|
+
* Update bundler and gems.
|
27
|
+
|
28
|
+
### Bug fixes
|
29
|
+
|
30
|
+
* Update apparition gem from github to fix issues.
|
31
|
+
|
32
|
+
|
3
33
|
## 1.0.0 (2021-04-02)
|
4
34
|
|
5
35
|
### Changes
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/mail_grabber.svg)](https://badge.fury.io/rb/mail_grabber)
|
4
4
|
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen)](https://github.com/MailToolbox/mail_grabber/blob/main/LICENSE.txt)
|
5
5
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
|
6
|
-
[![
|
6
|
+
[![MailGrabber CI](https://github.com/MailToolbox/mail_grabber/actions/workflows/mail_grabber_ci.yml/badge.svg)](https://github.com/MailToolbox/mail_grabber/actions/workflows/mail_grabber_ci.yml)
|
7
7
|
[![Maintainability](https://api.codeclimate.com/v1/badges/97deed5c1fbd003ca810/maintainability)](https://codeclimate.com/github/MailToolbox/mail_grabber/maintainability)
|
8
8
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/97deed5c1fbd003ca810/test_coverage)](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
|
#
|
@@ -85,7 +85,7 @@ var MailGrabberApplication = {
|
|
85
85
|
|
86
86
|
/**
|
87
87
|
* Initialize MailGrabber. Add some event listeners to the Reload and the
|
88
|
-
* Clear tabs then load messages and the default background.
|
88
|
+
* Clear tabs, then load messages and the default background.
|
89
89
|
*/
|
90
90
|
init: function() {
|
91
91
|
document
|
@@ -1,8 +1,8 @@
|
|
1
1
|
var MailGrabberDOM = {
|
2
2
|
/**
|
3
|
-
* Change which content (message part) should show. When the page is loading
|
3
|
+
* Change which content (message part) should show. When the page is loading,
|
4
4
|
* the HTML content will be active and the others will be hidden. When we
|
5
|
-
* click on tab e.g. Plain Text then this content will active and other
|
5
|
+
* click on tab e.g. Plain Text then this content will be active and other
|
6
6
|
* hidden.
|
7
7
|
*
|
8
8
|
* @param {Object} event - which part we clicked
|
@@ -33,9 +33,9 @@ var MailGrabberDOM = {
|
|
33
33
|
},
|
34
34
|
|
35
35
|
/**
|
36
|
-
* Create a clone from an element e.g. template tag.
|
36
|
+
* Create a clone from an element, e.g. template tag.
|
37
37
|
*
|
38
|
-
* @param {String} selector - which describe how find the element
|
38
|
+
* @param {String} selector - which describe how to find the element
|
39
39
|
*
|
40
40
|
* @return {Object} the clone of the found element
|
41
41
|
*/
|
@@ -44,7 +44,7 @@ var MailGrabberDOM = {
|
|
44
44
|
},
|
45
45
|
|
46
46
|
/**
|
47
|
-
* Show default
|
47
|
+
* Show default background image instead of any content.
|
48
48
|
*/
|
49
49
|
defaultBackground: function() {
|
50
50
|
var messageContent =
|
@@ -62,7 +62,7 @@ var MailGrabberDOM = {
|
|
62
62
|
|
63
63
|
/**
|
64
64
|
* Delete all content (message list and message content as well),
|
65
|
-
* set default
|
65
|
+
* set default background and the infinite scroll params when we click on
|
66
66
|
* the Reload or Delete tabs.
|
67
67
|
*/
|
68
68
|
deleteContent: function() {
|
@@ -76,7 +76,7 @@ var MailGrabberDOM = {
|
|
76
76
|
},
|
77
77
|
|
78
78
|
/**
|
79
|
-
* Root path which returns
|
79
|
+
* Root path, which returns with the server's root path. It can be an empty
|
80
80
|
* string or a string. It depends on how the server is running (standalone
|
81
81
|
* or in Ruby on Rails).
|
82
82
|
*/
|
@@ -82,7 +82,7 @@ var MailGrabberMessageContent = {
|
|
82
82
|
|
83
83
|
/**
|
84
84
|
* Render the content of the message (all parts, inline attachments and
|
85
|
-
* attachments). Also it sets up event listeners of the HTML, PlainText,
|
85
|
+
* attachments). Also, it sets up event listeners of the HTML, PlainText,
|
86
86
|
* Raw, Delete and Close tabs.
|
87
87
|
*
|
88
88
|
* @param {Object} response - the response of the get message request
|
@@ -1,6 +1,6 @@
|
|
1
1
|
var MailGrabberMessageHtmlPart = {
|
2
2
|
/**
|
3
|
-
* Render the HTML part of the message. If the message has inline images
|
3
|
+
* Render the HTML part of the message. If the message has inline images,
|
4
4
|
* then it will render those images as well. An iframe will contain this
|
5
5
|
* content.
|
6
6
|
*
|
@@ -36,7 +36,7 @@ var MailGrabberMessageList = {
|
|
36
36
|
|
37
37
|
/**
|
38
38
|
* Render the list of the messages. Also add event listener when click on a
|
39
|
-
* message then it will load that
|
39
|
+
* message then it will load that content.
|
40
40
|
*
|
41
41
|
* @param {Object} messages - the list of the given message.
|
42
42
|
*/
|
data/lib/mail_grabber/web.rb
CHANGED
@@ -14,7 +14,8 @@ module MailGrabber
|
|
14
14
|
module Web
|
15
15
|
module_function
|
16
16
|
|
17
|
-
# Method which build a Rack application and run the
|
17
|
+
# Method which build a Rack application and run the
|
18
|
+
# MailGrabber::Web::Application.
|
18
19
|
def app
|
19
20
|
@app ||= Rack::Builder.new do
|
20
21
|
use Rack::Static,
|
data/lib/mail_grabber.rb
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
require 'mail_grabber/error'
|
4
4
|
require 'mail_grabber/database_helper'
|
5
5
|
require 'mail_grabber/delivery_method'
|
6
|
-
# If we are using this gem outside of Rails then do not load this code.
|
6
|
+
# If we are using this gem outside of Rails, then do not load this code.
|
7
7
|
require 'mail_grabber/railtie' if defined?(Rails)
|
8
8
|
require 'mail_grabber/version'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_grabber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Norbert Szivós
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.2.3.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.2.3.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +102,7 @@ metadata:
|
|
102
102
|
changelog_uri: https://github.com/MailToolbox/mail_grabber/blob/main/CHANGELOG.md
|
103
103
|
bug_tracker_uri: https://github.com/MailToolbox/mail_grabber/issues
|
104
104
|
documentation_uri: https://rubydoc.info/github/MailToolbox/mail_grabber/main
|
105
|
+
rubygems_mfa_required: 'true'
|
105
106
|
post_install_message:
|
106
107
|
rdoc_options: []
|
107
108
|
require_paths:
|
@@ -110,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
111
|
requirements:
|
111
112
|
- - ">="
|
112
113
|
- !ruby/object:Gem::Version
|
113
|
-
version: 2.
|
114
|
+
version: 2.7.0
|
114
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
116
|
requirements:
|
116
117
|
- - ">="
|