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 <noreply@anthropic.com>
This commit is contained in:
Ricardo
2026-02-06 22:34:09 +01:00
parent c830ad5df6
commit 6b19ac4cc7
2 changed files with 5 additions and 2 deletions

View File

@@ -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",

View File

@@ -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',