mail_grabber 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- 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 +3 -3
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
@@ -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.0
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 2.
|
114
|
+
version: 2.7.0
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - ">="
|