@geekity/cms 0.3.0

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.
Files changed (238) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +870 -0
  3. package/admin/layouts/_flash.njk +5 -0
  4. package/admin/layouts/base.njk +27 -0
  5. package/admin/layouts/dashboard.njk +78 -0
  6. package/admin/layouts/document-conflict.njk +49 -0
  7. package/admin/layouts/document-editor.njk +167 -0
  8. package/admin/layouts/document-list.njk +92 -0
  9. package/admin/layouts/federation.njk +145 -0
  10. package/admin/layouts/login.njk +23 -0
  11. package/admin/layouts/placeholder.njk +10 -0
  12. package/admin/layouts/settings.njk +116 -0
  13. package/admin/layouts/setup.njk +27 -0
  14. package/admin/layouts/shell.njk +37 -0
  15. package/admin/layouts/users.njk +91 -0
  16. package/admin/static/admin.css +726 -0
  17. package/admin/static/editor.js +30 -0
  18. package/dist/admin/assets.d.ts +26 -0
  19. package/dist/admin/assets.d.ts.map +1 -0
  20. package/dist/admin/assets.js +38 -0
  21. package/dist/admin/assets.js.map +1 -0
  22. package/dist/admin/credentials.d.ts +28 -0
  23. package/dist/admin/credentials.d.ts.map +1 -0
  24. package/dist/admin/credentials.js +39 -0
  25. package/dist/admin/credentials.js.map +1 -0
  26. package/dist/admin/documents.d.ts +134 -0
  27. package/dist/admin/documents.d.ts.map +1 -0
  28. package/dist/admin/documents.js +613 -0
  29. package/dist/admin/documents.js.map +1 -0
  30. package/dist/admin/federation.d.ts +194 -0
  31. package/dist/admin/federation.d.ts.map +1 -0
  32. package/dist/admin/federation.js +299 -0
  33. package/dist/admin/federation.js.map +1 -0
  34. package/dist/admin/flash.d.ts +24 -0
  35. package/dist/admin/flash.d.ts.map +1 -0
  36. package/dist/admin/flash.js +31 -0
  37. package/dist/admin/flash.js.map +1 -0
  38. package/dist/admin/index.d.ts +23 -0
  39. package/dist/admin/index.d.ts.map +1 -0
  40. package/dist/admin/index.js +15 -0
  41. package/dist/admin/index.js.map +1 -0
  42. package/dist/admin/passwords.d.ts +49 -0
  43. package/dist/admin/passwords.d.ts.map +1 -0
  44. package/dist/admin/passwords.js +122 -0
  45. package/dist/admin/passwords.js.map +1 -0
  46. package/dist/admin/preview.d.ts +18 -0
  47. package/dist/admin/preview.d.ts.map +1 -0
  48. package/dist/admin/preview.js +83 -0
  49. package/dist/admin/preview.js.map +1 -0
  50. package/dist/admin/routes.d.ts +54 -0
  51. package/dist/admin/routes.d.ts.map +1 -0
  52. package/dist/admin/routes.js +383 -0
  53. package/dist/admin/routes.js.map +1 -0
  54. package/dist/admin/session.d.ts +44 -0
  55. package/dist/admin/session.d.ts.map +1 -0
  56. package/dist/admin/session.js +69 -0
  57. package/dist/admin/session.js.map +1 -0
  58. package/dist/admin/settings.d.ts +194 -0
  59. package/dist/admin/settings.d.ts.map +1 -0
  60. package/dist/admin/settings.js +470 -0
  61. package/dist/admin/settings.js.map +1 -0
  62. package/dist/admin/store.d.ts +407 -0
  63. package/dist/admin/store.d.ts.map +1 -0
  64. package/dist/admin/store.js +704 -0
  65. package/dist/admin/store.js.map +1 -0
  66. package/dist/admin/templates.d.ts +36 -0
  67. package/dist/admin/templates.d.ts.map +1 -0
  68. package/dist/admin/templates.js +43 -0
  69. package/dist/admin/templates.js.map +1 -0
  70. package/dist/admin/uploads.d.ts +96 -0
  71. package/dist/admin/uploads.d.ts.map +1 -0
  72. package/dist/admin/uploads.js +179 -0
  73. package/dist/admin/uploads.js.map +1 -0
  74. package/dist/admin/users.d.ts +95 -0
  75. package/dist/admin/users.d.ts.map +1 -0
  76. package/dist/admin/users.js +233 -0
  77. package/dist/admin/users.js.map +1 -0
  78. package/dist/cli.d.ts +85 -0
  79. package/dist/cli.d.ts.map +1 -0
  80. package/dist/cli.js +424 -0
  81. package/dist/cli.js.map +1 -0
  82. package/dist/config.d.ts +172 -0
  83. package/dist/config.d.ts.map +1 -0
  84. package/dist/config.js +184 -0
  85. package/dist/config.js.map +1 -0
  86. package/dist/content/document.d.ts +66 -0
  87. package/dist/content/document.d.ts.map +1 -0
  88. package/dist/content/document.js +13 -0
  89. package/dist/content/document.js.map +1 -0
  90. package/dist/content/index.d.ts +17 -0
  91. package/dist/content/index.d.ts.map +1 -0
  92. package/dist/content/index.js +10 -0
  93. package/dist/content/index.js.map +1 -0
  94. package/dist/content/markdown.d.ts +3 -0
  95. package/dist/content/markdown.d.ts.map +1 -0
  96. package/dist/content/markdown.js +39 -0
  97. package/dist/content/markdown.js.map +1 -0
  98. package/dist/content/media.d.ts +65 -0
  99. package/dist/content/media.d.ts.map +1 -0
  100. package/dist/content/media.js +143 -0
  101. package/dist/content/media.js.map +1 -0
  102. package/dist/content/parser.d.ts +24 -0
  103. package/dist/content/parser.d.ts.map +1 -0
  104. package/dist/content/parser.js +165 -0
  105. package/dist/content/parser.js.map +1 -0
  106. package/dist/content/save.d.ts +60 -0
  107. package/dist/content/save.d.ts.map +1 -0
  108. package/dist/content/save.js +103 -0
  109. package/dist/content/save.js.map +1 -0
  110. package/dist/content/slug.d.ts +25 -0
  111. package/dist/content/slug.d.ts.map +1 -0
  112. package/dist/content/slug.js +75 -0
  113. package/dist/content/slug.js.map +1 -0
  114. package/dist/content/store.d.ts +133 -0
  115. package/dist/content/store.d.ts.map +1 -0
  116. package/dist/content/store.js +411 -0
  117. package/dist/content/store.js.map +1 -0
  118. package/dist/content/sync.d.ts +146 -0
  119. package/dist/content/sync.d.ts.map +1 -0
  120. package/dist/content/sync.js +421 -0
  121. package/dist/content/sync.js.map +1 -0
  122. package/dist/content/writer.d.ts +37 -0
  123. package/dist/content/writer.d.ts.map +1 -0
  124. package/dist/content/writer.js +97 -0
  125. package/dist/content/writer.js.map +1 -0
  126. package/dist/env.d.ts +48 -0
  127. package/dist/env.d.ts.map +1 -0
  128. package/dist/env.js +2 -0
  129. package/dist/env.js.map +1 -0
  130. package/dist/federation/actor.d.ts +55 -0
  131. package/dist/federation/actor.d.ts.map +1 -0
  132. package/dist/federation/actor.js +101 -0
  133. package/dist/federation/actor.js.map +1 -0
  134. package/dist/federation/article.d.ts +83 -0
  135. package/dist/federation/article.d.ts.map +1 -0
  136. package/dist/federation/article.js +169 -0
  137. package/dist/federation/article.js.map +1 -0
  138. package/dist/federation/delivery.d.ts +90 -0
  139. package/dist/federation/delivery.d.ts.map +1 -0
  140. package/dist/federation/delivery.js +289 -0
  141. package/dist/federation/delivery.js.map +1 -0
  142. package/dist/federation/federation.d.ts +75 -0
  143. package/dist/federation/federation.d.ts.map +1 -0
  144. package/dist/federation/federation.js +190 -0
  145. package/dist/federation/federation.js.map +1 -0
  146. package/dist/federation/followers.d.ts +43 -0
  147. package/dist/federation/followers.d.ts.map +1 -0
  148. package/dist/federation/followers.js +69 -0
  149. package/dist/federation/followers.js.map +1 -0
  150. package/dist/federation/inbox.d.ts +68 -0
  151. package/dist/federation/inbox.d.ts.map +1 -0
  152. package/dist/federation/inbox.js +171 -0
  153. package/dist/federation/inbox.js.map +1 -0
  154. package/dist/federation/index.d.ts +14 -0
  155. package/dist/federation/index.d.ts.map +1 -0
  156. package/dist/federation/index.js +10 -0
  157. package/dist/federation/index.js.map +1 -0
  158. package/dist/federation/keys.d.ts +27 -0
  159. package/dist/federation/keys.d.ts.map +1 -0
  160. package/dist/federation/keys.js +60 -0
  161. package/dist/federation/keys.js.map +1 -0
  162. package/dist/federation/mount.d.ts +23 -0
  163. package/dist/federation/mount.d.ts.map +1 -0
  164. package/dist/federation/mount.js +71 -0
  165. package/dist/federation/mount.js.map +1 -0
  166. package/dist/federation/paths.d.ts +85 -0
  167. package/dist/federation/paths.d.ts.map +1 -0
  168. package/dist/federation/paths.js +97 -0
  169. package/dist/federation/paths.js.map +1 -0
  170. package/dist/index.d.ts +106 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +148 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/init.d.ts +71 -0
  175. package/dist/init.d.ts.map +1 -0
  176. package/dist/init.js +125 -0
  177. package/dist/init.js.map +1 -0
  178. package/dist/web/assets.d.ts +65 -0
  179. package/dist/web/assets.d.ts.map +1 -0
  180. package/dist/web/assets.js +152 -0
  181. package/dist/web/assets.js.map +1 -0
  182. package/dist/web/context.d.ts +121 -0
  183. package/dist/web/context.d.ts.map +1 -0
  184. package/dist/web/context.js +112 -0
  185. package/dist/web/context.js.map +1 -0
  186. package/dist/web/documents.d.ts +28 -0
  187. package/dist/web/documents.d.ts.map +1 -0
  188. package/dist/web/documents.js +39 -0
  189. package/dist/web/documents.js.map +1 -0
  190. package/dist/web/feeds.d.ts +122 -0
  191. package/dist/web/feeds.d.ts.map +1 -0
  192. package/dist/web/feeds.js +229 -0
  193. package/dist/web/feeds.js.map +1 -0
  194. package/dist/web/index.d.ts +17 -0
  195. package/dist/web/index.d.ts.map +1 -0
  196. package/dist/web/index.js +10 -0
  197. package/dist/web/index.js.map +1 -0
  198. package/dist/web/negotiate.d.ts +219 -0
  199. package/dist/web/negotiate.d.ts.map +1 -0
  200. package/dist/web/negotiate.js +409 -0
  201. package/dist/web/negotiate.js.map +1 -0
  202. package/dist/web/pagination.d.ts +48 -0
  203. package/dist/web/pagination.d.ts.map +1 -0
  204. package/dist/web/pagination.js +30 -0
  205. package/dist/web/pagination.js.map +1 -0
  206. package/dist/web/render.d.ts +72 -0
  207. package/dist/web/render.d.ts.map +1 -0
  208. package/dist/web/render.js +73 -0
  209. package/dist/web/render.js.map +1 -0
  210. package/dist/web/routes.d.ts +31 -0
  211. package/dist/web/routes.d.ts.map +1 -0
  212. package/dist/web/routes.js +366 -0
  213. package/dist/web/routes.js.map +1 -0
  214. package/dist/web/templates.d.ts +34 -0
  215. package/dist/web/templates.d.ts.map +1 -0
  216. package/dist/web/templates.js +106 -0
  217. package/dist/web/templates.js.map +1 -0
  218. package/package.json +68 -0
  219. package/templates/site/content/_data/site.json +8 -0
  220. package/templates/site/content/pages/about.md +11 -0
  221. package/templates/site/content/pages/pages.json +3 -0
  222. package/templates/site/content/posts/2026-01-01-hello-world.md +34 -0
  223. package/templates/site/content/posts/posts.json +4 -0
  224. package/templates/site/geekity.config.ts +11 -0
  225. package/templates/site/gitignore +3 -0
  226. package/templates/site/server.ts +20 -0
  227. package/templates/site/tsconfig.json +18 -0
  228. package/themes/default/README.md +148 -0
  229. package/themes/default/layouts/404.njk +9 -0
  230. package/themes/default/layouts/base.njk +59 -0
  231. package/themes/default/layouts/home.njk +9 -0
  232. package/themes/default/layouts/page.njk +13 -0
  233. package/themes/default/layouts/post.njk +30 -0
  234. package/themes/default/layouts/tag.njk +19 -0
  235. package/themes/default/partials/pagination.njk +14 -0
  236. package/themes/default/partials/post-list.njk +24 -0
  237. package/themes/default/partials/tags.njk +12 -0
  238. package/themes/default/static/style.css +327 -0
@@ -0,0 +1,85 @@
1
+ import type { FederationOrigin } from '@fedify/fedify';
2
+ /**
3
+ * Where the ActivityPub endpoints live, under one prefix so they never
4
+ * collide with a permalink. doc-4 puts post objects at `/ap/posts/{slug}`;
5
+ * the actor is its sibling.
6
+ */
7
+ export declare const FEDERATION_PREFIX = "/ap";
8
+ /**
9
+ * The actor's path template.
10
+ *
11
+ * The identifier is a template variable because Fedify requires one, but only
12
+ * the site actor's sentinel identifier ever answers: a site is one actor.
13
+ * Because that identifier is a constant rather than the handle, the actor's id
14
+ * is `{baseUrl}/ap/actor` however often the handle is renamed.
15
+ */
16
+ export declare const ACTOR_PATH: "/ap/{identifier}";
17
+ /** The actor's inbox, its outbox and its two follow collections. */
18
+ export declare const INBOX_PATH: "/ap/{identifier}/inbox";
19
+ export declare const OUTBOX_PATH: "/ap/{identifier}/outbox";
20
+ export declare const FOLLOWERS_PATH: "/ap/{identifier}/followers";
21
+ export declare const FOLLOWING_PATH: "/ap/{identifier}/following";
22
+ /** The instance-wide inbox, which a peer may use to deliver to every actor at once. */
23
+ export declare const SHARED_INBOX_PATH: "/ap/shared-inbox";
24
+ /**
25
+ * A post's object path template.
26
+ *
27
+ * The slug, not the permalink, is what names the object, exactly as doc-4
28
+ * asks: a post moved from `/2026/09/hello/` to `/notes/hello/` keeps its
29
+ * ActivityStreams id, so the followers who already have the object are not
30
+ * handed a second one.
31
+ */
32
+ export declare const POST_OBJECT_PATH: "/ap/posts/{slug}";
33
+ /** Where the NodeInfo 2.1 document lives; `/.well-known/nodeinfo` points at it. */
34
+ export declare const NODEINFO_PATH = "/nodeinfo/2.1";
35
+ /** The path a post's ActivityStreams object is served at. */
36
+ export declare function postObjectPath(slug: string): string;
37
+ /**
38
+ * A post's ActivityStreams id, as an absolute URL.
39
+ *
40
+ * It is built on the {@link federationOrigin} rather than on the whole base
41
+ * URL, because that is where Fedify serves the object from: a site in a
42
+ * subdirectory keeps its pages under that directory, but its federation
43
+ * endpoints — this one included — are host-rooted.
44
+ */
45
+ export declare function postObjectId(slug: string, baseUrl: string): string;
46
+ /**
47
+ * The id of the `Create` that announced an object.
48
+ *
49
+ * A fragment of the object's own id, so it is derivable from the article
50
+ * without a second lookup and stable for as long as the article's id is. An
51
+ * activity is not dereferenceable on its own here; naming it is what lets a
52
+ * peer recognise the same announcement twice.
53
+ */
54
+ export declare function createActivityId(objectId: URL | string): URL;
55
+ /**
56
+ * The id of the `Update` that announced one revision of an object.
57
+ *
58
+ * A `Create` happens once and so needs no revision in its id; an `Update`
59
+ * happens as often as the post is edited, and an activity id a peer has
60
+ * already seen is one it is entitled to ignore. The revision is the document's
61
+ * content hash, which makes the id deterministic — the same edit redelivered
62
+ * is the same activity rather than a second one — and unique, because the sync
63
+ * only reports an update when the hash has moved.
64
+ */
65
+ export declare function updateActivityId(objectId: URL | string, revision: string): URL;
66
+ /**
67
+ * The id of the `Delete` that withdrew an object.
68
+ *
69
+ * The revision is when the deletion happened, because a post can be
70
+ * unpublished, published again and unpublished again, and each of those is a
71
+ * `Delete` a peer should act on rather than recognise and skip.
72
+ */
73
+ export declare function deleteActivityId(objectId: URL | string, revision: string): URL;
74
+ /**
75
+ * The origin a base URL federates under: its host for handles, its scheme and
76
+ * authority for ids.
77
+ *
78
+ * The path is dropped, and has to be. WebFinger and NodeInfo are defined at
79
+ * `/.well-known/…` on the host, not under whatever directory a site happens to
80
+ * be mounted in, so a site at `https://example.com/blog` is still the actor
81
+ * `@blog@example.com` and still answers discovery at the host root. Its posts
82
+ * keep their base path; only the federation endpoints ignore it.
83
+ */
84
+ export declare function federationOrigin(baseUrl: string): FederationOrigin;
85
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/federation/paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,oBAA+C,CAAC;AAEvE,oEAAoE;AACpE,eAAO,MAAM,UAAU,0BAAiC,CAAC;AACzD,eAAO,MAAM,WAAW,2BAAkC,CAAC;AAC3D,eAAO,MAAM,cAAc,8BAAqC,CAAC;AACjE,eAAO,MAAM,cAAc,8BAAqC,CAAC;AACjE,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,oBAA+C,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,oBAA+C,CAAC;AAE7E,mFAAmF;AACnF,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,CAE5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,CAE9E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,CAE9E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAGlE"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Where the ActivityPub endpoints live, under one prefix so they never
3
+ * collide with a permalink. doc-4 puts post objects at `/ap/posts/{slug}`;
4
+ * the actor is its sibling.
5
+ */
6
+ export const FEDERATION_PREFIX = '/ap';
7
+ /**
8
+ * The actor's path template.
9
+ *
10
+ * The identifier is a template variable because Fedify requires one, but only
11
+ * the site actor's sentinel identifier ever answers: a site is one actor.
12
+ * Because that identifier is a constant rather than the handle, the actor's id
13
+ * is `{baseUrl}/ap/actor` however often the handle is renamed.
14
+ */
15
+ export const ACTOR_PATH = `${FEDERATION_PREFIX}/{identifier}`;
16
+ /** The actor's inbox, its outbox and its two follow collections. */
17
+ export const INBOX_PATH = `${ACTOR_PATH}/inbox`;
18
+ export const OUTBOX_PATH = `${ACTOR_PATH}/outbox`;
19
+ export const FOLLOWERS_PATH = `${ACTOR_PATH}/followers`;
20
+ export const FOLLOWING_PATH = `${ACTOR_PATH}/following`;
21
+ /** The instance-wide inbox, which a peer may use to deliver to every actor at once. */
22
+ export const SHARED_INBOX_PATH = `${FEDERATION_PREFIX}/shared-inbox`;
23
+ /**
24
+ * A post's object path template.
25
+ *
26
+ * The slug, not the permalink, is what names the object, exactly as doc-4
27
+ * asks: a post moved from `/2026/09/hello/` to `/notes/hello/` keeps its
28
+ * ActivityStreams id, so the followers who already have the object are not
29
+ * handed a second one.
30
+ */
31
+ export const POST_OBJECT_PATH = `${FEDERATION_PREFIX}/posts/{slug}`;
32
+ /** Where the NodeInfo 2.1 document lives; `/.well-known/nodeinfo` points at it. */
33
+ export const NODEINFO_PATH = '/nodeinfo/2.1';
34
+ /** The path a post's ActivityStreams object is served at. */
35
+ export function postObjectPath(slug) {
36
+ return `${FEDERATION_PREFIX}/posts/${encodeURIComponent(slug)}`;
37
+ }
38
+ /**
39
+ * A post's ActivityStreams id, as an absolute URL.
40
+ *
41
+ * It is built on the {@link federationOrigin} rather than on the whole base
42
+ * URL, because that is where Fedify serves the object from: a site in a
43
+ * subdirectory keeps its pages under that directory, but its federation
44
+ * endpoints — this one included — are host-rooted.
45
+ */
46
+ export function postObjectId(slug, baseUrl) {
47
+ return new URL(postObjectPath(slug), federationOrigin(baseUrl).webOrigin).href;
48
+ }
49
+ /**
50
+ * The id of the `Create` that announced an object.
51
+ *
52
+ * A fragment of the object's own id, so it is derivable from the article
53
+ * without a second lookup and stable for as long as the article's id is. An
54
+ * activity is not dereferenceable on its own here; naming it is what lets a
55
+ * peer recognise the same announcement twice.
56
+ */
57
+ export function createActivityId(objectId) {
58
+ return new URL(`${objectId.toString()}#create`);
59
+ }
60
+ /**
61
+ * The id of the `Update` that announced one revision of an object.
62
+ *
63
+ * A `Create` happens once and so needs no revision in its id; an `Update`
64
+ * happens as often as the post is edited, and an activity id a peer has
65
+ * already seen is one it is entitled to ignore. The revision is the document's
66
+ * content hash, which makes the id deterministic — the same edit redelivered
67
+ * is the same activity rather than a second one — and unique, because the sync
68
+ * only reports an update when the hash has moved.
69
+ */
70
+ export function updateActivityId(objectId, revision) {
71
+ return new URL(`${objectId.toString()}#update/${encodeURIComponent(revision)}`);
72
+ }
73
+ /**
74
+ * The id of the `Delete` that withdrew an object.
75
+ *
76
+ * The revision is when the deletion happened, because a post can be
77
+ * unpublished, published again and unpublished again, and each of those is a
78
+ * `Delete` a peer should act on rather than recognise and skip.
79
+ */
80
+ export function deleteActivityId(objectId, revision) {
81
+ return new URL(`${objectId.toString()}#delete/${encodeURIComponent(revision)}`);
82
+ }
83
+ /**
84
+ * The origin a base URL federates under: its host for handles, its scheme and
85
+ * authority for ids.
86
+ *
87
+ * The path is dropped, and has to be. WebFinger and NodeInfo are defined at
88
+ * `/.well-known/…` on the host, not under whatever directory a site happens to
89
+ * be mounted in, so a site at `https://example.com/blog` is still the actor
90
+ * `@blog@example.com` and still answers discovery at the host root. Its posts
91
+ * keep their base path; only the federation endpoints ignore it.
92
+ */
93
+ export function federationOrigin(baseUrl) {
94
+ const url = new URL(baseUrl);
95
+ return { handleHost: url.host, webOrigin: url.origin };
96
+ }
97
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/federation/paths.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,iBAAiB,eAAwB,CAAC;AAEvE,oEAAoE;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,UAAU,QAAiB,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,UAAU,SAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,UAAU,YAAqB,CAAC;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,UAAU,YAAqB,CAAC;AACjE,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,iBAAiB,eAAwB,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,iBAAiB,eAAwB,CAAC;AAE7E,mFAAmF;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAE7C,6DAA6D;AAC7D,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,GAAG,iBAAiB,UAAU,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,OAAe;IACxD,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;AACjF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAsB;IACrD,OAAO,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAsB,EAAE,QAAgB;IACvE,OAAO,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,WAAW,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAsB,EAAE,QAAgB;IACvE,OAAO,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,WAAW,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAClF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { Hono } from 'hono';
2
+ import type { AdminStore } from './admin/index.ts';
3
+ import type { DocumentChangeHook, GeekityConfig, ResolvedConfig } from './config.ts';
4
+ import type { ContentEvents, ContentStore, SyncResult } from './content/index.ts';
5
+ import type { GeekityEnv } from './env.ts';
6
+ import type { DeliveryService, SiteFederation } from './federation/index.ts';
7
+ export { ACTOR_HANDLE_PATTERN, ACTOR_KEY_ALGORITHMS, ACTOR_TYPES, DELIVERY_STATUSES, ADMIN_ASSET_MAX_AGE, ADMIN_ASSET_PREFIX, ADMIN_PREFIX, ADMIN_SECTIONS, ADMIN_STATIC_DIR, ADMIN_TEMPLATES, actorSummary, addUserProblems, adminAssetResponse, ARGON2_PARAMETERS, AVATAR_FIELDS, AVATAR_PATH, AVATAR_REMOVE, blankForm, CHANGE_PASSWORD_PATH, changePasswordProblems, clearSessionCookie, createAdminTemplateEnvironment, credentialProblem, CSRF_FIELD, csrfTokenMatches, DASHBOARD_RECENT_POSTS, DEFAULT_SITE_SETTINGS, DELETE_USER_PATH, deleteUserRefusal, deliveryRows, DOCUMENT_FILTERS, documentFilter, DOCUMENTS_PER_PAGE, editorPath, effectiveBaseUrl, EXCLUDE_KEY, DuplicateUsernameError, FEDERATION_FIELDS, FEDERATION_PATH, FEDERATION_RECENT, findAdminAsset, findBySlug, followerRow, formFor, formFromSettings, flash, GENERATED_PASSWORD_ALPHABET, GENERATED_PASSWORD_LENGTH, generatePassword, guard, hashPassword, INBOX_INTERACTIONS, inboxRows, LOGIN_PATH, LOGOUT_PATH, listingUrl, listOptionsFor, localPosts, MAXIMUM_USERNAME_LENGTH, MINIMUM_PASSWORD_LENGTH, mountAdmin, mountDocumentScreens, mountFederationScreen, mountPreview, mountSettings, mountUploads, mountUsers, newEditorPath, openAdminStore, PAGE_KIND, PACKAGED_ADMIN_DIR, passwordProblem, postEditorPath, POST_KIND, PREVIEW_PATH, profileChanged, QUICK_DRAFT_PATH, readSiteSettings, REDELIVER_PATH, redeliveryMessage, refusedUpload, refuseOversizedUpload, returnPath, seedSiteSettings, SESSION_COOKIE, SESSION_ID_BYTES, sessionIdFrom, setSessionCookie, SETTINGS_FIELDS, SETTINGS_PATH, settingsFromForm, settingsProblems, settingsSiteData, SETUP_PATH, siteDataPath, siteJsonFor, splitTags, storeUpload, takeFlash, tooLargeMessage, UPLOAD_ENVELOPE_BYTES, UPLOAD_FIELD, UPLOADS_PATH, USER_FIELDS, USERNAME_PATTERN, usernameProblem, USERS_PATH, usesSecureCookies, verifyPasswordHash, writeSiteJson, writeSiteSettings, } from './admin/index.ts';
8
+ export type { ActorKey, ActorKeyAlgorithm, ActorSummary, AddUserProblems, AdminRender, AdminSection, AdminStore, ChangePasswordProblems, CreateAdminTemplateEnvironmentOptions, CreateSessionInput, CreateUserInput, Delivery, DeliveryRow, DeliveryRowsContext, DeliveryStatus, DocumentFilter, DocumentKind, DocumentRow, EditorForm, FlashKind, FlashMessage, Follower, FollowerRow, InboxActivity, InboxRow, InboxRowsContext, ListPageOptions, LocalPost, MountDocumentScreensOptions, MountFederationScreenOptions, MountSettingsOptions, MountUsersOptions, NewActorKey, NewDelivery, NewFollower, NewInboxActivity, NewOutboundActivity, OpenAdminStoreOptions, OutboundActivity, Session, SettingsField, SettingsForm, SettingsProblems, SiteSettings, StoredUpload, StoredUser, StoreUploadOptions, UploadConfig, UploadRefusal, UploadResult, User, } from './admin/index.ts';
9
+ export { DEFAULT_UPLOAD_MAX_BYTES, DEFAULT_UPLOAD_TYPES, defineConfig, resolveConfig, } from './config.ts';
10
+ export type { DocumentChangeHook, FederationOverrides, GeekityConfig, ResolvedConfig, ResolveConfigContext, } from './config.ts';
11
+ export { DirectoryNotEmptyError, initSite, SITE_TEMPLATE_DIR, siteManifest } from './init.ts';
12
+ export type { InitSiteOptions, InitSiteResult } from './init.ts';
13
+ export { contentFilePath, createContentSync, DATABASE_FILE, dateSortKey, DEFAULT_DEBOUNCE_MS, defaultPermalink, documentContent, documentFrontMatter, freeSlug, DuplicatePermalinkError, hashDocument, isTrashedPath, KNOWN_FRONT_MATTER_KEYS, KNOWN_UPLOAD_TYPES, matchesSignature, normalizeBody, normalizeUploadType, openContentStore, parseDocument, renderMarkdown, saveDocument, serializeDocument, slugify, TRASH_DIRECTORY, typeForPath, UPLOAD_MEDIA_TYPES, } from './content/index.ts';
14
+ export type { ActivityPubMetadata, ChangeOrigin, ContentCounts, ContentFilePathInput, ContentEventListener, ContentEventMap, ContentEvents, ContentStore, ContentSync, CreateContentSyncOptions, DefaultPermalinkInput, Document, DocumentChange, DocumentChangeType, DocumentContent, DocumentType, FreeSlugOptions, ListAllOptions, ListByTagOptions, ListOptions, OpenContentStoreOptions, ParseDocumentOptions, SaveDocumentOptions, SyncLogger, SyncResult, TagCount, UploadMediaType, UploadSignature, } from './content/index.ts';
15
+ export type { GeekityEnv } from './env.ts';
16
+ export { ACTOR_CLASSES, ACTOR_PATH, actorClassFor, articleObjectId, avatarUrl, createActivityId, createDeliveryService, createSiteFederation, deleteActivityId, federatedObject, federatedPost, FEDERATION_PREFIX, federationOrigin, followerFrom, followerRecipient, FOLLOWERS_PAGE_SIZE, FOLLOWERS_PATH, followersPage, FOLLOWING_PATH, groupByInbox, handleDelete, handleFollow, handleLoggedActivity, handleUndo, INBOX_PATH, isFederatedDocument, lastFollowersCursor, loadActorKeyPairs, logActivity, mountFederation, NODEINFO_PATH, OUTBOX_PAGE_SIZE, OUTBOX_PATH, POST_OBJECT_PATH, postArticle, postCreateActivity, postDeleteActivity, postObjectId, postObjectPath, postUpdateActivity, SHARED_INBOX_PATH, SITE_ACTOR_IDENTIFIER, siteActor, SOFTWARE_NAME, SOURCE_MEDIA_TYPE, toInstant, updateActivityId, } from './federation/index.ts';
17
+ export type { CreateDeliveryServiceOptions, CreateSiteFederationOptions, DeliveryLogger, DeliveryReport, DeliveryService, FederationContextData, SiteActorOptions, SiteFederation, SiteInboxContext, } from './federation/index.ts';
18
+ export { absoluteUrl, ACTIVITY_STREAMS_MEDIA_TYPES, activityStreamsId, alternateLinks, assetNotModified, assetResponse, atomFeed, contentEtag, createRenderer, createSiteDataSource, createTemplateEnvironment, DEFAULT_FEED_SIZE, DEFAULT_POSTS_PER_PAGE, DOCUMENT_REPRESENTATIONS, documentContext, documentJson, escapeXml, FEED_CONTENT_TYPES, FEED_FILES, FEED_GENERATOR, FEED_GENERATOR_URI, feedHref, feedResponse, feedSize, findAsset, findThemeAsset, findUpload, formatDate, homeHref, isNotModified, isPublicDocument, JSON_FEED_VERSION, JSON_SCHEMA_VERSION, jsonFeed, lastModifiedOf, latestModified, LISTING_REPRESENTATIONS, matchesEtag, MEDIA_TYPES, mountPublicSite, notAcceptableResponse, offsetForPage, PACKAGED_THEME_DIR, PAGE_SEGMENT, paginate, parseAccept, postsPerPage, prefersActivityStreams, publicDocumentAt, REPRESENTATION_EXTENSIONS, representationEtag, representationHref, representationResponse, selectRepresentation, SITE_DATA_FILE, splitRepresentationExtension, TAG_SEGMENT, tagHref, TEMPLATES, themeAssetNotModified, themeAssetResponse, THEME_ASSET_MAX_AGE, THEME_ASSET_PREFIX, THEME_STATIC_DIR, themeSearchPath, UPLOAD_ASSET_MAX_AGE, UPLOAD_ASSET_PREFIX, UPLOAD_DIRECTORY, } from './web/index.ts';
19
+ export type { AcceptRange, AssetResponseOptions, ConditionalHeaders, CreateRendererOptions, CreateSiteDataSourceOptions, CreateTemplateEnvironmentOptions, DateFormat, DocumentContext, DocumentJson, DocumentJsonOptions, FeedFormat, FeedResponseOptions, FeedSource, JsonFeed, JsonFeedAuthor, JsonFeedItem, Listing, PageContext, PaginateOptions, Pagination, Renderer, Representation, RepresentationExtension, RepresentationResponseOptions, SiteData, SiteDataSource, SiteSettingsSource, StaticAsset, ThemeAsset, } from './web/index.ts';
20
+ /** A running (or runnable) CMS instance. */
21
+ export interface Cms {
22
+ /**
23
+ * The Hono app. Sites may add their own routes before calling
24
+ * {@link Cms.serve}; handlers reach the index as `c.var.store`.
25
+ */
26
+ readonly app: Hono<GeekityEnv>;
27
+ /** Config after defaults and environment overrides were applied. */
28
+ readonly config: ResolvedConfig;
29
+ /** The content index, opened against {@link ResolvedConfig.dataDir} on boot. */
30
+ readonly store: ContentStore;
31
+ /**
32
+ * Users and sessions, in the same database file as the index. This is the
33
+ * half of it that is not derived from the content directory, so it is the
34
+ * half a site has to back up.
35
+ */
36
+ readonly admin: AdminStore;
37
+ /**
38
+ * The site's ActivityPub actor, already mounted on {@link Cms.app}: the
39
+ * actor document, WebFinger, NodeInfo, the inbox and the collections.
40
+ *
41
+ * It is exposed so a site — or a later milestone — may register more
42
+ * dispatchers and listeners on it, and so `ctx.sendActivity` has something
43
+ * to be called through when a post is published.
44
+ */
45
+ readonly federation: SiteFederation;
46
+ /**
47
+ * Outbound ActivityPub delivery: what sends a post to the followers when it
48
+ * is published, edited or withdrawn, and what an admin screen calls to send
49
+ * a recorded activity again.
50
+ *
51
+ * It is already subscribed to the index; a site only reaches for it to
52
+ * redeliver, or to wait for the deliveries in flight.
53
+ */
54
+ readonly delivery: DeliveryService;
55
+ /**
56
+ * Index changes, as they happen: `created`, `updated`, `deleted`,
57
+ * `published`, `unpublished` and the catch-all `change`. Every listener is
58
+ * handed the document before and after the change.
59
+ */
60
+ readonly events: ContentEvents;
61
+ /**
62
+ * Run a hook for every `created`, `updated` and `deleted`. The same thing
63
+ * the `onDocumentChange` config option does, for a site that would rather
64
+ * subscribe from its entry file. Returns the function that unsubscribes.
65
+ *
66
+ * The boot scan reports a cold index as a directory full of creations, so a
67
+ * hook that must not re-fire on a rebuilt index should check
68
+ * `change.origin !== 'scan'`.
69
+ */
70
+ onDocumentChange(hook: DocumentChangeHook): () => void;
71
+ /**
72
+ * Run a hook whenever a document becomes visible on the public site: created
73
+ * live, a draft published, or a document restored from the trash. Subject to
74
+ * the same `origin` caveat as {@link Cms.onDocumentChange}. Returns the
75
+ * function that unsubscribes.
76
+ */
77
+ onPublish(hook: DocumentChangeHook): () => void;
78
+ /**
79
+ * Walk the content directory once and bring the index into line with it.
80
+ * What `serve()` does on boot, and what the `geekity sync` command runs.
81
+ */
82
+ sync(): Promise<SyncResult>;
83
+ /**
84
+ * Scan the content directory, start watching it unless
85
+ * {@link ResolvedConfig.watch} is off, and start listening. Resolves with
86
+ * the address actually bound, which matters when the port is 0.
87
+ */
88
+ serve(): Promise<{
89
+ port: number;
90
+ }>;
91
+ /**
92
+ * Stop watching, stop listening and close the index. Safe to call when not
93
+ * listening, and safe to call twice.
94
+ */
95
+ close(): Promise<void>;
96
+ }
97
+ /**
98
+ * Build a CMS around a site's config.
99
+ *
100
+ * The returned app is a plain Hono app: the public site, the admin UI and the
101
+ * federation endpoints are all mounted on it as later milestones land. Booting
102
+ * opens the SQLite index under `dataDir` (creating the directory) and applies
103
+ * any migrations, so `close()` has to be called to release it.
104
+ */
105
+ export declare function createCms(config?: GeekityConfig): Cms;
106
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAU5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,KAAK,EAAE,aAAa,EAAmB,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG7E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,8BAA8B,EAC9B,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,UA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E,cAAc,CAAC;IAChC,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAAC;IACvD;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAAC;IAChD;;;OAGG;IACH,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnC;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,aAAkB,GAAG,GAAG,CA+IzD"}
package/dist/index.js ADDED
@@ -0,0 +1,148 @@
1
+ import { serve as serveNode } from '@hono/node-server';
2
+ import { Hono } from 'hono';
3
+ import { effectiveBaseUrl, mountAdmin, openAdminStore, readSiteSettings, seedSiteSettings, settingsSiteData, } from './admin/index.js';
4
+ import { resolveConfig } from './config.js';
5
+ import { createContentSync, openContentStore } from './content/index.js';
6
+ import { createDeliveryService, createSiteFederation, mountFederation, } from './federation/index.js';
7
+ import { createRenderer, mountPublicSite } from './web/index.js';
8
+ export { ACTOR_HANDLE_PATTERN, ACTOR_KEY_ALGORITHMS, ACTOR_TYPES, DELIVERY_STATUSES, ADMIN_ASSET_MAX_AGE, ADMIN_ASSET_PREFIX, ADMIN_PREFIX, ADMIN_SECTIONS, ADMIN_STATIC_DIR, ADMIN_TEMPLATES, actorSummary, addUserProblems, adminAssetResponse, ARGON2_PARAMETERS, AVATAR_FIELDS, AVATAR_PATH, AVATAR_REMOVE, blankForm, CHANGE_PASSWORD_PATH, changePasswordProblems, clearSessionCookie, createAdminTemplateEnvironment, credentialProblem, CSRF_FIELD, csrfTokenMatches, DASHBOARD_RECENT_POSTS, DEFAULT_SITE_SETTINGS, DELETE_USER_PATH, deleteUserRefusal, deliveryRows, DOCUMENT_FILTERS, documentFilter, DOCUMENTS_PER_PAGE, editorPath, effectiveBaseUrl, EXCLUDE_KEY, DuplicateUsernameError, FEDERATION_FIELDS, FEDERATION_PATH, FEDERATION_RECENT, findAdminAsset, findBySlug, followerRow, formFor, formFromSettings, flash, GENERATED_PASSWORD_ALPHABET, GENERATED_PASSWORD_LENGTH, generatePassword, guard, hashPassword, INBOX_INTERACTIONS, inboxRows, LOGIN_PATH, LOGOUT_PATH, listingUrl, listOptionsFor, localPosts, MAXIMUM_USERNAME_LENGTH, MINIMUM_PASSWORD_LENGTH, mountAdmin, mountDocumentScreens, mountFederationScreen, mountPreview, mountSettings, mountUploads, mountUsers, newEditorPath, openAdminStore, PAGE_KIND, PACKAGED_ADMIN_DIR, passwordProblem, postEditorPath, POST_KIND, PREVIEW_PATH, profileChanged, QUICK_DRAFT_PATH, readSiteSettings, REDELIVER_PATH, redeliveryMessage, refusedUpload, refuseOversizedUpload, returnPath, seedSiteSettings, SESSION_COOKIE, SESSION_ID_BYTES, sessionIdFrom, setSessionCookie, SETTINGS_FIELDS, SETTINGS_PATH, settingsFromForm, settingsProblems, settingsSiteData, SETUP_PATH, siteDataPath, siteJsonFor, splitTags, storeUpload, takeFlash, tooLargeMessage, UPLOAD_ENVELOPE_BYTES, UPLOAD_FIELD, UPLOADS_PATH, USER_FIELDS, USERNAME_PATTERN, usernameProblem, USERS_PATH, usesSecureCookies, verifyPasswordHash, writeSiteJson, writeSiteSettings, } from './admin/index.js';
9
+ export { DEFAULT_UPLOAD_MAX_BYTES, DEFAULT_UPLOAD_TYPES, defineConfig, resolveConfig, } from './config.js';
10
+ export { DirectoryNotEmptyError, initSite, SITE_TEMPLATE_DIR, siteManifest } from './init.js';
11
+ export { contentFilePath, createContentSync, DATABASE_FILE, dateSortKey, DEFAULT_DEBOUNCE_MS, defaultPermalink, documentContent, documentFrontMatter, freeSlug, DuplicatePermalinkError, hashDocument, isTrashedPath, KNOWN_FRONT_MATTER_KEYS, KNOWN_UPLOAD_TYPES, matchesSignature, normalizeBody, normalizeUploadType, openContentStore, parseDocument, renderMarkdown, saveDocument, serializeDocument, slugify, TRASH_DIRECTORY, typeForPath, UPLOAD_MEDIA_TYPES, } from './content/index.js';
12
+ export { ACTOR_CLASSES, ACTOR_PATH, actorClassFor, articleObjectId, avatarUrl, createActivityId, createDeliveryService, createSiteFederation, deleteActivityId, federatedObject, federatedPost, FEDERATION_PREFIX, federationOrigin, followerFrom, followerRecipient, FOLLOWERS_PAGE_SIZE, FOLLOWERS_PATH, followersPage, FOLLOWING_PATH, groupByInbox, handleDelete, handleFollow, handleLoggedActivity, handleUndo, INBOX_PATH, isFederatedDocument, lastFollowersCursor, loadActorKeyPairs, logActivity, mountFederation, NODEINFO_PATH, OUTBOX_PAGE_SIZE, OUTBOX_PATH, POST_OBJECT_PATH, postArticle, postCreateActivity, postDeleteActivity, postObjectId, postObjectPath, postUpdateActivity, SHARED_INBOX_PATH, SITE_ACTOR_IDENTIFIER, siteActor, SOFTWARE_NAME, SOURCE_MEDIA_TYPE, toInstant, updateActivityId, } from './federation/index.js';
13
+ export { absoluteUrl, ACTIVITY_STREAMS_MEDIA_TYPES, activityStreamsId, alternateLinks, assetNotModified, assetResponse, atomFeed, contentEtag, createRenderer, createSiteDataSource, createTemplateEnvironment, DEFAULT_FEED_SIZE, DEFAULT_POSTS_PER_PAGE, DOCUMENT_REPRESENTATIONS, documentContext, documentJson, escapeXml, FEED_CONTENT_TYPES, FEED_FILES, FEED_GENERATOR, FEED_GENERATOR_URI, feedHref, feedResponse, feedSize, findAsset, findThemeAsset, findUpload, formatDate, homeHref, isNotModified, isPublicDocument, JSON_FEED_VERSION, JSON_SCHEMA_VERSION, jsonFeed, lastModifiedOf, latestModified, LISTING_REPRESENTATIONS, matchesEtag, MEDIA_TYPES, mountPublicSite, notAcceptableResponse, offsetForPage, PACKAGED_THEME_DIR, PAGE_SEGMENT, paginate, parseAccept, postsPerPage, prefersActivityStreams, publicDocumentAt, REPRESENTATION_EXTENSIONS, representationEtag, representationHref, representationResponse, selectRepresentation, SITE_DATA_FILE, splitRepresentationExtension, TAG_SEGMENT, tagHref, TEMPLATES, themeAssetNotModified, themeAssetResponse, THEME_ASSET_MAX_AGE, THEME_ASSET_PREFIX, THEME_STATIC_DIR, themeSearchPath, UPLOAD_ASSET_MAX_AGE, UPLOAD_ASSET_PREFIX, UPLOAD_DIRECTORY, } from './web/index.js';
14
+ /**
15
+ * Build a CMS around a site's config.
16
+ *
17
+ * The returned app is a plain Hono app: the public site, the admin UI and the
18
+ * federation endpoints are all mounted on it as later milestones land. Booting
19
+ * opens the SQLite index under `dataDir` (creating the directory) and applies
20
+ * any migrations, so `close()` has to be called to release it.
21
+ */
22
+ export function createCms(config = {}) {
23
+ const resolved = resolveConfig(config);
24
+ const store = openContentStore({ dataDir: resolved.dataDir });
25
+ const admin = openAdminStore({ dataDir: resolved.dataDir });
26
+ // An empty settings table is filled from content/_data/site.json, so a site
27
+ // that predates the settings screen — or one `geekity init` just wrote —
28
+ // comes up with the values it already had. After this, SQLite is the source
29
+ // and the file is the mirror.
30
+ const seeded = seedSiteSettings({ store: admin, config: resolved });
31
+ // The one thing the settings decide before a request arrives. It is settled
32
+ // here, at boot, rather than on every save: `baseUrl` also decides whether
33
+ // the session cookie is `Secure`, and flipping that under a signed-in admin
34
+ // would log them out of the form they just submitted.
35
+ resolved.baseUrl = effectiveBaseUrl(resolved, seeded);
36
+ const content = createContentSync({
37
+ store,
38
+ contentDir: resolved.contentDir,
39
+ watch: resolved.watch,
40
+ });
41
+ const renderer = createRenderer({
42
+ config: resolved,
43
+ settings: { read: () => settingsSiteData(readSiteSettings(admin)) },
44
+ });
45
+ const federation = createSiteFederation({ baseUrl: resolved.baseUrl, ...resolved.federation });
46
+ // Federation listens to the index rather than to the admin, so a post edited
47
+ // on disk federates exactly as one saved through the editor does (doc-4).
48
+ // It is built before the app because a handler reads it off the context: the
49
+ // admin's Redeliver button is a request that sends an activity again.
50
+ const delivery = createDeliveryService({ federation, admin, store, config: resolved });
51
+ content.events.on('change', (change) => delivery.handle(change));
52
+ const app = new Hono();
53
+ app.use('*', async (c, next) => {
54
+ c.set('store', store);
55
+ c.set('admin', admin);
56
+ c.set('config', resolved);
57
+ c.set('renderer', renderer);
58
+ c.set('announce', (change) => content.announce(change));
59
+ c.set('delivery', delivery);
60
+ await next();
61
+ });
62
+ app.get('/_geekity/health', (c) => c.json({ status: 'ok' }));
63
+ // Federation goes on first. It answers its own paths and falls through on
64
+ // every other, so putting it in front costs the rest of the app nothing and
65
+ // is the only place it can go: the public site claims every unmatched path
66
+ // in its not-found handler.
67
+ mountFederation(app, federation);
68
+ // The admin goes on before the public site, for the same reason.
69
+ mountAdmin(app);
70
+ mountPublicSite(app);
71
+ /**
72
+ * Subscribe a site's hook to one event.
73
+ *
74
+ * The emitter already contains a hook that throws; this also contains one
75
+ * that rejects, so an `async` hook whose delivery fails is reported rather
76
+ * than surfacing as an unhandled rejection that would take the process down.
77
+ */
78
+ function subscribe(event, hook) {
79
+ return content.events.on(event, (change) => {
80
+ // A hook's return is ignored, but an `async` one hands back a promise
81
+ // whose unhandled rejection would take the whole process down.
82
+ const result = hook(change);
83
+ if (result instanceof Promise) {
84
+ result.catch((error) => {
85
+ const message = error instanceof Error ? error.message : String(error);
86
+ console.warn(`A ${event} hook rejected: ${message}`);
87
+ });
88
+ }
89
+ });
90
+ }
91
+ if (resolved.onDocumentChange !== undefined)
92
+ subscribe('change', resolved.onDocumentChange);
93
+ if (resolved.onPublish !== undefined)
94
+ subscribe('published', resolved.onPublish);
95
+ let server;
96
+ return {
97
+ app,
98
+ config: resolved,
99
+ store,
100
+ admin,
101
+ federation,
102
+ delivery,
103
+ events: content.events,
104
+ onDocumentChange(hook) {
105
+ return subscribe('change', hook);
106
+ },
107
+ onPublish(hook) {
108
+ return subscribe('published', hook);
109
+ },
110
+ sync() {
111
+ return content.sync();
112
+ },
113
+ async serve() {
114
+ if (server !== undefined) {
115
+ throw new Error('This CMS is already serving; call close() before serving again.');
116
+ }
117
+ // The index is brought up to date before the first request, so a site
118
+ // never serves a stale document, and the watcher takes over from there.
119
+ await content.start();
120
+ return new Promise((resolve) => {
121
+ server = serveNode({ fetch: app.fetch, port: resolved.port }, (info) => {
122
+ resolve({ port: info.port });
123
+ });
124
+ });
125
+ },
126
+ async close() {
127
+ const running = server;
128
+ server = undefined;
129
+ await content.stop();
130
+ // Anything already on its way out is allowed to finish, so closing never
131
+ // leaves a delivery half recorded.
132
+ await delivery.settled();
133
+ if (running !== undefined) {
134
+ await new Promise((resolve, reject) => {
135
+ running.close((err) => {
136
+ if (err)
137
+ reject(err);
138
+ else
139
+ resolve();
140
+ });
141
+ });
142
+ }
143
+ admin.close();
144
+ store.close();
145
+ },
146
+ };
147
+ }
148
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CA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AwE;YACxE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YAEtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC7B,MAAM,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;oBACrE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC/B,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,KAAK;YACT,MAAM,OAAO,GAAG,MAAM,CAAC;YACvB,MAAM,GAAG,SAAS,CAAC;YACnB,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;YACrB,yEAAyE;YACzE,mCAAmC;YACnC,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAEzB,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC1C,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;wBACpB,IAAI,GAAG;4BAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;4BAChB,OAAO,EAAE,CAAC;oBACjB,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;YAED,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The scaffolding `geekity init` copies, resolved from this module rather than
3
+ * from the working directory so it is found whether the CLI is running from
4
+ * `src/` under tsx or from `dist/` inside `node_modules`.
5
+ */
6
+ export declare const SITE_TEMPLATE_DIR: string;
7
+ /** What {@link initSite} was asked to do. */
8
+ export interface InitSiteOptions {
9
+ /** Directory to create, absolute or relative to {@link InitSiteOptions.cwd}. */
10
+ directory: string;
11
+ /** Directory relative paths resolve against. Defaults to `process.cwd()`. */
12
+ cwd?: string;
13
+ /**
14
+ * Version of `@geekity/cms` the generated `package.json` depends on. Defaults
15
+ * to the version of the package this module was loaded from, so a site is
16
+ * pinned to the CLI that scaffolded it.
17
+ */
18
+ version?: string;
19
+ /** Package name for the generated manifest. Defaults to the directory's name. */
20
+ name?: string;
21
+ }
22
+ /** Where a site was created and what it holds. */
23
+ export interface InitSiteResult {
24
+ /** Absolute path of the new site. */
25
+ directory: string;
26
+ /** Files written, site-relative and sorted, for the command to print. */
27
+ files: readonly string[];
28
+ }
29
+ /** Thrown when the target directory already holds something. */
30
+ export declare class DirectoryNotEmptyError extends Error {
31
+ readonly directory: string;
32
+ readonly name = "DirectoryNotEmptyError";
33
+ constructor(directory: string);
34
+ }
35
+ /**
36
+ * Create a new site.
37
+ *
38
+ * The template is copied as it is; only `package.json` and
39
+ * `pnpm-workspace.yaml` are generated, because a nested manifest or workspace
40
+ * file inside `templates/` would be picked up by the workspace and by every
41
+ * tool that walks for one.
42
+ */
43
+ export declare function initSite(options: InitSiteOptions): Promise<InitSiteResult>;
44
+ /**
45
+ * pnpm settings a new site starts with, as `pnpm-workspace.yaml`.
46
+ *
47
+ * pnpm reads its settings from this file even for a single package, and from
48
+ * version 11 reads nothing else: the `pnpm` field in `package.json` is
49
+ * ignored. Two things are settled here so a fresh install runs quietly and
50
+ * unattended. Other package managers ignore the file.
51
+ */
52
+ export declare function pnpmSettings(): string;
53
+ /**
54
+ * The manifest a new site starts life with.
55
+ *
56
+ * The three devDependencies are the TypeScript toolchain the template needs:
57
+ * `tsx` runs `server.ts` and loads a TypeScript config for the bin, and
58
+ * `typescript` plus `@types/node` are what type checking the site takes. Their
59
+ * ranges are this package's own, so a site starts on the versions the CMS was
60
+ * built and tested against rather than on a range frozen in the source.
61
+ */
62
+ export declare function siteManifest(options: {
63
+ name: string;
64
+ version: string;
65
+ }): Record<string, unknown>;
66
+ /** This package's own manifest, read from beside the module that is running. */
67
+ export declare function ownManifest(): {
68
+ version: string;
69
+ devDependencies?: Record<string, string>;
70
+ };
71
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAE/B,CAAC;AASF,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,gEAAgE;AAChE,qBAAa,sBAAuB,SAAQ,KAAK;IAGnC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAFtC,SAAkB,IAAI,4BAA4B;IAElD,YAAqB,SAAS,EAAE,MAAM,EAIrC;CACF;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAyBhF;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAgBrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBhG;AAaD,gFAAgF;AAChF,wBAAgB,WAAW,IAAI;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAMA"}