jekyll-activitypub-static 0.7.6 → 0.9.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/LICENSE +165 -201
- data/README.md +108 -8
- data/lib/jekyll/activitypub_static/generator.rb +96 -11
- data/lib/jekyll/activitypub_static/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 474e7a72176ed92f873aa65bcee1b79b1069ec2e124a23fee429741a81bc00e2
|
|
4
|
+
data.tar.gz: 136fee10239aa4da8c286c03643dd1b17ef315997690f7a6c10d05b1750f94ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2367a4b0f89526bc5af938b3abe372398c3bae8d6a5766ee4ffca8eccb029884fd35bb34a0a0a6683a1fe8d9ca8cd13ead5f7c5c27d57b4f60b101cfcf768734
|
|
7
|
+
data.tar.gz: acc055a65f78b0fda9f9d35d800baebe4a4c0d2f1094fe93cb29ac829ba7f51d62633f076096ca052f66fc2b352546b4c3f994e37240ae72c3152e5aaf5610a7
|
data/LICENSE
CHANGED
|
@@ -1,201 +1,165 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
data/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
A Jekyll plugin that generates a static ActivityPoll feed, the read-only polling subset of ActivityPub defined by FEP-b06c.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this to the `Gemfile` of your Jekyll site:
|
|
8
|
+
|
|
9
|
+
```Gemfile
|
|
10
|
+
gem "jekyll-activitypub-static"
|
|
11
|
+
```
|
|
6
12
|
|
|
7
13
|
To build from source:
|
|
8
14
|
|
|
@@ -13,19 +19,113 @@ gem install ./jekyll-activitypub-static-*.gem
|
|
|
13
19
|
|
|
14
20
|
## Usage
|
|
15
21
|
|
|
16
|
-
Add this to the `
|
|
22
|
+
Add this to the `_config.yml` for your site:
|
|
17
23
|
|
|
18
|
-
```
|
|
19
|
-
|
|
24
|
+
```yaml
|
|
25
|
+
plugins:
|
|
26
|
+
- jekyll-activitypub-static
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
The plugin uses your site's standard `url`, `author`, and `description`
|
|
32
|
+
settings, plus the `activitypub` configuration block.
|
|
23
33
|
|
|
24
34
|
```yaml
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
url: "https://example.com"
|
|
36
|
+
author: "Example Author"
|
|
37
|
+
description: "A short description of the site"
|
|
38
|
+
|
|
39
|
+
activitypub:
|
|
40
|
+
output_path: "activitypub"
|
|
41
|
+
preferred_username: "example"
|
|
42
|
+
summary_property: "description"
|
|
43
|
+
note_max_characters: 500
|
|
44
|
+
update_interval: "P1D"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Available `activitypub` options:
|
|
48
|
+
|
|
49
|
+
- `output_path`: directory for generated ActivityPub files. Defaults to
|
|
50
|
+
`activitypub`.
|
|
51
|
+
- `preferred_username`: username for the generated actor and WebFinger
|
|
52
|
+
document. Defaults to the host name from `url`. The WebFinger account ID is
|
|
53
|
+
`preferred_username` at the domain from `url`, like `example@example.com`.
|
|
54
|
+
- `summary_property`: post front matter property to use for generated Article
|
|
55
|
+
summaries. Defaults to `description`; when the property is missing or empty,
|
|
56
|
+
the plugin uses the rendered post excerpt.
|
|
57
|
+
- `note_max_characters`: maximum plain-text character count for generated
|
|
58
|
+
Note objects. Defaults to `500`.
|
|
59
|
+
- `update_interval`: ActivityPoll polling interval for the generated Actor
|
|
60
|
+
object, as an ISO 8601 duration. Defaults to `P1D`.
|
|
61
|
+
|
|
62
|
+
## Articles and Notes
|
|
63
|
+
|
|
64
|
+
Posts are generated as Activity Streams `Article` objects by default.
|
|
65
|
+
|
|
66
|
+
Short, untitled posts without an explicit summary are generated as
|
|
67
|
+
Activity Streams `Note` objects. `Note` is the native Activity Streams object
|
|
68
|
+
type used by Mastodon for statuses. To make a post eligible for `Note`
|
|
69
|
+
generation, set an explicit blank title:
|
|
70
|
+
|
|
71
|
+
```yaml
|
|
72
|
+
---
|
|
73
|
+
title: ""
|
|
74
|
+
---
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Jekyll generates titles from post filenames when `title` is omitted, so an
|
|
78
|
+
omitted title is treated as a normal title. A blank-titled post is generated as
|
|
79
|
+
a `Note` when it has no configured summary property, has one rendered paragraph,
|
|
80
|
+
and its plain-text content is no longer than `activitypub.note_max_characters`.
|
|
81
|
+
|
|
82
|
+
Blank-titled posts may need layout support on home pages, archive pages, or
|
|
83
|
+
post lists. Use the excerpt, date, or another fallback when displaying links to
|
|
84
|
+
untitled posts.
|
|
85
|
+
|
|
86
|
+
## Layouts
|
|
87
|
+
|
|
88
|
+
To link from HTML pages to their ActivityPub representation, add this to the
|
|
89
|
+
`<head>` element of your layouts:
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
{% if page.activitypub_url %}
|
|
93
|
+
<link rel="alternate" type="application/activity+json" href="{{ page.activitypub_url }}">
|
|
94
|
+
{% endif %}
|
|
27
95
|
```
|
|
28
96
|
|
|
97
|
+
The plugin sets `page.activitypub_url` before rendering posts and the site
|
|
98
|
+
index. For posts, the URL points to the generated JSON-LD Article or Note
|
|
99
|
+
object. For the site index, the URL points to the generated Actor object.
|
|
100
|
+
|
|
101
|
+
## Generated Files
|
|
102
|
+
|
|
103
|
+
The plugin generates these static files:
|
|
104
|
+
|
|
105
|
+
- `actor.jsonld`
|
|
106
|
+
- `.well-known/webfinger`
|
|
107
|
+
- `activitypub/inbox.jsonld`
|
|
108
|
+
- `activitypub/outbox.jsonld`
|
|
109
|
+
- `activitypub/outbox/page-*.jsonld`
|
|
110
|
+
- `activitypub/posts/*.jsonld`
|
|
111
|
+
- `activitypub/activities/create-*.jsonld`
|
|
112
|
+
|
|
113
|
+
The `activitypub` path changes when `activitypub.output_path` is configured.
|
|
114
|
+
|
|
115
|
+
### WebFinger
|
|
116
|
+
|
|
117
|
+
The WebFinger document is generated at `.well-known/webfinger` and uses an
|
|
118
|
+
account ID in the form `preferred_username` at the site domain. For example,
|
|
119
|
+
with `url: "https://example.com"` and `preferred_username: "evan"`, the
|
|
120
|
+
account ID is `evan@example.com`.
|
|
121
|
+
|
|
122
|
+
WebFinger discovery only works when the generated site is served from the root
|
|
123
|
+
of its domain, because clients request `https://example.com/.well-known/webfinger`.
|
|
124
|
+
Sites served from a subdirectory cannot provide a domain-level WebFinger
|
|
125
|
+
endpoint with this plugin alone.
|
|
126
|
+
|
|
127
|
+
## Example Site
|
|
128
|
+
|
|
29
129
|
The `example-site` directory has a minimal example site (thus the name). You can build and run it with these commands:
|
|
30
130
|
|
|
31
131
|
```sh
|
|
@@ -43,4 +143,4 @@ PRs accepted.
|
|
|
43
143
|
|
|
44
144
|
## License
|
|
45
145
|
|
|
46
|
-
|
|
146
|
+
LGPL-3.0-or-later (c) 2025 Social Web Foundation
|
|
@@ -30,21 +30,16 @@ module Jekyll
|
|
|
30
30
|
generate_webfinger(site)
|
|
31
31
|
generate_actor(site)
|
|
32
32
|
generate_inbox(site)
|
|
33
|
-
generate_activities(site)
|
|
34
|
-
generate_outbox_pages(site)
|
|
35
|
-
generate_outbox(site)
|
|
36
33
|
end
|
|
37
34
|
|
|
38
35
|
def generate_webfinger(site)
|
|
39
36
|
Jekyll.logger.info LOG_TAG, "Generating .well-known/webfinger"
|
|
40
37
|
|
|
41
38
|
url = site.config["url"]
|
|
42
|
-
host = URI(url).host
|
|
43
|
-
username = preferred_username(site)
|
|
44
39
|
actor_url = "#{url}/actor.jsonld"
|
|
45
40
|
|
|
46
41
|
webfinger = {
|
|
47
|
-
"subject" => "acct:#{
|
|
42
|
+
"subject" => "acct:#{webfinger_address(site)}",
|
|
48
43
|
"links" => [
|
|
49
44
|
{
|
|
50
45
|
"rel" => "self",
|
|
@@ -103,14 +98,21 @@ module Jekyll
|
|
|
103
98
|
article = {
|
|
104
99
|
"@context" => "https://www.w3.org/ns/activitystreams",
|
|
105
100
|
"id" => article_id,
|
|
106
|
-
"type" =>
|
|
107
|
-
"name" => post.data["title"],
|
|
101
|
+
"type" => post_type(site, post),
|
|
108
102
|
"content" => post.content,
|
|
103
|
+
"summary" => article_summary(site, post),
|
|
109
104
|
"published" => post.date.iso8601,
|
|
110
105
|
"attributedTo" => "#{url}/actor.jsonld",
|
|
106
|
+
"url" => {
|
|
107
|
+
"type" => "Link",
|
|
108
|
+
"mediaType" => "text/html",
|
|
109
|
+
"href" => "#{url}#{post.url}"
|
|
110
|
+
},
|
|
111
111
|
"to" => "as:Public"
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
article["name"] = post.data["title"] unless post.data["title"].to_s.strip.empty?
|
|
115
|
+
|
|
114
116
|
site.static_files << JsonStaticFile.new(site, output_dir, filename, article)
|
|
115
117
|
end
|
|
116
118
|
end
|
|
@@ -137,12 +139,13 @@ module Jekyll
|
|
|
137
139
|
"published" => post.date.iso8601,
|
|
138
140
|
"object" => {
|
|
139
141
|
"id" => article_id,
|
|
140
|
-
"type" =>
|
|
141
|
-
"name" => post.data["title"]
|
|
142
|
+
"type" => post_type(site, post)
|
|
142
143
|
},
|
|
143
144
|
"to" => "as:Public"
|
|
144
145
|
}
|
|
145
146
|
|
|
147
|
+
activity["object"]["name"] = post.data["title"] unless post.data["title"].to_s.strip.empty?
|
|
148
|
+
|
|
146
149
|
site.static_files << JsonStaticFile.new(site, output_dir, filename, activity)
|
|
147
150
|
Jekyll.logger.info LOG_TAG, "Wrote activity to #{path}"
|
|
148
151
|
end
|
|
@@ -221,22 +224,31 @@ module Jekyll
|
|
|
221
224
|
url = site.config["url"]
|
|
222
225
|
summary = site.config["description"]
|
|
223
226
|
output_path = site.config.dig("activitypub", "output_path") || "activitypub"
|
|
227
|
+
update_interval = site.config.dig("activitypub", "update_interval") || "P1D"
|
|
224
228
|
|
|
225
229
|
{
|
|
226
230
|
"@context": [
|
|
227
231
|
"https://www.w3.org/ns/activitystreams",
|
|
228
232
|
"https://purl.archive.org/miscellany/1.0",
|
|
233
|
+
"https://purl.archive.org/socialweb/webfinger",
|
|
229
234
|
"https://w3id.org/fep/b06c"
|
|
230
235
|
],
|
|
231
236
|
"type": "Person",
|
|
232
237
|
"id": "#{url}/actor.jsonld",
|
|
233
238
|
"pollOnly": true,
|
|
239
|
+
"updateInterval": update_interval,
|
|
234
240
|
"name": name(site),
|
|
235
241
|
"preferredUsername": preferred_username(site),
|
|
236
242
|
"summary": (summary unless summary.to_s.strip.empty?),
|
|
237
243
|
"inbox": "#{url}/#{output_path}/inbox.jsonld",
|
|
238
244
|
"outbox": "#{url}/#{output_path}/outbox.jsonld",
|
|
239
245
|
"attributedTo": "#{url}/actor.jsonld",
|
|
246
|
+
"url" => {
|
|
247
|
+
"type" => "Link",
|
|
248
|
+
"mediaType" => "text/html",
|
|
249
|
+
"href" => homepage_url(site)
|
|
250
|
+
},
|
|
251
|
+
"webfinger" => webfinger_address(site),
|
|
240
252
|
"cc": "as:Public"
|
|
241
253
|
}
|
|
242
254
|
end
|
|
@@ -276,10 +288,83 @@ module Jekyll
|
|
|
276
288
|
page["prev"] = "#{url}/#{output_path}/outbox/page-#{page_number - 1}.jsonld" if page_number > 1
|
|
277
289
|
page
|
|
278
290
|
end
|
|
291
|
+
|
|
292
|
+
def article_summary(site, post)
|
|
293
|
+
property = site.config.dig("activitypub", "summary_property") || "description"
|
|
294
|
+
explicit = post.data[property]
|
|
295
|
+
return explicit unless explicit.to_s.strip.empty?
|
|
296
|
+
|
|
297
|
+
excerpt = post.data["excerpt"]
|
|
298
|
+
excerpt.output
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def note?(site, post)
|
|
302
|
+
title = post.data["title"]
|
|
303
|
+
return false unless title.to_s.strip.empty?
|
|
304
|
+
|
|
305
|
+
summary = explicit_summary(site, post)
|
|
306
|
+
return false unless summary.to_s.strip.empty?
|
|
307
|
+
|
|
308
|
+
return false unless paragraph_count(post.content) == 1
|
|
309
|
+
|
|
310
|
+
plain_text(post.content).length <= note_max_characters(site)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def post_type(site, post)
|
|
314
|
+
note?(site, post) ? "Note" : "Article"
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def explicit_summary(site, post)
|
|
318
|
+
property = site.config.dig("activitypub", "summary_property") || "description"
|
|
319
|
+
post.data[property]
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def note_max_characters(site)
|
|
323
|
+
site.config.dig("activitypub", "note_max_characters") || 500
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
def paragraph_count(content)
|
|
327
|
+
content.scan(/<p\b[^>]*>/).length
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
def plain_text(content)
|
|
331
|
+
content.gsub(/<[^>]*>/, "")
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
def homepage_url(site)
|
|
335
|
+
url = site.config["url"]
|
|
336
|
+
url.end_with?("/") ? url : "#{url}/"
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def webfinger_address(site)
|
|
340
|
+
url = site.config["url"]
|
|
341
|
+
host = URI(url).host
|
|
342
|
+
"#{preferred_username(site)}@#{host}"
|
|
343
|
+
end
|
|
279
344
|
end
|
|
280
345
|
end
|
|
281
346
|
end
|
|
282
347
|
|
|
283
348
|
Jekyll::Hooks.register :site, :post_render do |site|
|
|
284
|
-
Jekyll::ActivityPubStatic::Generator.new(site.config)
|
|
349
|
+
generator = Jekyll::ActivityPubStatic::Generator.new(site.config)
|
|
350
|
+
|
|
351
|
+
generator.generate_articles(site)
|
|
352
|
+
generator.generate_activities(site)
|
|
353
|
+
generator.generate_outbox_pages(site)
|
|
354
|
+
generator.generate_outbox(site)
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
Jekyll::Hooks.register :posts, :pre_render do |post|
|
|
358
|
+
site = post.site
|
|
359
|
+
url = site.config["url"]
|
|
360
|
+
output_path = site.config.dig("activitypub", "output_path") || "activitypub"
|
|
361
|
+
slug = post.basename_without_ext.sub(/^\d{4}-\d{2}-\d{2}-/, "")
|
|
362
|
+
post.data["activitypub_url"] = "#{url}/#{output_path}/posts/#{slug}.jsonld"
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
Jekyll::Hooks.register :pages, :post_init do |page|
|
|
366
|
+
next unless page.url == "/"
|
|
367
|
+
|
|
368
|
+
site = page.site
|
|
369
|
+
page.data["activitypub_url"] = "#{site.config["url"]}/actor.jsonld"
|
|
285
370
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-activitypub-static
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evan Prodromou
|
|
@@ -52,7 +52,7 @@ files:
|
|
|
52
52
|
- lib/jekyll/activitypub_static/version.rb
|
|
53
53
|
homepage: https://github.com/social-web-foundation/jekyll-activitypub-static
|
|
54
54
|
licenses:
|
|
55
|
-
-
|
|
55
|
+
- LGPL-3.0-or-later
|
|
56
56
|
metadata: {}
|
|
57
57
|
rdoc_options: []
|
|
58
58
|
require_paths:
|