diff --git a/Gemfile.lock b/Gemfile.lock index ce9d2b8..8300a55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,24 +4,26 @@ GEM mime (0.4.4) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2024.0604) mini_exiftool (2.11.0) - nokogiri (1.16.4-aarch64-linux) + nokogiri (1.16.6-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.4-arm-linux) + nokogiri (1.16.6-arm-linux) racc (~> 1.4) - nokogiri (1.16.4-arm64-darwin) + nokogiri (1.16.6-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86-linux) + nokogiri (1.16.6-x86-linux) racc (~> 1.4) - nokogiri (1.16.4-x86_64-darwin) + nokogiri (1.16.6-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nokogiri (1.16.6-x86_64-linux) racc (~> 1.4) - racc (1.7.3) - rexml (3.2.6) + racc (1.8.0) + rexml (3.3.0) + strscan rubyzip (2.3.2) spider (0.5.4) + strscan (3.1.0) PLATFORMS aarch64-linux diff --git a/README.md b/README.md index 0b9eda4..1b40d9a 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ Usage: cewl [OPTIONS] ... ### Running CeWL in a Docker container + To quickly use CeWL with Docker, you can use the official `ghcr.io/digininja/cewl` image: ```sh diff --git a/cewl.rb b/cewl.rb index 0946c24..f3dc4d9 100755 --- a/cewl.rb +++ b/cewl.rb @@ -169,7 +169,7 @@ def start! #:nodoc: y = [] x.select do |a_url, parsed_url| - if (parsed_url.scheme == "http" or parsed_url.scheme == "https") then + if (parsed_url.scheme == "mailto" or parsed_url.scheme == "http" or parsed_url.scheme == "https") then y << [a_url, parsed_url] if allowable_url?(a_url, parsed_url) end end @@ -440,7 +440,7 @@ def pop # Push an item onto the tree def push(value) - puts "Pushing #{value}" if @debug + puts "Adding #{value} to the tree" if @debug key = value.keys.first value = value.values_at(key).first @@ -454,10 +454,21 @@ def push(value) @children << child else @children.each { |node| - if node.data.value == key && node.data.depth<@max_depth - child = Tree.new(key, value, node.data.depth + 1, @debug) - @children << child - end + # Ignore the max depth for mailto links. + # This is not a good way to do this, but it will work for now + # and we all know dirty hacks stay around forever so don't + # expect this to be fixed for a while. + if value =~ /^mailto:/ then + if node.data.value == key then + child = Tree.new(key, value, node.data.depth + 1, @debug) + @children << child + end + else + if node.data.value == key && node.data.depth<@max_depth then + child = Tree.new(key, value, node.data.depth + 1, @debug) + @children << child + end + end } end end @@ -760,7 +771,7 @@ def usage email_outfile_file = outfile_file end -if meta_outfile && email +if meta_outfile && meta begin meta_outfile_file = File.new(meta_outfile, "w") rescue diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..17b2533 --- /dev/null +++ b/compose.yml @@ -0,0 +1,4 @@ +services: + cewl: + build: . + image: ghcr.io/digininja/cewl:latest