@rmdes/indiekit-endpoint-posts 1.0.0-beta.37 → 1.0.0-beta.39

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.
@@ -93,6 +93,13 @@ export const formController = {
93
93
  delete values.layout;
94
94
  }
95
95
 
96
+ // Remove empty AI usage fields
97
+ for (const key of ["ai-text-level", "ai-code-level", "ai-tools", "ai-description"]) {
98
+ if (!values[key]) {
99
+ delete values[key];
100
+ }
101
+ }
102
+
96
103
  const mf2 = jf2ToMf2({ properties: sanitise(values) });
97
104
 
98
105
  let jsonBody = mf2;
@@ -20,6 +20,31 @@ export const postData = {
20
20
  const postType = request.query.type || "note";
21
21
  const properties = request.body || {};
22
22
 
23
+ // Pre-fill from query params (used by "Post" button in reader UIs)
24
+ const prefillUrl = request.query.url;
25
+ const prefillName = request.query.name;
26
+
27
+ if (prefillUrl) {
28
+ const urlFieldMap = {
29
+ bookmark: "bookmark-of",
30
+ reply: "in-reply-to",
31
+ like: "like-of",
32
+ repost: "repost-of",
33
+ };
34
+ const urlField = urlFieldMap[postType];
35
+ if (urlField) {
36
+ properties[urlField] = properties[urlField] || prefillUrl;
37
+ } else if (postType === "note" || postType === "article") {
38
+ properties.content = properties.content || prefillUrl;
39
+ }
40
+ }
41
+
42
+ if (prefillName) {
43
+ if (postType === "bookmark" || postType === "article") {
44
+ properties.name = properties.name || prefillName;
45
+ }
46
+ }
47
+
23
48
  // Get post type config
24
49
  const { name, fields, h } = publication.postTypes[postType];
25
50
 
package/locales/en.json CHANGED
@@ -120,6 +120,26 @@
120
120
  },
121
121
  "visibility": {
122
122
  "label": "Visibility"
123
+ },
124
+ "ai-text-level": {
125
+ "label": "AI text level",
126
+ "0": "0 — None",
127
+ "1": "1 — Editorial assistance",
128
+ "2": "2 — Co-drafting",
129
+ "3": "3 — AI-generated (human reviewed)"
130
+ },
131
+ "ai-code-level": {
132
+ "label": "AI code level",
133
+ "0": "0 — Human-written",
134
+ "1": "1 — AI-assisted",
135
+ "2": "2 — Primarily AI-generated"
136
+ },
137
+ "ai-tools": {
138
+ "label": "AI tools",
139
+ "placeholder": "e.g. Claude, ChatGPT, Copilot"
140
+ },
141
+ "ai-description": {
142
+ "label": "AI usage note"
123
143
  }
124
144
  },
125
145
  "post": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-posts",
3
- "version": "1.0.0-beta.37",
3
+ "version": "1.0.0-beta.39",
4
4
  "description": "Post management endpoint for Indiekit with syndicate form fix. View posts published by your Micropub endpoint and publish new posts to it.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -96,6 +96,48 @@
96
96
  items: layoutSelectItems
97
97
  }) | indent(4) }}
98
98
  {% endif %}
99
+
100
+ {{ select({
101
+ name: "ai-text-level",
102
+ label: __("posts.form.ai-text-level.label"),
103
+ optional: true,
104
+ items: [
105
+ { text: "", value: "" },
106
+ { text: __("posts.form.ai-text-level.0"), value: "0", selected: properties["ai-text-level"] === "0" },
107
+ { text: __("posts.form.ai-text-level.1"), value: "1", selected: properties["ai-text-level"] === "1" },
108
+ { text: __("posts.form.ai-text-level.2"), value: "2", selected: properties["ai-text-level"] === "2" },
109
+ { text: __("posts.form.ai-text-level.3"), value: "3", selected: properties["ai-text-level"] === "3" }
110
+ ]
111
+ }) | indent(4) }}
112
+
113
+ {{ select({
114
+ name: "ai-code-level",
115
+ label: __("posts.form.ai-code-level.label"),
116
+ optional: true,
117
+ items: [
118
+ { text: "", value: "" },
119
+ { text: __("posts.form.ai-code-level.0"), value: "0", selected: properties["ai-code-level"] === "0" },
120
+ { text: __("posts.form.ai-code-level.1"), value: "1", selected: properties["ai-code-level"] === "1" },
121
+ { text: __("posts.form.ai-code-level.2"), value: "2", selected: properties["ai-code-level"] === "2" }
122
+ ]
123
+ }) | indent(4) }}
124
+
125
+ {{ input({
126
+ classes: "input--width-25",
127
+ name: "ai-tools",
128
+ value: properties["ai-tools"],
129
+ label: __("posts.form.ai-tools.label"),
130
+ hint: __("posts.form.ai-tools.placeholder"),
131
+ optional: true
132
+ }) | indent(4) }}
133
+
134
+ {{ input({
135
+ classes: "input--width-25",
136
+ name: "ai-description",
137
+ value: properties["ai-description"],
138
+ label: __("posts.form.ai-description.label"),
139
+ optional: true
140
+ }) | indent(4) }}
99
141
  {% endcall %}
100
142
  {% endblock %}
101
143