jekyll-activity-pub 0.2.9 → 0.3.0rc0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b0f6f6119fa44051c64bd08a383c53abfa24e14becf78d7b3864024095f908f
4
- data.tar.gz: b6b7f3d104dc9b02b4116f6f19a3b2ebbbf7644343842af0d90e2d271c060f86
3
+ metadata.gz: b080ff169e0ffc7f1fd426bb430184dd6bdc31892e7e6e2e9c04743120da2d12
4
+ data.tar.gz: c204a966b5a1d13de4b16b1702abf04dd8534619eeea8c1fb306fdd22b576f42
5
5
  SHA512:
6
- metadata.gz: 5e48160e0d713f7c3cd9cbdafe8f60bc1d0fbeb55d369585d34b498ffa33065f0d5870bef2182364abff7b86813c2f4b4c5648dd995d9f0b938df0bf6a928bab
7
- data.tar.gz: 4425e4ec5ddcd7cc9c0a283fbe72570016dd6c3d0089946b497a9dcc1372544807982a7eae9ade1d2045f30d73f2b63b7a5d50f8f571d372241a5537c1b8ffa4
6
+ metadata.gz: 1c30c6370c280c624afede374d625d54ed28013ca8e054979ba8a28272bf0ff010d4db0280a8368597a3e04d3dbe49590e5ea60430e0d84a851cc3a164461a87
7
+ data.tar.gz: a0c722700b32111c2d4cbad2806dee25155f3dbce9981844215fbb7d4a0bbb484188b3ed400d37847873dc1d87de9f2c4858af541c985e04e9b35f1efe9a6cca
@@ -11,6 +11,9 @@ module Jekyll
11
11
  class Activity < Jekyll::Page
12
12
  include Helper
13
13
 
14
+ # HTML white space removal
15
+ WHITE_SPACE = />\s+</.freeze
16
+
14
17
  # @param :doc [Jekyll::Document]
15
18
  attr_reader :doc
16
19
 
@@ -37,6 +40,8 @@ module Jekyll
37
40
 
38
41
  # @return [nil]
39
42
  def read_yaml(*)
43
+ doc_content = doc.content.tr("\n", '').gsub(WHITE_SPACE, '><')
44
+
40
45
  self.data = {
41
46
  '@context' => [
42
47
  'https://www.w3.org/ns/activitystreams',
@@ -58,14 +63,14 @@ module Jekyll
58
63
  'cc' => [Notifier.followers_url],
59
64
  'inReplyTo' => doc.data['in_reply_to'],
60
65
  'sensitive' => sensitive?,
61
- 'content' => doc.content,
66
+ 'content' => doc_content,
62
67
  'name' => doc.data['title'],
63
68
  'contentMap' => {
64
- locale => doc.content
69
+ locale => doc_content
65
70
  },
66
71
  'attachment' => attachments,
67
72
  'tag' => [],
68
- 'replies' => []
73
+ 'replies' => Notifier.client.absolute_url(Notifier.replies(absolute_url(url)).endpoint)
69
74
  }
70
75
 
71
76
  nil
@@ -6,6 +6,7 @@ require 'distributed_press/version'
6
6
  require 'distributed_press/v1/social/client'
7
7
  require 'distributed_press/v1/social/inbox'
8
8
  require 'distributed_press/v1/social/outbox'
9
+ require 'distributed_press/v1/social/replies'
9
10
  require_relative 'errors'
10
11
  require_relative 'create'
11
12
  require_relative 'update'
@@ -273,6 +274,32 @@ module Jekyll
273
274
  @@relative_path ||= Pathname.new(path).relative_path_from(site.source).to_s
274
275
  end
275
276
 
277
+ def client
278
+ @@client ||= DistributedPress::V1::Social::Client.new(
279
+ private_key_pem: private_key,
280
+ url: url,
281
+ public_key_url: public_key_url,
282
+ logger: Jekyll.logger
283
+ )
284
+ end
285
+
286
+ def inbox
287
+ @@inbox ||= DistributedPress::V1::Social::Inbox.new(client: client, actor: actor)
288
+ end
289
+
290
+ def outbox
291
+ @@outbox ||= DistributedPress::V1::Social::Outbox.new(client: client, actor: actor)
292
+ end
293
+
294
+ # Generates a Replies client per activity
295
+ #
296
+ # @param activity [String] Activity ID
297
+ # @return [DistributedPress::V1::Social::Replies]
298
+ def replies(activity)
299
+ @@replies ||= {}
300
+ @@replies[activity] ||= DistributedPress::V1::Social::Replies.new(client: client, actor: actor, activity: activity)
301
+ end
302
+
276
303
  private
277
304
 
278
305
  # Finds the private key path on config
@@ -298,23 +325,6 @@ module Jekyll
298
325
  @@config ||= site.config['activity_pub'] || {}
299
326
  end
300
327
 
301
- def client
302
- @@client ||= DistributedPress::V1::Social::Client.new(
303
- private_key_pem: private_key,
304
- url: url,
305
- public_key_url: public_key_url,
306
- logger: Jekyll.logger
307
- )
308
- end
309
-
310
- def inbox
311
- @@inbox ||= DistributedPress::V1::Social::Inbox.new(client: client, actor: actor)
312
- end
313
-
314
- def outbox
315
- @@outbox ||= DistributedPress::V1::Social::Outbox.new(client: client, actor: actor)
316
- end
317
-
318
328
  # Run action
319
329
  #
320
330
  # @param :path [String]
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.9
4
+ version: 0.3.0rc0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sutty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2024-06-14 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.2
19
+ version: 0.5.0rc1
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.2
26
+ version: 0.5.0rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -205,9 +205,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
205
  version: '2.7'
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - ">="
208
+ - - ">"
209
209
  - !ruby/object:Gem::Version
210
- version: '0'
210
+ version: 1.3.1
211
211
  requirements: []
212
212
  rubygems_version: 3.3.26
213
213
  signing_key: