jekyll-activity-pub 0.2.5 → 0.2.7
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/activity_pub/notifier.rb +6 -1
- data/lib/jekyll-activity-pub-fep-1042.rb +30 -13
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5dbbab91a509e4edbb918ef90128a03415c702d3ff517c4d6466a3f38f183d1
|
4
|
+
data.tar.gz: 0c99c1dd59dfdf75144ba48a8a1b820aa5ad2adec542edb3aebca4a05b1cebea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed1203e6aac6abd5aaa2130c6bf6ed7d47130a18a4c3866ee078cee1d7c963e5d71e9285a6dbadfe8a096ca32ebadf215747edc33fde40a2f694457a829ed991
|
7
|
+
data.tar.gz: 4d5e3a40dcd8d3fc8e64110c88d26319188d2ea43899c455b110c1cf154841114182033da31fd6fe0f02b67bfaaaf4c12567a896d7e5f28a4ab693f027dc0faa
|
@@ -55,6 +55,11 @@ module Jekyll
|
|
55
55
|
@@site
|
56
56
|
end
|
57
57
|
|
58
|
+
# Announce the website?
|
59
|
+
def announce?
|
60
|
+
!!config['announce']
|
61
|
+
end
|
62
|
+
|
58
63
|
def url
|
59
64
|
config['url'].tap do |u|
|
60
65
|
abort_if_missing('activity_pub.url', u, '_config.yml')
|
@@ -127,7 +132,7 @@ module Jekyll
|
|
127
132
|
# @todo Updating/Key rotation seems broken for now
|
128
133
|
# @see {https://github.com/hyphacoop/social.distributed.press/issues/51}
|
129
134
|
unless inbox.get.ok?
|
130
|
-
unless (response = inbox.create(actor_url)).ok?
|
135
|
+
unless (response = inbox.create(actor_url, announce?)).ok?
|
131
136
|
raise NotificationError, "Couldn't create/update inbox (#{response.code}: #{response.message})"
|
132
137
|
end
|
133
138
|
end
|
@@ -16,6 +16,19 @@ Jekyll::Hooks.register %i[actor activity], :post_init, priority: 8 do |page|
|
|
16
16
|
|
17
17
|
site = page.site
|
18
18
|
|
19
|
+
# @param uri [URI,Addressable::URI]
|
20
|
+
# @param protocol [String]
|
21
|
+
# @return [URI,Addressable::URI]
|
22
|
+
def add_protocol_to_uri(uri, protocol)
|
23
|
+
uri.scheme = protocol
|
24
|
+
|
25
|
+
if protocol != 'https' && uri.path.end_with?('.jsonld')
|
26
|
+
uri.path = uri.path.sub('.jsonld', ".#{protocol}.jsonld")
|
27
|
+
end
|
28
|
+
|
29
|
+
uri
|
30
|
+
end
|
31
|
+
|
19
32
|
# Changes the URLs from a base URL to have a different scheme
|
20
33
|
#
|
21
34
|
# @param object [Any]
|
@@ -33,9 +46,7 @@ Jekyll::Hooks.register %i[actor activity], :post_init, priority: 8 do |page|
|
|
33
46
|
end
|
34
47
|
when String
|
35
48
|
if object.start_with? base_url
|
36
|
-
Addressable::URI.parse(object).
|
37
|
-
uri.scheme = scheme
|
38
|
-
end.to_s
|
49
|
+
add_protocol_to_uri(Addressable::URI.parse(object), scheme).to_s
|
39
50
|
else
|
40
51
|
object
|
41
52
|
end
|
@@ -52,24 +63,30 @@ Jekyll::Hooks.register %i[actor activity], :post_init, priority: 8 do |page|
|
|
52
63
|
end
|
53
64
|
end
|
54
65
|
|
55
|
-
uri = Addressable::URI.parse page.data['id']
|
56
66
|
url = page.data['url']
|
67
|
+
formats = ['application/ld+json; profile="https://www.w3.org/ns/activitystreams"', 'application/activity+json']
|
68
|
+
data = page.pruned_data
|
57
69
|
|
70
|
+
# TODO: Fetch enabled protocols from DP API
|
58
71
|
%w[https ipns hyper bittorrent].each do |protocol|
|
59
|
-
uri
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
Jekyll::ActivityPub::Link.new(site, uri.to_s, 'alternate',
|
72
|
+
uri = Addressable::URI.parse(page.data['id'])
|
73
|
+
add_protocol_to_uri(uri, protocol)
|
74
|
+
|
75
|
+
formats.each do |format|
|
76
|
+
url << Jekyll::ActivityPub::Link.new(site, uri.to_s, 'alternate', format)
|
77
|
+
end
|
64
78
|
end
|
65
79
|
|
66
80
|
%w[ipns hyper bittorrent].each do |protocol|
|
67
|
-
|
68
|
-
|
81
|
+
uri = Addressable::URI.parse(page.data['id'])
|
82
|
+
add_protocol_to_uri(uri, protocol)
|
69
83
|
|
70
|
-
|
71
|
-
|
84
|
+
Jekyll.logger.debug 'FEP 1042:', "Generating #{uri.path} (#{protocol})"
|
85
|
+
|
86
|
+
json = convert_uris(data, site.config['url'], protocol)
|
87
|
+
json['url'] = url
|
72
88
|
json['id'] = uri.to_s
|
89
|
+
|
73
90
|
# XXX: Only works on forward slash OSes
|
74
91
|
path = uri.path.sub(%r{\A/}, '')
|
75
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-activity-pub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sutty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: distributed-press-api-client
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4.
|
19
|
+
version: 0.4.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.4.
|
26
|
+
version: 0.4.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jekyll
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|