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

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.
@@ -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/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.38",
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",