From 6b19ac4cc7407a7775851dfe40d747c87feaa76e Mon Sep 17 00:00:00 2001 From: Ricardo Date: Fri, 6 Feb 2026 22:34:09 +0100 Subject: [PATCH] fix: correct API URL for individual mark-read The JavaScript was POSTing to /microsub/reader but the Microsub API is at /microsub. Fixed by computing parent path from baseUrl. Co-Authored-By: Claude Opus 4.5 --- package.json | 2 +- views/channel.njk | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 41cd116..24131b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-microsub", - "version": "1.0.17", + "version": "1.0.18", "description": "Microsub endpoint for Indiekit. Enables subscribing to feeds and reading content using the Microsub protocol.", "keywords": [ "indiekit", diff --git a/views/channel.njk b/views/channel.njk index 8274fbf..01a5a42 100644 --- a/views/channel.njk +++ b/views/channel.njk @@ -119,6 +119,9 @@ // Handle individual mark-read buttons const channelUid = timeline.dataset.channel; + // Microsub API is at the parent of /reader (e.g., /microsub not /microsub/reader) + const microsubApiUrl = '{{ baseUrl }}'.replace(/\/reader$/, ''); + timeline.addEventListener('click', async (e) => { const button = e.target.closest('.item-actions__mark-read'); if (!button) return; @@ -139,7 +142,7 @@ formData.append('channel', channelUid); formData.append('entry', itemId); - const response = await fetch('{{ baseUrl }}', { + const response = await fetch(microsubApiUrl, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded',