webmention 6.0.0 → 7.0.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 +12 -4
- data/CONTRIBUTING.md +2 -2
- data/README.md +2 -2
- data/lib/webmention/client.rb +1 -1
- data/lib/webmention/parser.rb +2 -0
- data/lib/webmention/parsers/html_parser.rb +15 -21
- data/lib/webmention/parsers/json_parser.rb +8 -20
- data/lib/webmention/parsers/plaintext_parser.rb +1 -1
- data/lib/webmention/request.rb +1 -1
- data/lib/webmention/version.rb +1 -1
- data/lib/webmention.rb +1 -1
- data/webmention.gemspec +4 -4
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 387888cbf5a1a801aad4b0d227ca65a1409368bbfeb531f49fd81419af4bfa90
|
4
|
+
data.tar.gz: 2fc1836b5b4384de39d3a69d16d9ad2cc36b4d7aa77a93b14b644dbab59ae751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ddb3194c1745c61a60820c06146ef0e0eb9fa87ab8c7d1a8eaba4d70d360f553915629534d93ab8785b1e33fab5ed2b526219c3dba1f8f953b72c9fb4ececc2
|
7
|
+
data.tar.gz: b32cd9acc63647cc1b8548a4d23a029858f8897f8e34747be18451e040f938943090596903006716d564f1b6e74ac791cf788e36a4696244a70190a83634ddd4
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 7.0.0 / 2022-11-09
|
4
|
+
|
5
|
+
- Refactor HTML and JSON parser classes (ec58206 and 6818c05)
|
6
|
+
- Update indieweb-endpoints dependency constraint (4cd742f)
|
7
|
+
- Relax nokogiri dependency constraint (e86f3bc)
|
8
|
+
- **Breaking change:** Update development Ruby to 2.7.6 and minimum Ruby to 2.7 (5bee7dd)
|
9
|
+
|
10
|
+
## 6.0.0 / 2022-05-13
|
4
11
|
|
5
12
|
### New Features
|
6
13
|
|
@@ -8,6 +15,7 @@
|
|
8
15
|
- `Webmention.send_webmention(source, target)`
|
9
16
|
- `Webmention.send_webmentions(source, *targets)`
|
10
17
|
- `Webmention.mentioned_urls(url)`
|
18
|
+
- `Webmention.verify_webmention(source, target)`
|
11
19
|
- New JSON and plaintext parsers
|
12
20
|
- [Vouch](https://indieweb.org/Vouch) URL support (9829269)
|
13
21
|
- Webmention verification support (5fe5f58 and 100644)
|
@@ -31,17 +39,17 @@
|
|
31
39
|
- Migrate test suite to RSpec (79ac684)
|
32
40
|
- Migrate to GitHub Actions (f5a3d7a)
|
33
41
|
|
34
|
-
##
|
42
|
+
## 5.0.0 / 2020-12-13
|
35
43
|
|
36
44
|
- Update absolutely and indieweb-endpoints gems to v5.0 (89f4ea8)
|
37
45
|
|
38
|
-
##
|
46
|
+
## 4.0.0 / 2020-08-23
|
39
47
|
|
40
48
|
- **Breaking change:** Update minimum supported Ruby version to 2.5 (b2bc62f)
|
41
49
|
- Update indieweb-endpoints to 4.0 (e61588f)
|
42
50
|
- Update project Ruby version to 2.5.8 (2a626a6)
|
43
51
|
|
44
|
-
##
|
52
|
+
## 3.0.0 / 2020-05-19
|
45
53
|
|
46
54
|
- Reject "internal" URLs when sending webmentions (#24) (ccc82c8)
|
47
55
|
- Select only HTTP/HTTPS URLs when sending webmentions (#22) (39e5852)
|
data/CONTRIBUTING.md
CHANGED
@@ -8,9 +8,9 @@ There are a couple ways you can help improve webmention-client-ruby:
|
|
8
8
|
|
9
9
|
## Getting Started
|
10
10
|
|
11
|
-
webmention-client-ruby is developed using Ruby 2.6
|
11
|
+
webmention-client-ruby is developed using Ruby 2.7.6 and is additionally tested against Ruby 3.0 and 3.1 using [GitHub Actions](https://github.com/indieweb/webmention-client-ruby/actions).
|
12
12
|
|
13
|
-
Before making changes to webmention-client-ruby, you'll want to install Ruby 2.6.
|
13
|
+
Before making changes to webmention-client-ruby, you'll want to install Ruby 2.7.6. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.7.6 using your method of choice, install the project's gems by running:
|
14
14
|
|
15
15
|
```sh
|
16
16
|
bundle install
|
data/README.md
CHANGED
@@ -17,9 +17,9 @@
|
|
17
17
|
|
18
18
|
## Getting Started
|
19
19
|
|
20
|
-
Before installing and using webmention-client-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.
|
20
|
+
Before installing and using webmention-client-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.7 (or newer) installed. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm).
|
21
21
|
|
22
|
-
webmention-client-ruby is developed using Ruby 2.6
|
22
|
+
webmention-client-ruby is developed using Ruby 2.7.6 and is additionally tested against Ruby 3.0 and 3.1 using [GitHub Actions](https://github.com/indieweb/webmention-client-ruby/actions).
|
23
23
|
|
24
24
|
## Installation
|
25
25
|
|
data/lib/webmention/client.rb
CHANGED
@@ -104,7 +104,7 @@ module Webmention
|
|
104
104
|
# targets = ['https://aaronpk.example/notes/1', 'https://adactio.example/notes/1']
|
105
105
|
# client.send_webmentions(targets)
|
106
106
|
#
|
107
|
-
# @param
|
107
|
+
# @param targets [Array<String, HTTP::URI, #to_s>]
|
108
108
|
# An array of absolute URLs representing multiple target documents.
|
109
109
|
#
|
110
110
|
# @return [Array<Webmention::Response, Webmention::ErrorResponse>]
|
data/lib/webmention/parser.rb
CHANGED
@@ -30,9 +30,8 @@ module Webmention
|
|
30
30
|
# @return [Array<String>] An array of absolute URLs.
|
31
31
|
def results
|
32
32
|
@results ||=
|
33
|
-
|
34
|
-
|
35
|
-
.grep(Parser::URI_REGEXP)
|
33
|
+
extract_urls_from(*url_attributes).map { |url| response_uri.join(url).to_s }
|
34
|
+
.grep(Parser::URI_REGEXP)
|
36
35
|
end
|
37
36
|
|
38
37
|
private
|
@@ -42,6 +41,19 @@ module Webmention
|
|
42
41
|
Nokogiri.HTML5(response_body)
|
43
42
|
end
|
44
43
|
|
44
|
+
# @param attributes [Array<Nokogiri::XML::Attr>]
|
45
|
+
#
|
46
|
+
# @return [Array<String>]
|
47
|
+
def extract_urls_from(*attributes)
|
48
|
+
attributes.flat_map do |attribute|
|
49
|
+
if attribute.name == 'srcset'
|
50
|
+
attribute.value.split(',').map { |value| value.strip.match(/^\S+/).to_s }
|
51
|
+
else
|
52
|
+
attribute.value
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
45
57
|
# @return [Nokogiri::XML::Element]
|
46
58
|
def root_node
|
47
59
|
doc.at_css(*ROOT_NODE_SELECTORS_ARRAY)
|
@@ -56,24 +68,6 @@ module Webmention
|
|
56
68
|
def url_nodes
|
57
69
|
root_node.css(*CSS_SELECTORS_ARRAY)
|
58
70
|
end
|
59
|
-
|
60
|
-
module UrlExtractor
|
61
|
-
# @param *attributes [Array<Nokogiri::XML::Attr>]
|
62
|
-
#
|
63
|
-
# @return [Array<String>]
|
64
|
-
def self.extract(*attributes)
|
65
|
-
attributes.flat_map { |attribute| values_from(attribute) }
|
66
|
-
end
|
67
|
-
|
68
|
-
# @param attribute [Nokogiri::XML::Attr]
|
69
|
-
#
|
70
|
-
# @return [String, Array<String>]
|
71
|
-
def self.values_from(attribute)
|
72
|
-
return attribute.value unless attribute.name == 'srcset'
|
73
|
-
|
74
|
-
attribute.value.split(',').map { |value| value.strip.match(/^\S+/).to_s }
|
75
|
-
end
|
76
|
-
end
|
77
71
|
end
|
78
72
|
end
|
79
73
|
end
|
@@ -10,30 +10,18 @@ module Webmention
|
|
10
10
|
|
11
11
|
# @return [Array<String>] An array of absolute URLs.
|
12
12
|
def results
|
13
|
-
@results ||=
|
13
|
+
@results ||= extract_urls_from(JSON.parse(response_body))
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
# @
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
# @return [Array<String>]
|
27
|
-
def self.extract(*objs)
|
28
|
-
objs.flat_map { |obj| values_from(obj) }
|
29
|
-
end
|
30
|
-
|
31
|
-
# @param obj [Hash, Array, String, Integer, Boolean, nil]
|
32
|
-
#
|
33
|
-
# @return [Array<String>, String, nil]
|
34
|
-
def self.values_from(obj)
|
35
|
-
return obj.flat_map { |value| extract(value) }.compact if obj.is_a?(Array)
|
36
|
-
return extract(obj.values) if obj.is_a?(Hash)
|
18
|
+
# @param objs [Array<Hash, Array, String, Integer, Boolean, nil>]
|
19
|
+
#
|
20
|
+
# @return [Array<String>]
|
21
|
+
def extract_urls_from(*objs)
|
22
|
+
objs.flat_map do |obj|
|
23
|
+
return obj.flat_map { |value| extract_urls_from(value) }.compact if obj.is_a?(Array)
|
24
|
+
return extract_urls_from(obj.values) if obj.is_a?(Hash)
|
37
25
|
|
38
26
|
obj if obj.is_a?(String) && obj.match?(Parser::URI_REGEXP)
|
39
27
|
end
|
data/lib/webmention/request.rb
CHANGED
@@ -57,7 +57,7 @@ module Webmention
|
|
57
57
|
# An absolute URL representing a source document.
|
58
58
|
# @option options [String] :target
|
59
59
|
# An absolute URL representing a target document.
|
60
|
-
# @
|
60
|
+
# @option options [String] :vouch
|
61
61
|
# An absolute URL representing a document vouching for the source document.
|
62
62
|
# See https://indieweb.org/Vouch for additional details.
|
63
63
|
#
|
data/lib/webmention/version.rb
CHANGED
data/lib/webmention.rb
CHANGED
@@ -76,7 +76,7 @@ module Webmention
|
|
76
76
|
#
|
77
77
|
# @param source [String, HTTP::URI, #to_s]
|
78
78
|
# An absolute URL representing a source document.
|
79
|
-
# @param
|
79
|
+
# @param targets [Array<String, HTTP::URI, #to_s>]
|
80
80
|
# An array of absolute URLs representing multiple target documents.
|
81
81
|
# @param vouch [String, HTTP::URI, #to_s]
|
82
82
|
# An absolute URL representing a document vouching for the source document.
|
data/webmention.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative 'lib/webmention/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.required_ruby_version = '>= 2.
|
6
|
+
spec.required_ruby_version = '>= 2.7', '< 4'
|
7
7
|
|
8
8
|
spec.name = 'webmention'
|
9
9
|
spec.version = Webmention::VERSION
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ['jason@sixtwothree.org']
|
12
12
|
|
13
13
|
spec.summary = 'Webmention notification client'
|
14
|
-
spec.description = 'A Ruby gem for sending Webmention notifications.'
|
14
|
+
spec.description = 'A Ruby gem for sending and verifying Webmention notifications.'
|
15
15
|
spec.homepage = 'https://github.com/indieweb/webmention-client-ruby'
|
16
16
|
spec.license = 'Apache-2.0'
|
17
17
|
|
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
}
|
29
29
|
|
30
30
|
spec.add_runtime_dependency 'http', '~> 5.0'
|
31
|
-
spec.add_runtime_dependency 'indieweb-endpoints', '~>
|
32
|
-
spec.add_runtime_dependency 'nokogiri', '
|
31
|
+
spec.add_runtime_dependency 'indieweb-endpoints', '~> 8.0'
|
32
|
+
spec.add_runtime_dependency 'nokogiri', '>= 1.13'
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmention
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Garber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -30,29 +30,29 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '8.0'
|
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: '8.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.13'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.13'
|
55
|
-
description: A Ruby gem for sending Webmention notifications.
|
55
|
+
description: A Ruby gem for sending and verifying Webmention notifications.
|
56
56
|
email:
|
57
57
|
- jason@sixtwothree.org
|
58
58
|
executables: []
|
@@ -82,7 +82,7 @@ licenses:
|
|
82
82
|
- Apache-2.0
|
83
83
|
metadata:
|
84
84
|
bug_tracker_uri: https://github.com/indieweb/webmention-client-ruby/issues
|
85
|
-
changelog_uri: https://github.com/indieweb/webmention-client-ruby/blob/
|
85
|
+
changelog_uri: https://github.com/indieweb/webmention-client-ruby/blob/v7.0.0/CHANGELOG.md
|
86
86
|
rubygems_mfa_required: 'true'
|
87
87
|
post_install_message:
|
88
88
|
rdoc_options: []
|
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '2.
|
95
|
+
version: '2.7'
|
96
96
|
- - "<"
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '4'
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.3.
|
105
|
+
rubygems_version: 3.3.16
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Webmention notification client
|