@rmdes/indiekit-endpoint-activitypub 3.9.1 → 3.9.3

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.
@@ -23,19 +23,30 @@ document.addEventListener("alpine:init", () => {
23
23
  likeCount: null,
24
24
  boostCount: null,
25
25
 
26
+ // Stored from data attributes in init() — must use $root to guarantee
27
+ // we read from the x-data element, not a child element in event context.
28
+ _mountPath: "",
29
+ _csrfToken: "",
30
+ _itemUid: "",
31
+ _itemUrl: "",
32
+
26
33
  init() {
27
- this.liked = this.$el.dataset.liked === "true";
28
- this.boosted = this.$el.dataset.boosted === "true";
29
- const lc = this.$el.dataset.likeCount;
30
- const bc = this.$el.dataset.boostCount;
34
+ const root = this.$root;
35
+ this.liked = root.dataset.liked === "true";
36
+ this.boosted = root.dataset.boosted === "true";
37
+ this._mountPath = root.dataset.mountPath || "";
38
+ this._csrfToken = root.dataset.csrfToken || "";
39
+ this._itemUid = root.dataset.itemUid || "";
40
+ this._itemUrl = root.dataset.itemUrl || "";
41
+ const lc = root.dataset.likeCount;
42
+ const bc = root.dataset.boostCount;
31
43
  this.likeCount = lc != null && lc !== "" ? Number(lc) : null;
32
44
  this.boostCount = bc != null && bc !== "" ? Number(bc) : null;
33
45
  },
34
46
 
35
47
  async saveLater() {
36
48
  if (this.saved) return;
37
- const el = this.$el;
38
- const itemUrl = el.dataset.itemUrl;
49
+ const itemUrl = this._itemUrl;
39
50
  try {
40
51
  const res = await fetch("/readlater/save", {
41
52
  method: "POST",
@@ -43,7 +54,7 @@ document.addEventListener("alpine:init", () => {
43
54
  body: JSON.stringify({
44
55
  url: itemUrl,
45
56
  title:
46
- el.closest("article")?.querySelector("p")?.textContent?.substring(0, 80) ||
57
+ this.$root.closest("article")?.querySelector("p")?.textContent?.substring(0, 80) ||
47
58
  itemUrl,
48
59
  source: "activitypub",
49
60
  }),
@@ -61,10 +72,9 @@ document.addEventListener("alpine:init", () => {
61
72
  if (this.loading) return;
62
73
  this.loading = true;
63
74
  this.error = "";
64
- const el = this.$el;
65
- const itemUid = el.dataset.itemUid;
66
- const csrfToken = el.dataset.csrfToken;
67
- const basePath = el.dataset.mountPath;
75
+ const itemUid = this._itemUid;
76
+ const csrfToken = this._csrfToken;
77
+ const basePath = this._mountPath;
68
78
  const prev = {
69
79
  liked: this.liked,
70
80
  boosted: this.boosted,
package/index.js CHANGED
@@ -180,6 +180,26 @@ export default class ActivityPubEndpoint {
180
180
  text: "activitypub.reader.title",
181
181
  requiresDatabase: true,
182
182
  },
183
+ {
184
+ href: `${this.options.mountPath}/admin/reader/notifications`,
185
+ text: "activitypub.notifications.title",
186
+ requiresDatabase: true,
187
+ },
188
+ {
189
+ href: `${this.options.mountPath}/admin/reader/messages`,
190
+ text: "activitypub.messages.title",
191
+ requiresDatabase: true,
192
+ },
193
+ {
194
+ href: `${this.options.mountPath}/admin/reader/moderation`,
195
+ text: "activitypub.moderation.title",
196
+ requiresDatabase: true,
197
+ },
198
+ {
199
+ href: `${this.options.mountPath}/admin/my-profile`,
200
+ text: "activitypub.myProfile.title",
201
+ requiresDatabase: true,
202
+ },
183
203
  {
184
204
  href: `${this.options.mountPath}/admin/federation`,
185
205
  text: "activitypub.federationMgmt.title",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "3.9.1",
3
+ "version": "3.9.3",
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",