Skip to content

Commit c57aaf9

Browse files
rmdesclaude
andcommitted
Initial commit: fork of @indiekit/endpoint-posts with syndicate form fix
Fork of @indiekit/endpoint-posts to fix a critical bug where the syndicate form was using undefined `data.url` instead of `properties.url`, causing the wrong post to be syndicated. PR submitted upstream: getindiekit/indiekit#828 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit c57aaf9

52 files changed

Lines changed: 3775 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.DS_Store
3+
*.log
4+
.turbo/

CHANGELOG.md

Lines changed: 432 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# @rmdes/indiekit-endpoint-posts
2+
3+
Post management endpoint for Indiekit. View posts published by your Micropub endpoint and publish new posts to it.
4+
5+
## Fork Notice
6+
7+
This is a fork of `@indiekit/endpoint-posts` with a critical bug fix for the syndication form.
8+
9+
### Bug Fixed
10+
11+
The syndicate form button was using `data.url` for the `source_url` value, but `data` is never defined in the template context (the controller sets `properties`, not `data`). This caused the wrong post to be syndicated when clicking the "Syndicate" button.
12+
13+
**PR submitted upstream:** https://github.com/getindiekit/indiekit/pull/828
14+
15+
## Installation
16+
17+
```bash
18+
npm install @rmdes/indiekit-endpoint-posts
19+
```
20+
21+
### Using npm overrides (recommended)
22+
23+
Add to your `package.json`:
24+
25+
```json
26+
{
27+
"overrides": {
28+
"@indiekit/endpoint-posts": "npm:@rmdes/indiekit-endpoint-posts@^1.0.0-beta.25"
29+
}
30+
}
31+
```
32+
33+
This replaces the upstream package with this fork without changing your plugin configuration.
34+
35+
## Options
36+
37+
| Option | Type | Description |
38+
| :---------- | :------- | :-------------------------------------------------------------- |
39+
| `mountPath` | `string` | Path to management interface. _Optional_, defaults to `/posts`. |
40+
41+
## License
42+
43+
MIT - Original work by Paul Robert Lloyd, bug fix by Ricardo Mendes.

assets/icon.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<form action="{{ application._syndicationEndpointPath }}" method="post">
2+
{{ input({
3+
name: "access_token",
4+
type: "hidden",
5+
value: token
6+
}) | indent(2) }}
7+
8+
{{ input({
9+
name: "syndication[redirect_uri]",
10+
type: "hidden",
11+
value: redirectUri
12+
}) | indent(2) }}
13+
14+
{{ button({
15+
classes: "button--secondary button--small",
16+
name: "syndication[source_url]",
17+
value: properties.url,
18+
icon: "syndicate",
19+
text: __("posts.post.syndicate")
20+
}) | indent(2) }}
21+
</form>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% if application.micropubEndpoint %}
2+
{% call widget({
3+
title: __("posts.create.title", ""),
4+
image: "/assets/" + plugin.id + "/icon.svg"
5+
}) %}
6+
<div class="button-grid">{% for type, config in publication.postTypes | dictsort %}
7+
{{ button({
8+
classes: "button--secondary-on-offset button--inline",
9+
href: application.postsEndpoint + "/create/?type=" + config.type,
10+
text: (icon(config.type) or icon("note")) + config.name
11+
}) }}
12+
{% endfor %}</div>
13+
{% endcall %}
14+
{% endif %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ tagInput({
2+
name: "category",
3+
value: fieldData("category").value,
4+
label: __("posts.form.category.label"),
5+
hint: __("posts.form.category.hint"),
6+
optional: not field.required,
7+
localisation: {
8+
tag: __("posts.form.category.tag"),
9+
tags: __("posts.form.category.label") | lower
10+
}
11+
}) }}

includes/post-types/category.njk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{ tag({
2+
label: __("posts.form.category.label"),
3+
items: property
4+
}) if property }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ textarea({
2+
name: "content",
3+
value: properties.content.text or fieldData("content").value,
4+
label: __("posts.form.content.label"),
5+
optional: not field.required,
6+
errorMessage: fieldData("content").errorMessage,
7+
field: {
8+
attributes: {
9+
editor: true,
10+
"editor-endpoint": application.mediaEndpoint,
11+
"editor-id": (properties.uid or ("new-" + postType)) + "-content",
12+
"editor-locale": application.locale,
13+
"editor-image-upload": "false" if postType == "note" or postType == "photo",
14+
"editor-status": "false" if not field.required
15+
}
16+
}
17+
}) }}

includes/post-types/content.njk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ prose({
2+
html: property.text | markdown
3+
}) if property }}

0 commit comments

Comments
 (0)