@rmdes/indiekit-endpoint-activitypub 1.0.17 → 1.0.19

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 CHANGED
@@ -166,6 +166,8 @@ export default class ActivityPubEndpoint {
166
166
  router.use((req, res, next) => {
167
167
  if (!self._fedifyMiddleware) return next();
168
168
  if (req.method !== "GET" && req.method !== "HEAD") return next();
169
+ // Skip Fedify for admin routes — handled by authenticated router
170
+ if (req.path.startsWith("/admin")) return next();
169
171
  return self._fedifyMiddleware(req, res, next);
170
172
  });
171
173
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -39,8 +39,8 @@
39
39
  {# Progress bar #}
40
40
  <div style="background: var(--color-offset); border-radius: 4px; height: 1.5rem; margin-block-end: var(--space-m); overflow: hidden;">
41
41
  <div
42
- x-bind:style="'width:' + progress + '%; background: var(--color-accent); height: 100%; transition: width 0.5s ease;'"
43
- style="width: {{ refollowStatus.progressPercent }}%; background: var(--color-accent); height: 100%; transition: width 0.5s ease;">
42
+ x-bind:style="'width:' + progress + '%; height: 100%; transition: width 0.5s ease; background: var(--color-primary);'"
43
+ style="width: {{ refollowStatus.progressPercent }}%; height: 100%; transition: width 0.5s ease; background: var(--color-primary);">
44
44
  </div>
45
45
  </div>
46
46
 
@@ -48,39 +48,42 @@
48
48
  <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-s); margin-block-end: var(--space-m);">
49
49
  <div style="padding: var(--space-s); background: var(--color-offset); border-radius: 4px; text-align: center;">
50
50
  <div style="font-size: var(--font-size-xl);" x-text="remaining">{{ refollowStatus.remaining }}</div>
51
- <div style="font-size: var(--font-size-s); color: var(--color-text-offset);">{{ __("activitypub.refollow.remaining") }}</div>
51
+ <div style="font-size: var(--font-size-s); color: var(--color-outline);">{{ __("activitypub.refollow.remaining") }}</div>
52
52
  </div>
53
53
  <div style="padding: var(--space-s); background: var(--color-offset); border-radius: 4px; text-align: center;">
54
54
  <div style="font-size: var(--font-size-xl);" x-text="sent">{{ refollowStatus.sent }}</div>
55
- <div style="font-size: var(--font-size-s); color: var(--color-text-offset);">{{ __("activitypub.refollow.awaitingAccept") }}</div>
55
+ <div style="font-size: var(--font-size-s); color: var(--color-outline);">{{ __("activitypub.refollow.awaitingAccept") }}</div>
56
56
  </div>
57
57
  <div style="padding: var(--space-s); background: var(--color-offset); border-radius: 4px; text-align: center;">
58
58
  <div style="font-size: var(--font-size-xl);" x-text="federated">{{ refollowStatus.federated }}</div>
59
- <div style="font-size: var(--font-size-s); color: var(--color-text-offset);">{{ __("activitypub.refollow.accepted") }}</div>
59
+ <div style="font-size: var(--font-size-s); color: var(--color-outline);">{{ __("activitypub.refollow.accepted") }}</div>
60
60
  </div>
61
61
  <div style="padding: var(--space-s); background: var(--color-offset); border-radius: 4px; text-align: center;">
62
62
  <div style="font-size: var(--font-size-xl);" x-text="failed">{{ refollowStatus.failed }}</div>
63
- <div style="font-size: var(--font-size-s); color: var(--color-text-offset);">{{ __("activitypub.refollow.failed") }}</div>
63
+ <div style="font-size: var(--font-size-s); color: var(--color-outline);">{{ __("activitypub.refollow.failed") }}</div>
64
64
  </div>
65
65
  </div>
66
66
 
67
67
  {# Status + controls #}
68
68
  <div style="display: flex; align-items: center; gap: var(--space-s);">
69
- {{ badge({ text: __("activitypub.refollow.status." + refollowStatus.status) }) }}
70
- {% if refollowStatus.status === "running" %}
71
- <form method="post" action="{{ mountPath }}/admin/refollow/pause" x-on:submit.prevent="pause">
72
- <button type="submit" class="button" style="font-size: var(--font-size-s);">{{ __("activitypub.refollow.pause") }}</button>
73
- </form>
74
- {% elif refollowStatus.status === "paused" %}
75
- <form method="post" action="{{ mountPath }}/admin/refollow/resume" x-on:submit.prevent="resume">
76
- <button type="submit" class="button" style="font-size: var(--font-size-s);">{{ __("activitypub.refollow.resume") }}</button>
77
- </form>
78
- {% endif %}
69
+ <span class="badge" x-text="statusLabel">{{ __("activitypub.refollow.status." + refollowStatus.status) }}</span>
70
+ <form x-show="status === 'running'" method="post" action="{{ mountPath }}/admin/refollow/pause" x-on:submit.prevent="pause" style="display: none;">
71
+ <button type="submit" class="button" style="font-size: var(--font-size-s);">{{ __("activitypub.refollow.pause") }}</button>
72
+ </form>
73
+ <form x-show="status === 'paused'" method="post" action="{{ mountPath }}/admin/refollow/resume" x-on:submit.prevent="resume" style="display: none;">
74
+ <button type="submit" class="button" style="font-size: var(--font-size-s);">{{ __("activitypub.refollow.resume") }}</button>
75
+ </form>
79
76
  </div>
80
77
  </section>
81
78
 
82
79
  <script>
83
80
  function refollowProgress(mountPath) {
81
+ const statusLabels = {
82
+ idle: '{{ __("activitypub.refollow.status.idle") }}',
83
+ running: '{{ __("activitypub.refollow.status.running") }}',
84
+ paused: '{{ __("activitypub.refollow.status.paused") }}',
85
+ completed: '{{ __("activitypub.refollow.status.completed") }}'
86
+ };
84
87
  return {
85
88
  progress: {{ refollowStatus.progressPercent }},
86
89
  remaining: {{ refollowStatus.remaining }},
@@ -89,6 +92,9 @@
89
92
  failed: {{ refollowStatus.failed }},
90
93
  status: '{{ refollowStatus.status }}',
91
94
  interval: null,
95
+ get statusLabel() {
96
+ return statusLabels[this.status] || this.status;
97
+ },
92
98
  init() {
93
99
  if (this.status === 'running' || this.status === 'paused') {
94
100
  this.interval = setInterval(() => this.poll(), 10000);
@@ -100,6 +106,7 @@
100
106
  async poll() {
101
107
  try {
102
108
  const res = await fetch(mountPath + '/admin/refollow/status');
109
+ if (!res.ok) return;
103
110
  const data = await res.json();
104
111
  this.progress = data.progressPercent;
105
112
  this.remaining = data.remaining;
@@ -113,14 +120,16 @@
113
120
  } catch {}
114
121
  },
115
122
  async pause() {
116
- await fetch(mountPath + '/admin/refollow/pause', { method: 'POST' });
117
- this.status = 'paused';
123
+ const res = await fetch(mountPath + '/admin/refollow/pause', { method: 'POST' });
124
+ if (res.ok) this.status = 'paused';
118
125
  },
119
126
  async resume() {
120
- await fetch(mountPath + '/admin/refollow/resume', { method: 'POST' });
121
- this.status = 'running';
122
- if (!this.interval) {
123
- this.interval = setInterval(() => this.poll(), 10000);
127
+ const res = await fetch(mountPath + '/admin/refollow/resume', { method: 'POST' });
128
+ if (res.ok) {
129
+ this.status = 'running';
130
+ if (!this.interval) {
131
+ this.interval = setInterval(() => this.poll(), 10000);
132
+ }
124
133
  }
125
134
  }
126
135
  };
@@ -11,17 +11,21 @@
11
11
 
12
12
  {% if following.length > 0 %}
13
13
  {% for account in following %}
14
+ {% if account.source === "import" %}
15
+ {% set sourceBadge = __("activitypub.sourceImport") %}
16
+ {% elif account.source === "refollow:sent" %}
17
+ {% set sourceBadge = __("activitypub.sourceRefollowPending") %}
18
+ {% elif account.source === "refollow:failed" %}
19
+ {% set sourceBadge = __("activitypub.sourceRefollowFailed") %}
20
+ {% else %}
21
+ {% set sourceBadge = __("activitypub.sourceFederation") %}
22
+ {% endif %}
14
23
  {{ card({
15
24
  title: account.name or account.handle or account.actorUrl,
16
25
  url: account.actorUrl,
17
26
  description: { text: "@" + account.handle if account.handle },
18
27
  published: account.followedAt,
19
- badges: [{
20
- text: __("activitypub.sourceImport") if account.source === "import"
21
- else __("activitypub.sourceRefollowPending") if account.source === "refollow:sent"
22
- else __("activitypub.sourceRefollowFailed") if account.source === "refollow:failed"
23
- else __("activitypub.sourceFederation")
24
- }]
28
+ badges: [{ text: sourceBadge }]
25
29
  }) }}
26
30
  {% endfor %}
27
31