@rmdes/indiekit-endpoint-microsub 1.0.61 → 1.0.64
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.
- package/index.js +5 -7
- package/lib/controllers/reader/channel.js +41 -3
- package/lib/controllers/reader/index.js +0 -15
- package/lib/polling/scheduler.js +4 -4
- package/lib/storage/channels.js +1 -37
- package/lib/storage/items-read-state.js +30 -59
- package/lib/storage/items-retention.js +208 -99
- package/lib/utils/blogroll-notify.js +3 -3
- package/lib/utils/constants.js +7 -0
- package/lib/utils/jf2.js +0 -109
- package/lib/utils/sanitize.js +1 -2
- package/lib/utils/validation.js +25 -0
- package/lib/webmention/processor.js +2 -2
- package/lib/websub/handler.js +2 -2
- package/locales/en.json +11 -27
- package/package.json +1 -1
- package/views/partials/item-card.njk +0 -6
- package/views/settings.njk +37 -0
- package/lib/activitypub/outbox-fetcher.js +0 -267
- package/lib/controllers/reader/actor.js +0 -142
- package/lib/search/indexer.js +0 -90
- package/lib/storage/items-search.js +0 -34
- package/views/actor.njk +0 -188
package/views/actor.njk
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
{% extends "layouts/reader.njk" %}
|
|
2
|
-
|
|
3
|
-
{% block reader %}
|
|
4
|
-
<div class="ms-channel">
|
|
5
|
-
<header class="ms-channel__header">
|
|
6
|
-
<a href="{{ baseUrl }}/channels/activitypub" class="back-link">
|
|
7
|
-
{{ icon("previous") }} Fediverse
|
|
8
|
-
</a>
|
|
9
|
-
</header>
|
|
10
|
-
|
|
11
|
-
{# Actor profile card #}
|
|
12
|
-
<div class="ms-actor-profile">
|
|
13
|
-
<div class="ms-actor-profile__header">
|
|
14
|
-
<div class="ms-actor-profile__avatar-wrap" data-avatar-fallback>
|
|
15
|
-
{% if actor.photo %}
|
|
16
|
-
<img src="{{ actor.photo }}"
|
|
17
|
-
alt=""
|
|
18
|
-
class="ms-actor-profile__avatar"
|
|
19
|
-
width="80"
|
|
20
|
-
height="80">
|
|
21
|
-
{% endif %}
|
|
22
|
-
<span class="ms-actor-profile__avatar ms-actor-profile__avatar--default" aria-hidden="true">{{ actor.name[0] | upper if actor.name else "?" }}</span>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="ms-actor-profile__info">
|
|
25
|
-
<h2 class="ms-actor-profile__name">{{ actor.name }}</h2>
|
|
26
|
-
{% if actor.handle %}
|
|
27
|
-
<span class="ms-actor-profile__handle">@{{ actor.handle }}</span>
|
|
28
|
-
{% endif %}
|
|
29
|
-
{% if actor.summary %}
|
|
30
|
-
<p class="ms-actor-profile__summary">{{ actor.summary }}</p>
|
|
31
|
-
{% endif %}
|
|
32
|
-
<div class="ms-actor-profile__stats">
|
|
33
|
-
{% if actor.followersCount %}
|
|
34
|
-
<span>{{ actor.followersCount }} followers</span>
|
|
35
|
-
{% endif %}
|
|
36
|
-
{% if actor.followingCount %}
|
|
37
|
-
<span>{{ actor.followingCount }} following</span>
|
|
38
|
-
{% endif %}
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="ms-actor-profile__actions">
|
|
43
|
-
<a href="{{ actor.url }}" class="button button--secondary button--small" target="_blank" rel="noopener">
|
|
44
|
-
{{ icon("syndicate") }} View profile
|
|
45
|
-
</a>
|
|
46
|
-
{% if canFollow %}
|
|
47
|
-
{% if isFollowing %}
|
|
48
|
-
<form action="{{ baseUrl }}/actor/unfollow" method="POST" style="display: inline;">
|
|
49
|
-
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
50
|
-
<input type="hidden" name="actorUrl" value="{{ actorUrl }}">
|
|
51
|
-
<button type="submit" class="button button--secondary button--small">
|
|
52
|
-
{{ icon("tick") }} Following
|
|
53
|
-
</button>
|
|
54
|
-
</form>
|
|
55
|
-
{% else %}
|
|
56
|
-
<form action="{{ baseUrl }}/actor/follow" method="POST" style="display: inline;">
|
|
57
|
-
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
58
|
-
<input type="hidden" name="actorUrl" value="{{ actorUrl }}">
|
|
59
|
-
<input type="hidden" name="actorName" value="{{ actor.name }}">
|
|
60
|
-
<button type="submit" class="button button--primary button--small">
|
|
61
|
-
{{ icon("syndicate") }} Follow
|
|
62
|
-
</button>
|
|
63
|
-
</form>
|
|
64
|
-
{% endif %}
|
|
65
|
-
{% endif %}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
{% if error %}
|
|
70
|
-
<div class="ms-reader__empty">
|
|
71
|
-
{{ icon("warning") }}
|
|
72
|
-
<p>{{ error }}</p>
|
|
73
|
-
</div>
|
|
74
|
-
{% elif items.length > 0 %}
|
|
75
|
-
<div class="ms-timeline" id="timeline">
|
|
76
|
-
{% for item in items %}
|
|
77
|
-
<article class="ms-item-card">
|
|
78
|
-
{# Author #}
|
|
79
|
-
{% if item.author %}
|
|
80
|
-
<div class="ms-item-card__author" style="padding: 12px 16px 0;">
|
|
81
|
-
<div class="ms-item-card__avatar-wrap" data-avatar-fallback>
|
|
82
|
-
{% if item.author.photo %}
|
|
83
|
-
<img src="{{ item.author.photo }}"
|
|
84
|
-
alt=""
|
|
85
|
-
class="ms-item-card__author-photo"
|
|
86
|
-
width="40"
|
|
87
|
-
height="40"
|
|
88
|
-
loading="lazy">
|
|
89
|
-
{% endif %}
|
|
90
|
-
<span class="ms-item-card__author-photo ms-item-card__author-photo--default" aria-hidden="true">{{ item.author.name[0] | upper if item.author.name else "?" }}</span>
|
|
91
|
-
</div>
|
|
92
|
-
<div class="ms-item-card__author-info">
|
|
93
|
-
<span class="ms-item-card__author-name">{{ item.author.name or "Unknown" }}</span>
|
|
94
|
-
{% if item.author.url %}
|
|
95
|
-
<span class="ms-item-card__source">{{ item.author.url | replace("https://", "") | replace("http://", "") }}</span>
|
|
96
|
-
{% endif %}
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
{% endif %}
|
|
100
|
-
|
|
101
|
-
<a href="{{ item.url }}" class="ms-item-card__link" target="_blank" rel="noopener">
|
|
102
|
-
{# Reply context #}
|
|
103
|
-
{% if item["in-reply-to"] and item["in-reply-to"].length > 0 %}
|
|
104
|
-
<div class="ms-item-card__context">
|
|
105
|
-
{{ icon("reply") }}
|
|
106
|
-
<span>Reply to</span>
|
|
107
|
-
<span>{{ item["in-reply-to"][0] | replace("https://", "") | replace("http://", "") | truncate(50) }}</span>
|
|
108
|
-
</div>
|
|
109
|
-
{% endif %}
|
|
110
|
-
|
|
111
|
-
{# Title #}
|
|
112
|
-
{% if item.name %}
|
|
113
|
-
<h3 class="ms-item-card__title">{{ item.name }}</h3>
|
|
114
|
-
{% endif %}
|
|
115
|
-
|
|
116
|
-
{# Content #}
|
|
117
|
-
{% if item.content %}
|
|
118
|
-
<div class="ms-item-card__content{% if (item.content.text or '') | length > 300 %} ms-item-card__content--truncated{% endif %}">
|
|
119
|
-
{% if item.content.html %}
|
|
120
|
-
{{ item.content.html | safe | striptags | truncate(400) }}
|
|
121
|
-
{% elif item.content.text %}
|
|
122
|
-
{{ item.content.text | truncate(400) }}
|
|
123
|
-
{% endif %}
|
|
124
|
-
</div>
|
|
125
|
-
{% endif %}
|
|
126
|
-
|
|
127
|
-
{# Tags #}
|
|
128
|
-
{% if item.category and item.category.length > 0 %}
|
|
129
|
-
<div class="ms-item-card__categories">
|
|
130
|
-
{% for cat in item.category %}
|
|
131
|
-
{% if loop.index0 < 5 %}
|
|
132
|
-
<span class="ms-item-card__category">#{{ cat }}</span>
|
|
133
|
-
{% endif %}
|
|
134
|
-
{% endfor %}
|
|
135
|
-
</div>
|
|
136
|
-
{% endif %}
|
|
137
|
-
|
|
138
|
-
{# Photos #}
|
|
139
|
-
{% if item.photo and item.photo.length > 0 %}
|
|
140
|
-
{% set photoCount = item.photo.length if item.photo.length <= 4 else 4 %}
|
|
141
|
-
<div class="ms-item-card__photos ms-item-card__photos--{{ photoCount }}">
|
|
142
|
-
{% for photo in item.photo %}
|
|
143
|
-
{% if loop.index0 < 4 %}
|
|
144
|
-
<img src="{{ photo }}" alt="" class="ms-item-card__photo" loading="lazy">
|
|
145
|
-
{% endif %}
|
|
146
|
-
{% endfor %}
|
|
147
|
-
</div>
|
|
148
|
-
{% endif %}
|
|
149
|
-
|
|
150
|
-
{# Footer #}
|
|
151
|
-
<footer class="ms-item-card__footer">
|
|
152
|
-
{% if item.published %}
|
|
153
|
-
<time datetime="{{ item.published }}" class="ms-item-card__date">
|
|
154
|
-
{{ item.published | date("PP", { locale: locale, timeZone: application.timeZone }) }}
|
|
155
|
-
</time>
|
|
156
|
-
{% endif %}
|
|
157
|
-
</footer>
|
|
158
|
-
</a>
|
|
159
|
-
|
|
160
|
-
{# Actions #}
|
|
161
|
-
<div class="ms-item-actions">
|
|
162
|
-
<a href="{{ item.url }}" class="ms-item-actions__button" target="_blank" rel="noopener" title="View original">
|
|
163
|
-
{{ icon("syndicate") }}
|
|
164
|
-
</a>
|
|
165
|
-
<a href="{{ baseUrl }}/compose?reply={{ item.url | urlencode }}" class="ms-item-actions__button" title="Reply">
|
|
166
|
-
{{ icon("reply") }}
|
|
167
|
-
</a>
|
|
168
|
-
<a href="{{ baseUrl }}/compose?like={{ item.url | urlencode }}" class="ms-item-actions__button" title="Like">
|
|
169
|
-
{{ icon("like") }}
|
|
170
|
-
</a>
|
|
171
|
-
<a href="{{ baseUrl }}/compose?repost={{ item.url | urlencode }}" class="ms-item-actions__button" title="Repost">
|
|
172
|
-
{{ icon("repost") }}
|
|
173
|
-
</a>
|
|
174
|
-
<a href="{{ baseUrl }}/compose?bookmark={{ item.url | urlencode }}" class="ms-item-actions__button" title="Bookmark">
|
|
175
|
-
{{ icon("bookmark") }}
|
|
176
|
-
</a>
|
|
177
|
-
</div>
|
|
178
|
-
</article>
|
|
179
|
-
{% endfor %}
|
|
180
|
-
</div>
|
|
181
|
-
{% else %}
|
|
182
|
-
<div class="ms-reader__empty">
|
|
183
|
-
{{ icon("syndicate") }}
|
|
184
|
-
<p>No posts found for this actor.</p>
|
|
185
|
-
</div>
|
|
186
|
-
{% endif %}
|
|
187
|
-
</div>
|
|
188
|
-
{% endblock %}
|