jekyll-activity-pub 0.1.0rc13 → 0.1.0rc14
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 +32 -11
- metadata +2 -4
- data/lib/jekyll/activity_pub/cache.rb +0 -10
- data/lib/jekyll/activity_pub/tomsbtone.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaea38dc037b09e85e37555dfcf89e0f974107a0699a600d9c2f8f5f031f6a72
|
4
|
+
data.tar.gz: fef291e74969a128d2ed950ea9a0f2fda5fc93b5fc45fa851ea8b6f07d15aed9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e27745239477eef2a66b1d0dee32af27b4e58219d381e5720abf0d158a38ea31a3e113a9b812b40b4faadbfed48925e0e242c7012d9c4cd428fd725e77f18f07
|
7
|
+
data.tar.gz: ee3dff54f5c6f549286bc3009063d99513a2d2fc73ffaec6d188f9988866d1c15135dc8662ca0cc1a4b9d9dfc4891546a9391bec7e579ef88481e4f6e6f64176
|
@@ -53,14 +53,20 @@ module Jekyll
|
|
53
53
|
@@site
|
54
54
|
end
|
55
55
|
|
56
|
+
def url
|
57
|
+
config['url'].tap do |u|
|
58
|
+
abort_if_missing('activity_pub.url', u, '_config.yml')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
56
62
|
# @return [String]
|
57
63
|
def followers_url
|
58
|
-
"#{
|
64
|
+
"#{url}/v1/#{actor}/followers"
|
59
65
|
end
|
60
66
|
|
61
67
|
# @return [String]
|
62
68
|
def following_url
|
63
|
-
"#{
|
69
|
+
"#{url}/v1/#{actor}/following"
|
64
70
|
end
|
65
71
|
|
66
72
|
# Save the public key URL for later
|
@@ -70,11 +76,13 @@ module Jekyll
|
|
70
76
|
data['public_key_url'] = url
|
71
77
|
end
|
72
78
|
|
73
|
-
# Public key URL
|
79
|
+
# Public key URL, raises error if missing
|
74
80
|
#
|
75
|
-
# @return [String
|
81
|
+
# @return [String]
|
76
82
|
def public_key_url
|
77
|
-
data['public_key_url']
|
83
|
+
data['public_key_url'].tap do |pk|
|
84
|
+
abort_if_missing('public_key_url', pk)
|
85
|
+
end
|
78
86
|
end
|
79
87
|
|
80
88
|
def actor=(actor)
|
@@ -82,7 +90,9 @@ module Jekyll
|
|
82
90
|
end
|
83
91
|
|
84
92
|
def actor
|
85
|
-
data['actor']
|
93
|
+
data['actor'].tap do |a|
|
94
|
+
abort_if_missing('actor', a)
|
95
|
+
end
|
86
96
|
end
|
87
97
|
|
88
98
|
def actor_url=(url)
|
@@ -90,7 +100,9 @@ module Jekyll
|
|
90
100
|
end
|
91
101
|
|
92
102
|
def actor_url
|
93
|
-
data['actor_url']
|
103
|
+
data['actor_url'].tap do |au|
|
104
|
+
abort_if_missing('actor_url', au)
|
105
|
+
end
|
94
106
|
end
|
95
107
|
|
96
108
|
# Send notifications
|
@@ -148,6 +160,8 @@ module Jekyll
|
|
148
160
|
|
149
161
|
# Store everything for later
|
150
162
|
save
|
163
|
+
rescue NotificationError => e
|
164
|
+
Jekyll.logger.abort_with 'ActivityPub:', e.message
|
151
165
|
end
|
152
166
|
|
153
167
|
# Return data
|
@@ -274,7 +288,9 @@ module Jekyll
|
|
274
288
|
#
|
275
289
|
# @return [String, nil]
|
276
290
|
def private_key_path
|
277
|
-
@@private_key_path ||= site.config['activity_pub_private_key']
|
291
|
+
@@private_key_path ||= site.config['activity_pub_private_key'].tap do |pk|
|
292
|
+
abort_if_missing '--key', pk, 'notify command'
|
293
|
+
end
|
278
294
|
end
|
279
295
|
|
280
296
|
# Returns the private key
|
@@ -283,8 +299,7 @@ module Jekyll
|
|
283
299
|
def private_key
|
284
300
|
@@private_key ||= File.read private_key_path
|
285
301
|
rescue StandardError
|
286
|
-
Jekyll.logger.
|
287
|
-
raise
|
302
|
+
Jekyll.logger.abort_with 'ActivityPub:', 'There\'s an issue with your private key'
|
288
303
|
end
|
289
304
|
|
290
305
|
# @return [Hash]
|
@@ -295,7 +310,7 @@ module Jekyll
|
|
295
310
|
def client
|
296
311
|
@@client ||= DistributedPress::V1::Social::Client.new(
|
297
312
|
private_key_pem: private_key,
|
298
|
-
url:
|
313
|
+
url: url,
|
299
314
|
public_key_url: public_key_url,
|
300
315
|
logger: Jekyll.logger
|
301
316
|
)
|
@@ -361,6 +376,12 @@ module Jekyll
|
|
361
376
|
PseudoObject.new(url: rel, site: site, relative_path: rel, data: data)
|
362
377
|
end
|
363
378
|
end
|
379
|
+
|
380
|
+
def abort_if_missing(key_name, value, file = '_data/activity_pub.yml')
|
381
|
+
return unless value.nil? || value.empty?
|
382
|
+
|
383
|
+
Jekyll.logger.abort_with 'ActivityPub:', "Missing #{key_name} in #{file}"
|
384
|
+
end
|
364
385
|
end
|
365
386
|
end
|
366
387
|
end
|
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.1.
|
4
|
+
version: 0.1.0rc14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sutty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: distributed-press-api-client
|
@@ -143,7 +143,6 @@ files:
|
|
143
143
|
- lib/jekyll/activity_pub.rb
|
144
144
|
- lib/jekyll/activity_pub/activity.rb
|
145
145
|
- lib/jekyll/activity_pub/actor.rb
|
146
|
-
- lib/jekyll/activity_pub/cache.rb
|
147
146
|
- lib/jekyll/activity_pub/commands.rb
|
148
147
|
- lib/jekyll/activity_pub/create.rb
|
149
148
|
- lib/jekyll/activity_pub/delete.rb
|
@@ -158,7 +157,6 @@ files:
|
|
158
157
|
- lib/jekyll/activity_pub/outbox.rb
|
159
158
|
- lib/jekyll/activity_pub/property_value.rb
|
160
159
|
- lib/jekyll/activity_pub/public_key.rb
|
161
|
-
- lib/jekyll/activity_pub/tomsbtone.rb
|
162
160
|
- lib/jekyll/activity_pub/update.rb
|
163
161
|
- lib/jekyll/activity_pub/webfinger.rb
|
164
162
|
- lib/jekyll/command_extension.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'jekyll/page'
|
4
|
-
require_relative 'helper'
|
5
|
-
|
6
|
-
module Jekyll
|
7
|
-
module ActivityPub
|
8
|
-
# Represents a removed activity
|
9
|
-
class Tombstone < Jekyll::Page
|
10
|
-
include Helper
|
11
|
-
|
12
|
-
# @param :object_id [String]
|
13
|
-
attr_reader :object_id
|
14
|
-
|
15
|
-
# Initialize with default data
|
16
|
-
#
|
17
|
-
# @param :site [Jekyll::Site]
|
18
|
-
# @param :object_id [String]
|
19
|
-
def initialize(site, object_id, )
|
20
|
-
@context = StubContext.new(registers: { site: site })
|
21
|
-
@object_id = object_id
|
22
|
-
|
23
|
-
dest = Pathname.new(object.destination(site.dest)).relative_path_from(site.dest)
|
24
|
-
name = 'tombstone.jsonld'
|
25
|
-
dir = File.join(
|
26
|
-
File.dirname(dest),
|
27
|
-
File.basename(dest, '.jsonld')
|
28
|
-
)
|
29
|
-
|
30
|
-
super(site, '', dir, name)
|
31
|
-
|
32
|
-
trigger_hooks :post_init
|
33
|
-
end
|
34
|
-
|
35
|
-
def read_yaml(*)
|
36
|
-
@data = {
|
37
|
-
'@context' => 'https://www.w3.org/ns/activitystreams',
|
38
|
-
'type' => 'Tomsbtone',
|
39
|
-
'id' => absolute_url(object_id),
|
40
|
-
'published' => object.data[DATE_ATTRIBUTE],
|
41
|
-
'to' => object.data['to'],
|
42
|
-
'cc' => object.data['cc'],
|
43
|
-
'object' => object.data,
|
44
|
-
'inReplyTo' => object.data['in_reply_to']
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
# @return [Time]
|
49
|
-
def date
|
50
|
-
@date ||= Time.parse(object.data[DATE_ATTRIBUTE])
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def type
|
56
|
-
@type ||= self.class.name.split('::').last
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|