@rmdes/indiekit-endpoint-microsub 1.0.4 → 1.0.6

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.
@@ -310,14 +310,24 @@ export async function item(request, response) {
310
310
  * @returns {Promise<void>}
311
311
  */
312
312
  export async function compose(request, response) {
313
- const { replyTo, likeOf, repostOf, bookmarkOf } = request.query;
314
-
315
- response.render("compose", {
316
- title: request.__("microsub.compose.title"),
313
+ // Support both long-form (replyTo) and short-form (reply) query params
314
+ const {
317
315
  replyTo,
316
+ reply,
318
317
  likeOf,
318
+ like,
319
319
  repostOf,
320
+ repost,
320
321
  bookmarkOf,
322
+ bookmark,
323
+ } = request.query;
324
+
325
+ response.render("compose", {
326
+ title: request.__("microsub.compose.title"),
327
+ replyTo: replyTo || reply,
328
+ likeOf: likeOf || like,
329
+ repostOf: repostOf || repost,
330
+ bookmarkOf: bookmarkOf || bookmark,
321
331
  baseUrl: request.baseUrl,
322
332
  });
323
333
  }
@@ -336,6 +346,19 @@ export async function submitCompose(request, response) {
336
346
  const repostOf = request.body["repost-of"];
337
347
  const bookmarkOf = request.body["bookmark-of"];
338
348
 
349
+ // Debug logging
350
+ console.info(
351
+ "[Microsub] submitCompose request.body:",
352
+ JSON.stringify(request.body),
353
+ );
354
+ console.info("[Microsub] Extracted values:", {
355
+ content,
356
+ inReplyTo,
357
+ likeOf,
358
+ repostOf,
359
+ bookmarkOf,
360
+ });
361
+
339
362
  // Get Micropub endpoint
340
363
  const micropubEndpoint = application.micropubEndpoint;
341
364
  if (!micropubEndpoint) {
@@ -381,6 +404,12 @@ export async function submitCompose(request, response) {
381
404
  micropubData.append("content", content || "");
382
405
  }
383
406
 
407
+ // Debug: log what we're sending
408
+ console.info("[Microsub] Sending to Micropub:", {
409
+ url: micropubUrl,
410
+ body: micropubData.toString(),
411
+ });
412
+
384
413
  try {
385
414
  const micropubResponse = await fetch(micropubUrl, {
386
415
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-microsub",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Microsub endpoint for Indiekit. Enables subscribing to feeds and reading content using the Microsub protocol.",
5
5
  "keywords": [
6
6
  "indiekit",
package/views/compose.njk CHANGED
@@ -8,57 +8,57 @@
8
8
 
9
9
  <h2>{{ __("microsub.compose.title") }}</h2>
10
10
 
11
- {% if replyTo or reply %}
11
+ {% if replyTo %}
12
12
  <div class="compose__context">
13
13
  {{ icon("reply") }} {{ __("microsub.compose.replyTo") }}:
14
- <a href="{{ replyTo or reply }}" target="_blank" rel="noopener">
15
- {{ (replyTo or reply) | replace("https://", "") | replace("http://", "") }}
14
+ <a href="{{ replyTo }}" target="_blank" rel="noopener">
15
+ {{ replyTo | replace("https://", "") | replace("http://", "") }}
16
16
  </a>
17
17
  </div>
18
18
  {% endif %}
19
19
 
20
- {% if likeOf or like %}
20
+ {% if likeOf %}
21
21
  <div class="compose__context">
22
22
  {{ icon("like") }} {{ __("microsub.compose.likeOf") }}:
23
- <a href="{{ likeOf or like }}" target="_blank" rel="noopener">
24
- {{ (likeOf or like) | replace("https://", "") | replace("http://", "") }}
23
+ <a href="{{ likeOf }}" target="_blank" rel="noopener">
24
+ {{ likeOf | replace("https://", "") | replace("http://", "") }}
25
25
  </a>
26
26
  </div>
27
27
  {% endif %}
28
28
 
29
- {% if repostOf or repost %}
29
+ {% if repostOf %}
30
30
  <div class="compose__context">
31
31
  {{ icon("repost") }} {{ __("microsub.compose.repostOf") }}:
32
- <a href="{{ repostOf or repost }}" target="_blank" rel="noopener">
33
- {{ (repostOf or repost) | replace("https://", "") | replace("http://", "") }}
32
+ <a href="{{ repostOf }}" target="_blank" rel="noopener">
33
+ {{ repostOf | replace("https://", "") | replace("http://", "") }}
34
34
  </a>
35
35
  </div>
36
36
  {% endif %}
37
37
 
38
- {% if bookmarkOf or bookmark %}
38
+ {% if bookmarkOf %}
39
39
  <div class="compose__context">
40
40
  {{ icon("bookmark") }} {{ __("microsub.compose.bookmarkOf") }}:
41
- <a href="{{ bookmarkOf or bookmark }}" target="_blank" rel="noopener">
42
- {{ (bookmarkOf or bookmark) | replace("https://", "") | replace("http://", "") }}
41
+ <a href="{{ bookmarkOf }}" target="_blank" rel="noopener">
42
+ {{ bookmarkOf | replace("https://", "") | replace("http://", "") }}
43
43
  </a>
44
44
  </div>
45
45
  {% endif %}
46
46
 
47
47
  <form method="post" action="{{ baseUrl }}/compose">
48
- {% if replyTo or reply %}
49
- <input type="hidden" name="in-reply-to" value="{{ replyTo or reply }}">
48
+ {% if replyTo %}
49
+ <input type="hidden" name="in-reply-to" value="{{ replyTo }}">
50
50
  {% endif %}
51
- {% if likeOf or like %}
52
- <input type="hidden" name="like-of" value="{{ likeOf or like }}">
51
+ {% if likeOf %}
52
+ <input type="hidden" name="like-of" value="{{ likeOf }}">
53
53
  {% endif %}
54
- {% if repostOf or repost %}
55
- <input type="hidden" name="repost-of" value="{{ repostOf or repost }}">
54
+ {% if repostOf %}
55
+ <input type="hidden" name="repost-of" value="{{ repostOf }}">
56
56
  {% endif %}
57
- {% if bookmarkOf or bookmark %}
58
- <input type="hidden" name="bookmark-of" value="{{ bookmarkOf or bookmark }}">
57
+ {% if bookmarkOf %}
58
+ <input type="hidden" name="bookmark-of" value="{{ bookmarkOf }}">
59
59
  {% endif %}
60
60
 
61
- {% set isAction = (likeOf or like) or (repostOf or repost) or (bookmarkOf or bookmark) %}
61
+ {% set isAction = likeOf or repostOf or bookmarkOf %}
62
62
 
63
63
  {% if not isAction %}
64
64
  {{ textarea({