feed2imap 1.3.0 → 1.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a8cca85ea26695d4b8af99207e5c47ecca608d39f11aff3343a747bc1502491
4
- data.tar.gz: 14ba146f763b444858d976661942c7e0681927d6f4d4488914dab67816e1b185
3
+ metadata.gz: b830ec48647c30f9e60e6654b001f494823a5b630b8518ed05ff844f302d0bbc
4
+ data.tar.gz: 3d36e31780cbef843a6c16c0f308a47d9f750a877a287c322961fcf0a1500522
5
5
  SHA512:
6
- metadata.gz: 4344152302dfaa64fb1aa425953b55a7246e23afdfba5b1fdfea336ee62a16f4171daeccc46a49bc982b648a31e09ef5e7d36beb244a85d26977012a29e36623
7
- data.tar.gz: 5af3575ea5bdfc3ad435fb2d963fb0989774ab8c5b0ea83174bf36cc7c95cd62df74952df8a0d0cef83ba9ef3a658f17eeea039320da85f0300a4604eb1dfcbd
6
+ metadata.gz: f7c7144ae49e7b06dcc8cdcfaf7051074c0ca398e79458d7557cbc76e85a854049fa83749bc043ed1d872daa9aad5febb81dc02b3d15515d5e8fddf665090d7b
7
+ data.tar.gz: f7ec3f4f3620a91306bbfc4428588a267da183388ed01bda94f0432364a263273d518f339b5e93440f4f8e80799784db072885845c098d879a22e388bee5466c
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ task :default => [:test]
9
9
 
10
10
  PKG_NAME = 'feed2imap'
11
11
  PKG_VERSION = Feed2Imap::VERSION
12
- PKG_FILES = [ 'ChangeLog', 'README', 'COPYING', 'setup.rb', 'Rakefile']
12
+ PKG_FILES = [ 'ChangeLog', 'README', 'COPYING', 'Rakefile']
13
13
  Find.find('bin/', 'lib/', 'test/', 'data/') do |f|
14
14
  if FileTest.directory?(f) and f =~ /\.svn/
15
15
  Find.prune
@@ -68,6 +68,7 @@ rescue LoadError
68
68
  puts "Will not generate gem."
69
69
  end
70
70
 
71
+ desc 'Makes a new release'
71
72
  task :release => :repackage do
72
73
  sh 'git', 'tag', '--sign', 'v' + PKG_VERSION
73
74
  sh 'git', 'push'
@@ -40,7 +40,7 @@ class F2IConfig
40
40
  # Load the configuration from the IO stream
41
41
  # TODO should do some sanity check on the data read.
42
42
  def initialize(io)
43
- @conf = YAML::load(io)
43
+ @conf = YAML::safe_load(io, aliases: true)
44
44
  @cache = @conf['cache'] || DEFCACHE
45
45
  @dumpdir = @conf['dumpdir'] || nil
46
46
  @conf['feeds'] ||= []
@@ -26,6 +26,7 @@ require 'feed2imap/httpfetcher'
26
26
  require 'logger'
27
27
  require 'thread'
28
28
  require 'feedparser'
29
+ require 'feed2imap/rexml_settings'
29
30
  require 'feed2imap/itemtomail'
30
31
  require 'open3'
31
32
 
@@ -152,8 +153,16 @@ class Feed2Imap
152
153
  outh = Thread::new do
153
154
  output = stdout.read
154
155
  end
156
+ err = nil
157
+ errth = Thread::new do
158
+ err = stderr.read.chomp
159
+ end
155
160
  inth.join
156
161
  outh.join
162
+ errth.join
163
+ err.lines do |e|
164
+ @logger.warn(e.chomp)
165
+ end
157
166
  s = output
158
167
  if $? && $?.exitstatus != 0
159
168
  @logger.warn("Filter command for #{feed.name} exited with status #{$?.exitstatus}. Output might be corrupted !")
@@ -96,7 +96,6 @@ def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images =
96
96
  # inline images as attachments
97
97
  imgs = []
98
98
  if inline_images
99
- cids = []
100
99
  htmlpart.body.gsub!(/(<img[^>]+)src="(\S+?\/([^\/]+?\.(png|gif|jpe?g)))"([^>]*>)/i) do |match|
101
100
  # $2 contains url, $3 the image name, $4 the image extension
102
101
  begin
@@ -0,0 +1 @@
1
+ REXML::Security.entity_expansion_text_limit *= 10
@@ -1,3 +1,3 @@
1
1
  class Feed2Imap
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.3"
3
3
  end
@@ -0,0 +1,41 @@
1
+ require 'test/unit'
2
+ require 'feed2imap'
3
+ require 'mocha/test_unit'
4
+
5
+
6
+ class ItemToMailTest < Test::Unit::TestCase
7
+
8
+ def jpg
9
+ # a 1x1 white pixel
10
+ "\xFF\xD8\xFF\xE0\u0000\u0010JFIF\u0000\u0001\u0001\u0000\u0000\u0001\u0000\u0001\u0000\u0000\xFF\xDB\u0000C\u0000\u0003\u0002\u0002\u0002\u0002\u0002\u0003\u0002\u0002\u0002\u0003\u0003\u0003\u0003\u0004\u0006\u0004\u0004\u0004\u0004\u0004\b\u0006\u0006\u0005\u0006\t\b\n\n\t\b\t\t\n\f\u000F\f\n\v\u000E\v\t\t\r\u0011\r\u000E\u000F\u0010\u0010\u0011\u0010\n\f\u0012\u0013\u0012\u0010\u0013\u000F\u0010\u0010\u0010\xFF\xC0\u0000\v\b\u0000\u0001\u0000\u0001\u0001\u0001\u0011\u0000\xFF\xC4\u0000\u0014\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\t\xFF\xC4\u0000\u0014\u0010\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\xFF\xDA\u0000\b\u0001\u0001\u0000\u0000?\u0000T\xDF\xFF\xD9"
11
+ end
12
+
13
+ def jpeg_base64
14
+ # base64 encoding of the image in #jpg above
15
+ "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQE\nBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/\nwAALCAABAAEBAREA/8QAFAABAAAAAAAAAAAAAAAAAAAACf/EABQQAQAAAAAA\nAAAAAAAAAAAAAAD/2gAIAQEAAD8AVN//2Q==\n"
16
+ end
17
+
18
+ def config
19
+ F2IConfig.new(StringIO.new("{}"))
20
+ end
21
+
22
+ def new_item
23
+ feed = FeedParser::Feed.new
24
+ feed.instance_variable_set("@title", "Some blog")
25
+ feed.instance_variable_set("@link", "http://www.example.com/")
26
+ item = FeedParser::FeedItem.new
27
+ item.instance_variable_set("@feed", feed)
28
+ item.title = "Some post"
29
+ item
30
+ end
31
+
32
+ def test_img
33
+ id = "abcd1234"
34
+ item = new_item
35
+ item.content = '<img src="http://www.example.com/pixel.jpg"/>'
36
+ HTTPFetcher.any_instance.expects(:fetch).with("http://www.example.com/pixel.jpg", anything).returns(jpg)
37
+ mail = item_to_mail(config, item, id, true, "feed2imap", true, false)
38
+ assert_match %r{<img src="data:image/jpg;base64,#{jpeg_base64}"/>}, mail.to_s
39
+ end
40
+
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feed2imap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Nussbaum
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-28 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-feedparser
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.1.4
41
41
  description: RSS/Atom feed aggregator
42
- email:
42
+ email:
43
43
  executables:
44
44
  - feed2imap
45
45
  - feed2imap-cleaner
@@ -71,10 +71,9 @@ files:
71
71
  - lib/feed2imap/imap.rb
72
72
  - lib/feed2imap/itemtomail.rb
73
73
  - lib/feed2imap/maildir.rb
74
- - lib/feed2imap/rexml_patch.rb
74
+ - lib/feed2imap/rexml_settings.rb
75
75
  - lib/feed2imap/sgml-parser.rb
76
76
  - lib/feed2imap/version.rb
77
- - setup.rb
78
77
  - test/maildir/cur/1376317520.15784_1.debian:2,S
79
78
  - test/maildir/cur/1376317520.15789_1.debian:2,S
80
79
  - test/maildir/cur/1376319137.17850_1.debian:2,
@@ -83,11 +82,12 @@ files:
83
82
  - test/tc_cache.rb
84
83
  - test/tc_config.rb
85
84
  - test/tc_httpfetcher.rb
85
+ - test/tc_itemtomail.rb
86
86
  - test/tc_maildir.rb
87
- homepage:
87
+ homepage:
88
88
  licenses: []
89
89
  metadata: {}
90
- post_install_message:
90
+ post_install_message:
91
91
  rdoc_options: []
92
92
  require_paths:
93
93
  - lib
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubygems_version: 3.2.27
106
- signing_key:
105
+ rubygems_version: 3.3.15
106
+ signing_key:
107
107
  specification_version: 4
108
108
  summary: RSS/Atom feed aggregator
109
109
  test_files: []
@@ -1,47 +0,0 @@
1
- =begin
2
- Feed2Imap - RSS/Atom Aggregator uploading to an IMAP Server
3
- Copyright (c) 2005 Lucas Nussbaum <lucas@lucas-nussbaum.net>
4
-
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program; if not, write to the Free Software
17
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
- =end
19
-
20
- require 'feedparser'
21
-
22
- # Patch for REXML
23
- # Very ugly patch to make REXML error-proof.
24
- # The problem is REXML uses IConv, which isn't error-proof at all.
25
- # With those changes, it uses unpack/pack with some error handling
26
- module REXML
27
- module Encoding
28
- def decode(str)
29
- return str.encode(@encoding)
30
- end
31
-
32
- def encode(str)
33
- return str
34
- end
35
-
36
- def encoding=(enc)
37
- return if defined? @encoding and enc == @encoding
38
- @encoding = enc || 'utf-8'
39
- end
40
- end
41
-
42
- class Element
43
- def children
44
- @children
45
- end
46
- end
47
- end