jekyll-webmention_io 2.2.1 → 2.3.0
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 +4 -4
- data/lib/jekyll/commands/webmention.rb +33 -34
- data/lib/jekyll/tags/webmentions_head.rb +6 -0
- data/lib/jekyll/webmention_io/version.rb +1 -1
- data/lib/jekyll/webmention_io.rb +9 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c117bdfd999aabbbaf34a7baa34510806ec30250
|
4
|
+
data.tar.gz: df0874f2a17993d0fc40fc8d826b1fe7f64c3cb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90bac1c91f4c780eb9ad39ee4eec4dad12272797bd8d00ec3e7924c670449450281b0e6b2970877202ca8d9b9fc490ae4426f207aee29b552fb291817434d069
|
7
|
+
data.tar.gz: 89524277af525e270403ed3f9e57cfa966e72348fbb61971d44f435ba362d4fedd8c711ce4b529f1636762d46f8c89d17d699e94b512a58f8f4972c49261dec6
|
@@ -5,44 +5,43 @@ module Jekyll
|
|
5
5
|
prog.command(:webmention) do |c|
|
6
6
|
c.syntax 'webmention'
|
7
7
|
c.description 'Sends queued webmentions'
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
c.action { |args, options| process args, options }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.process( args=[], options={} )
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end # def process
|
14
|
+
cached_outgoing = Jekyll::WebmentionIO::get_cache_file_path 'outgoing'
|
15
|
+
cached_sent = Jekyll::WebmentionIO::get_cache_file_path 'sent'
|
16
|
+
if File.exists?(cached_outgoing)
|
17
|
+
if File.exists?(cached_sent)
|
18
|
+
sent = open(cached_sent) { |f| YAML.load(f) }
|
19
|
+
else
|
20
|
+
sent = {}
|
21
|
+
end # file exists (sent)
|
22
|
+
outgoing = open(cached_outgoing) { |f| YAML.load(f) }
|
23
|
+
outgoing.each_pair do |source, targets|
|
24
|
+
if ! sent[source] or ! sent[source].kind_of? Array
|
25
|
+
sent[source] = Array.new
|
26
|
+
end
|
27
|
+
targets.each do |target|
|
28
|
+
if target and ! sent[source].find_index( target )
|
29
|
+
if target.index( "//" ) == 0
|
30
|
+
target = "http:#{target}"
|
31
|
+
end
|
32
|
+
endpoint = Jekyll::WebmentionIO::get_webmention_endpoint( target )
|
33
|
+
if endpoint
|
34
|
+
response = Jekyll::WebmentionIO::webmention( source, target, endpoint )
|
35
|
+
if response
|
36
|
+
sent[source].push( target )
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
File.open(cached_sent, 'w') { |f| YAML.dump(sent, f) }
|
43
|
+
end # file exists (outgoing)
|
44
|
+
end # def process
|
46
45
|
end # WebmentionCommand
|
47
46
|
end # Commands
|
48
47
|
end # Jekyll
|
@@ -25,6 +25,12 @@ module Jekyll
|
|
25
25
|
head << "<meta property=\"webmention:redirected_from\" content=\"#{redirect}\">"
|
26
26
|
end
|
27
27
|
|
28
|
+
config = site.config['webmentions']
|
29
|
+
if config.has_key? 'username'
|
30
|
+
head << "<link rel=\"pingback\" href=\"https://webmention.io/#{config['username']}/xmlrpc\">"
|
31
|
+
head << "<link rel=\"webmention\" href=\"https://webmention.io/#{config['username']}/webmention\">"
|
32
|
+
end
|
33
|
+
|
28
34
|
head
|
29
35
|
end
|
30
36
|
end
|
data/lib/jekyll/webmention_io.rb
CHANGED
@@ -12,6 +12,7 @@ require 'net/http'
|
|
12
12
|
require 'uri'
|
13
13
|
require 'openssl'
|
14
14
|
require 'string_inflection'
|
15
|
+
require 'webmention'
|
15
16
|
|
16
17
|
module Jekyll
|
17
18
|
module WebmentionIO
|
@@ -98,12 +99,17 @@ module Jekyll
|
|
98
99
|
|
99
100
|
def self.get_webmention_endpoint( uri )
|
100
101
|
log 'info', "Looking for webmention endpoint at #{uri}"
|
101
|
-
|
102
|
+
endpoint = Webmention::Client.supports_webmention?( uri )
|
103
|
+
if ! endpoint
|
104
|
+
log 'info', "No webmention endpoint at #{uri}"
|
105
|
+
end
|
106
|
+
endpoint
|
102
107
|
end
|
103
108
|
|
104
109
|
def self.webmention( source, target, endpoint )
|
105
|
-
log 'info', "Sending webmention of #{source} to #{endpoint}"
|
106
|
-
return `curl -s -i -d \"source=#{source}&target=#{target}\" -o /dev/null #{endpoint}`
|
110
|
+
log 'info', "Sending webmention of #{target} in #{source} to #{endpoint}"
|
111
|
+
#return `curl -s -i -d \"source=#{source}&target=#{target}\" -o /dev/null #{endpoint}`
|
112
|
+
return Webmention::Client.send_mention( endpoint, source, target, true )
|
107
113
|
end
|
108
114
|
|
109
115
|
# Utilities
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-webmention_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Gustafson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -114,6 +114,20 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '3.2'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: webmention
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.1.6
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 0.1.6
|
117
131
|
- !ruby/object:Gem::Dependency
|
118
132
|
name: bundler
|
119
133
|
requirement: !ruby/object:Gem::Requirement
|