feed2imap 1.2.7 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12ff9f4bc81dc363b9eaff51d7ff5bbb490c2822da0c89601fbc45f39681c583
4
- data.tar.gz: 6cbb2410faa8458dd2a42993e70c94f4a196cf6180229dccead089fbcf71f339
3
+ metadata.gz: 6a8d75ff963e56a991f8180012db653147c9e2b4520565916c94083ad160f3b6
4
+ data.tar.gz: 68992f2ae03c5f3c29763c4fd2becb2912e94c8d47d607230b0ec21b40c9b136
5
5
  SHA512:
6
- metadata.gz: 5ec1cd00ebbbeb6dbce69a9a580e97fea285d421b809c3cb047b0fd66fb2a59445f3abd12a32ce0b1617c032901a943858743492b6440a2200121ac49a627c84
7
- data.tar.gz: 3a2c0123fcc6dac7847e2bd3ddd6bfdf76df19d26b2e7e6e1b5b3a586e4465cae2cd46645831a659b5ad55ef40d9c215ef35bd2c032e135f7290f6e69c6a256d
6
+ metadata.gz: 676f9c559b6ff084c3da469a8df713677b65399702c32e8e995f14f0b5f5de818ca50b54c1814034aa9b07722c130e48357d012f2110b154913d0742c085a45c
7
+ data.tar.gz: 38dcbc31f225873dbf22907682edbd7e7114e10a95ffb30bdf335f459849910e34052326202181e1b37a740c801b1dc7c1ca05d614df34ca71a55b7a61103fc6
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::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 !")
@@ -90,13 +90,12 @@ def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images =
90
90
  htmlpart = parts.size == 1 ? message : RMail::Message::new
91
91
  htmlpart.header['Content-Type'] = 'text/html; charset=utf-8'
92
92
  htmlpart.header['Content-Transfer-Encoding'] = '8bit'
93
- htmlpart.body = item.to_html
93
+ htmlpart.body = item.to_html_with_headers
94
94
  end
95
95
 
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.2.7"
2
+ VERSION = "1.3.2"
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.2.7
4
+ version: 1.3.2
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-01-18 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.5
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