@jant/core 1.1.0 → 1.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 (196) hide show
  1. package/bin/commands/site/import.js +2 -1
  2. package/bin/lib/site-snapshot.js +10 -0
  3. package/dist/{app-CKQ9PqAr.js → app-C8dETvgL.js} +9267 -5697
  4. package/dist/client/.vite/manifest.json +82 -93
  5. package/dist/client/_assets/chunks/{confirm-CMe01lne.js → confirm-BQebcuNB.js} +1 -1
  6. package/dist/client/_assets/chunks/{create-editor-BQkrw8Ax.js → create-editor-B8KuszlS.js} +38 -38
  7. package/dist/client/_assets/chunks/footnote-rail-DUrqz0Py.js +2 -0
  8. package/dist/client/_assets/chunks/{jant-locale-picker-2L4rkDaz.js → jant-locale-picker-CLq0iKDH.js} +1 -1
  9. package/dist/client/_assets/chunks/lit-BN4mrI3j.js +2 -0
  10. package/dist/client/_assets/chunks/{settings-paths-B0bNUaih.js → settings-paths-_fry4yWW.js} +1 -1
  11. package/dist/client/_assets/chunks/{slug-format-CYmQE5ln.js → slug-format-bcJ2ozr4.js} +1 -1
  12. package/dist/client/_assets/chunks/sortable-list-Bz2Na2E9.js +2 -0
  13. package/dist/client/_assets/chunks/types-DrYFqJH2.js +1 -0
  14. package/dist/client/_assets/chunks/{unsafe-html-CWos3v6N.js → unsafe-html-OJ9m154w.js} +1 -1
  15. package/dist/client/_assets/chunks/unsafe-svg-DVJ4NPcb.js +1 -0
  16. package/dist/client/_assets/client-CoNHvipV.css +2 -0
  17. package/dist/client/_assets/{client-auth-CG55rWb5.js → client-auth-CbnZkLJ6.js} +99 -129
  18. package/dist/client/_assets/{client-author-CGVvrNZ8.css → client-author-2WYBkgni.css} +1 -1
  19. package/dist/client/_assets/client-compose-DYtDlYm-.js +2008 -0
  20. package/dist/client/_assets/{client-manage-DnYdQAhf.js → client-manage-BODyYP5Z.js} +157 -157
  21. package/dist/client/_assets/client-pq6sVS7y.js +354 -0
  22. package/dist/client/_assets/{client-settings-CHgsIqXJ.js → client-settings-DDpe_tXJ.js} +166 -166
  23. package/dist/client/_assets/client-share-B9OsXx9p.js +149 -0
  24. package/dist/{constants-DEgyqWDl.js → constants-C2CdWAqt.js} +55 -5
  25. package/dist/index.js +1 -1
  26. package/dist/node.js +3 -2
  27. package/package.json +2 -1
  28. package/src/app.tsx +9 -0
  29. package/src/client/components/compose-types.ts +6 -1
  30. package/src/client/components/jant-compose-dialog.ts +26 -4
  31. package/src/client/components/jant-compose-editor.ts +30 -0
  32. package/src/client/components/jant-compose-fullscreen.ts +1 -0
  33. package/src/client/components/jant-media-lightbox.ts +18 -3
  34. package/src/client/components/jant-nav-manager.ts +2 -0
  35. package/src/client/components/jant-post-menu.ts +42 -89
  36. package/src/client/components/nav-manager-types.ts +2 -0
  37. package/src/client/components/settings-types.ts +1 -1
  38. package/src/client/compose-bridge.ts +61 -1
  39. package/src/client/feed-video-player.ts +6 -0
  40. package/src/client/list-views.ts +382 -0
  41. package/src/client/media-lightbox-events.ts +12 -0
  42. package/src/client/runtime-paths.ts +12 -0
  43. package/src/client/share-capture.ts +63 -0
  44. package/src/client/share-launch.ts +36 -9
  45. package/src/client/tiptap/bubble-menu.ts +25 -2
  46. package/src/client/tiptap/create-editor.ts +6 -0
  47. package/src/client/tiptap/embed-node.ts +3 -1
  48. package/src/client/tiptap/extensions.ts +4 -0
  49. package/src/client/tiptap/html-block-node.ts +3 -1
  50. package/src/client/tiptap/image-node.ts +3 -1
  51. package/src/client/video-processor.ts +106 -52
  52. package/src/client/view-confirm.ts +136 -0
  53. package/src/client.ts +2 -0
  54. package/src/db/migrations/0035_brainy_next_avengers.sql +9 -0
  55. package/src/db/migrations/0036_gorgeous_smasher.sql +7 -0
  56. package/src/db/migrations/0037_round_post.sql +16 -0
  57. package/src/db/migrations/0038_flashy_changeling.sql +15 -0
  58. package/src/db/migrations/0039_mixed_sister_grimm.sql +1 -0
  59. package/src/db/migrations/meta/0035_snapshot.json +2877 -0
  60. package/src/db/migrations/meta/0036_snapshot.json +2924 -0
  61. package/src/db/migrations/meta/0037_snapshot.json +2932 -0
  62. package/src/db/migrations/meta/0038_snapshot.json +2924 -0
  63. package/src/db/migrations/meta/0039_snapshot.json +2931 -0
  64. package/src/db/migrations/meta/_journal.json +35 -0
  65. package/src/db/migrations/pg/0033_cute_magdalene.sql +10 -0
  66. package/src/db/migrations/pg/0034_material_agent_brand.sql +8 -0
  67. package/src/db/migrations/pg/0035_flimsy_outlaw_kid.sql +3 -0
  68. package/src/db/migrations/pg/0036_milky_wolverine.sql +5 -0
  69. package/src/db/migrations/pg/0037_fuzzy_hammerhead.sql +1 -0
  70. package/src/db/migrations/pg/meta/0033_snapshot.json +3719 -0
  71. package/src/db/migrations/pg/meta/0034_snapshot.json +3766 -0
  72. package/src/db/migrations/pg/meta/0035_snapshot.json +3773 -0
  73. package/src/db/migrations/pg/meta/0036_snapshot.json +3766 -0
  74. package/src/db/migrations/pg/meta/0037_snapshot.json +3772 -0
  75. package/src/db/migrations/pg/meta/_journal.json +35 -0
  76. package/src/db/pg/schema.ts +41 -0
  77. package/src/db/post-visibility.ts +37 -6
  78. package/src/db/schema.ts +64 -0
  79. package/src/i18n/locales/glossary.zh-Hans.yml +4 -0
  80. package/src/i18n/locales/glossary.zh-Hant.yml +4 -0
  81. package/src/i18n/locales/public/en.po +26 -7
  82. package/src/i18n/locales/public/en.ts +1 -1
  83. package/src/i18n/locales/public/zh-Hans.po +25 -6
  84. package/src/i18n/locales/public/zh-Hans.ts +1 -1
  85. package/src/i18n/locales/public/zh-Hant.po +25 -6
  86. package/src/i18n/locales/public/zh-Hant.ts +1 -1
  87. package/src/i18n/locales/settings/en.po +159 -0
  88. package/src/i18n/locales/settings/en.ts +1 -1
  89. package/src/i18n/locales/settings/zh-Hans.po +159 -0
  90. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  91. package/src/i18n/locales/settings/zh-Hant.po +159 -0
  92. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  93. package/src/lib/api-public-posts.ts +10 -0
  94. package/src/lib/env.ts +20 -0
  95. package/src/lib/feed-policy.ts +2 -2
  96. package/src/lib/filter-dimensions.ts +11 -4
  97. package/src/lib/github-app-state.ts +1 -1
  98. package/src/lib/github-app.ts +183 -1
  99. package/src/lib/hugo-markdown.ts +7 -0
  100. package/src/lib/icons.ts +2 -0
  101. package/src/lib/link-preview.ts +499 -0
  102. package/src/lib/list-views.ts +117 -0
  103. package/src/lib/markdown-manager.ts +169 -2
  104. package/src/lib/navigation.ts +1 -1
  105. package/src/lib/post-meta.ts +13 -3
  106. package/src/lib/referrer-aliases.ts +311 -0
  107. package/src/lib/render.tsx +10 -0
  108. package/src/lib/resolve-config.ts +14 -0
  109. package/src/lib/share-card.ts +4 -3
  110. package/src/lib/summary.ts +152 -54
  111. package/src/lib/thread-query.ts +6 -2
  112. package/src/lib/timeline.ts +12 -11
  113. package/src/lib/tiptap-render.ts +1 -0
  114. package/src/lib/upload.ts +21 -1
  115. package/src/lib/url-fetch.ts +291 -74
  116. package/src/lib/video-playback.ts +55 -0
  117. package/src/lib/view-buffer.ts +201 -0
  118. package/src/lib/view-counting.ts +540 -0
  119. package/src/lib/view-token.ts +199 -0
  120. package/src/lib/view.ts +30 -1
  121. package/src/middleware/view-counter.ts +145 -0
  122. package/src/node/runtime.ts +4 -0
  123. package/src/preset.css +36 -17
  124. package/src/routes/api/media.ts +21 -3
  125. package/src/routes/api/search.ts +1 -1
  126. package/src/routes/dash/settings.tsx +434 -169
  127. package/src/routes/feed/sitemap.ts +1 -1
  128. package/src/routes/pages/archive.tsx +26 -19
  129. package/src/routes/pages/collection.tsx +9 -3
  130. package/src/routes/pages/collections.tsx +1 -0
  131. package/src/routes/pages/featured.tsx +1 -0
  132. package/src/routes/pages/home.tsx +1 -0
  133. package/src/routes/pages/page.tsx +18 -3
  134. package/src/routes/pages/search.tsx +3 -3
  135. package/src/routes/pages/smart-collection.tsx +2 -0
  136. package/src/routes/pages/subscribe.tsx +1 -0
  137. package/src/routes/view-confirm.ts +71 -0
  138. package/src/services/collection.ts +1 -1
  139. package/src/services/export-theme/assets/client-site.js +19 -19
  140. package/src/services/export-theme/layouts/archive/list.html +4 -2
  141. package/src/services/export-theme/layouts/partials/collection-members.html +4 -3
  142. package/src/services/export-theme/layouts/partials/featured-members.html +3 -3
  143. package/src/services/export-theme/layouts/partials/head.html +2 -0
  144. package/src/services/export-theme/layouts/partials/latest-members.html +4 -4
  145. package/src/services/export-theme/layouts/partials/post-card.html +1 -9
  146. package/src/services/export-theme/layouts/partials/reply.html +1 -9
  147. package/src/services/export-theme/layouts/partials/smart-collection-members.html +4 -3
  148. package/src/services/export-theme/layouts/post/list.html +1 -9
  149. package/src/services/export-theme/styles/main.css +41 -47
  150. package/src/services/export.ts +12 -3
  151. package/src/services/index.ts +17 -0
  152. package/src/services/mcp.ts +36 -6
  153. package/src/services/media.ts +63 -0
  154. package/src/services/navigation.ts +9 -4
  155. package/src/services/post.ts +102 -112
  156. package/src/services/search.ts +22 -7
  157. package/src/services/smart-collection.ts +3 -3
  158. package/src/services/stats.ts +1137 -0
  159. package/src/services/thread.ts +6 -2
  160. package/src/styles/components-author.css +242 -3
  161. package/src/styles/components.css +11 -3
  162. package/src/styles/tokens.css +89 -55
  163. package/src/styles/ui-author.css +140 -353
  164. package/src/styles/ui.css +90 -45
  165. package/src/types/app-context.ts +9 -0
  166. package/src/types/bindings.ts +5 -0
  167. package/src/types/config.ts +54 -0
  168. package/src/types/constants.ts +68 -4
  169. package/src/types/entities.ts +1 -0
  170. package/src/types/views.ts +8 -0
  171. package/src/ui/compose/ComposeDialog.tsx +26 -1
  172. package/src/ui/dash/StatusBadge.tsx +11 -0
  173. package/src/ui/dash/appearance/FontThemeContent.tsx +1 -1
  174. package/src/ui/dash/appearance/NavigationContent.tsx +8 -0
  175. package/src/ui/dash/settings/SettingsRootContent.tsx +24 -6
  176. package/src/ui/dash/settings/StatsContent.tsx +855 -0
  177. package/src/ui/feed/LinkCard.tsx +19 -2
  178. package/src/ui/feed/PostStatusBadges.tsx +19 -3
  179. package/src/ui/feed/TimelineFeed.tsx +3 -0
  180. package/src/ui/font-themes.ts +56 -6
  181. package/src/ui/layouts/BaseLayout.tsx +4 -2
  182. package/src/ui/layouts/SiteLayout.tsx +8 -3
  183. package/src/ui/pages/ArchivePage.tsx +1 -0
  184. package/src/ui/shared/MediaGallery.tsx +19 -3
  185. package/src/ui/shared/PostFooter.tsx +1 -22
  186. package/src/ui/shared/custom-icons.ts +5 -5
  187. package/dist/client/_assets/chunks/footnote-rail-B08scyhW.js +0 -2
  188. package/dist/client/_assets/chunks/lit-Bw_voPoW.js +0 -2
  189. package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +0 -1
  190. package/dist/client/_assets/chunks/sortable-list-t11Ma1Ek.js +0 -2
  191. package/dist/client/_assets/chunks/types-D5iF3H1a.js +0 -1
  192. package/dist/client/_assets/chunks/unsafe-svg-DZl-yjas.js +0 -1
  193. package/dist/client/_assets/client-B0-s9sqx.css +0 -2
  194. package/dist/client/_assets/client-Dp46QSht.js +0 -354
  195. package/dist/client/_assets/client-compose-DkUTuavR.js +0 -2004
  196. package/dist/client/_assets/client-share-C59mOLJ1.js +0 -149
@@ -512,9 +512,54 @@ var STATUSES = ["draft", "published"];
512
512
  var VISIBILITIES = [
513
513
  "public",
514
514
  "latest_hidden",
515
+ "unlisted",
515
516
  "private"
516
517
  ];
517
518
  /**
519
+ * Visibilities a signed-out reader can open at the post's address.
520
+ *
521
+ * Wider than {@link READER_LISTED_VISIBILITIES}: an Unlisted post opens for
522
+ * anyone who has its link, but no list a reader sees includes it.
523
+ */ var READER_OPENABLE_VISIBILITIES = [
524
+ "public",
525
+ "latest_hidden",
526
+ "unlisted"
527
+ ];
528
+ /**
529
+ * Visibilities a signed-out reader may find in a list: an archive, a search,
530
+ * a Collection, a feed, a sitemap, an API listing. Latest narrows this further
531
+ * by leaving out `latest_hidden`.
532
+ */ var READER_LISTED_VISIBILITIES = ["public", "latest_hidden"];
533
+ /**
534
+ * Whether a signed-out reader can open a post with this visibility.
535
+ *
536
+ * @param visibility - The post's effective visibility (its Thread root's)
537
+ * @returns False only for `private`
538
+ *
539
+ * @example
540
+ * ```ts
541
+ * isOpenableByReader("unlisted"); // true
542
+ * isOpenableByReader("private"); // false
543
+ * ```
544
+ */ function isOpenableByReader(visibility) {
545
+ return READER_OPENABLE_VISIBILITIES.includes(visibility);
546
+ }
547
+ /**
548
+ * Whether a list a signed-out reader sees may include a post with this
549
+ * visibility.
550
+ *
551
+ * @param visibility - The post's effective visibility (its Thread root's)
552
+ * @returns False for `unlisted` and `private`
553
+ *
554
+ * @example
555
+ * ```ts
556
+ * isListedForReader("latest_hidden"); // true
557
+ * isListedForReader("unlisted"); // false
558
+ * ```
559
+ */ function isListedForReader(visibility) {
560
+ return READER_LISTED_VISIBILITIES.includes(visibility);
561
+ }
562
+ /**
518
563
  * Layouts the archive page can render in. `list` renders the same timeline the
519
564
  * rest of the nav trio uses; `grid` renders the tile catalogue.
520
565
  *
@@ -529,15 +574,20 @@ var VISIBILITIES = [
529
574
  * visibility, and it lives here because the filter bar presents the two as one
530
575
  * dimension.
531
576
  *
532
- * `private` is deliberately absent. It names a set only the author can see, so
533
- * a reader who asks for it has to be told so — handing back a different set
534
- * under the same name is the one answer that is never right.
577
+ * `unlisted` and `private` are deliberately absent. Each names a set only the
578
+ * author can list, so a reader who asks for it has to be told so — handing
579
+ * back a different set under the same name is the one answer that is never
580
+ * right.
535
581
  */ var PUBLIC_ARCHIVE_VISIBILITIES = [
536
582
  "public",
537
583
  "featured",
538
584
  "latest_hidden"
539
585
  ];
540
- /** Every visibility the author can select, in filter-bar order. */ var ARCHIVE_VISIBILITIES = [...PUBLIC_ARCHIVE_VISIBILITIES, "private"];
586
+ /** Every visibility the author can select, in filter-bar order. */ var ARCHIVE_VISIBILITIES = [
587
+ ...PUBLIC_ARCHIVE_VISIBILITIES,
588
+ "unlisted",
589
+ "private"
590
+ ];
541
591
  /**
542
592
  * The range a `year` filter may name, inclusive at both ends.
543
593
  *
@@ -764,4 +814,4 @@ var UPLOAD_SESSION_STATES = [
764
814
  /** How a stored object is served: rendered in place, or downloaded. */ var CONTENT_DISPOSITIONS = ["inline", "attachment"];
765
815
  var GITHUB_APP_ACCOUNT_TYPES = ["User", "Organization"];
766
816
  //#endregion
767
- export { toInternalPath as $, THREAD_SORTS as A, isFullUrl as B, SMART_COLLECTION_SORT_ORDERS as C, SYSTEM_NAV_KEYS as D, STORAGE_DRIVERS as E, extractDisplayDomain as F, normalizeSiteUrl as G, normalizePath as H, extractDomain as I, sanitizeRichTextHref as J, redirectTargetHref as K, getPostPath as L, VISIBILITIES as M, isFeedNavKey as N, SYSTEM_NAV_KEY_VALUES as O, buildSiteUrl as P, toAbsoluteSiteUrl as Q, getSiteOrigin as R, SITE_STATUSES as S, STATUSES as T, normalizeRedirectTarget as U, isSafeInternalRedirect as V, normalizeSitePathPrefix as W, stripSitePathPrefix as X, sanitizeUrl as Y, toAbsoluteAssetUrl as Z, NAV_ITEM_TYPES as _, COLLECTION_SORT_ORDERS as a, SITE_DOMAIN_KINDS as b, EARLIEST_FILTERABLE_YEAR as c, LATEST_FILTERABLE_YEAR as d, toPublicHref as et, MAX_COLLECTION_DESCRIPTION_LENGTH as f, NAV_ITEM_PLACEMENTS as g, MEDIA_KINDS as h, COLLECTION_FRESHNESS_WINDOW_SECONDS as i, UPLOAD_SESSION_STATES as j, TEXT_ATTACHMENT_CONTENT_FORMATS as k, FORMATS as l, MAX_SITE_FOOTER_LENGTH as m, ARCHIVE_VISIBILITIES as n, toSameSitePath as nt, CONTENT_DISPOSITIONS as o, MAX_SITE_DESCRIPTION_LENGTH as p, redirectTargetPath as q, COLLECTION_DIRECTORY_ENTRY_TYPES as r, withRequestQuery as rt, DEFAULT_NAVIGATION_PROFILE as s, ARCHIVE_LAYOUTS as t, toPublicPath as tt, GITHUB_APP_ACCOUNT_TYPES as u, PATH_KINDS as v, SORT_ORDERS as w, SITE_MEMBER_ROLES as x, PUBLIC_ARCHIVE_VISIBILITIES as y, getSitePathPrefix as z };
817
+ export { stripSitePathPrefix as $, TEXT_ATTACHMENT_CONTENT_FORMATS as A, getPostPath as B, SITE_STATUSES as C, STORAGE_DRIVERS as D, STATUSES as E, isListedForReader as F, normalizePath as G, getSitePathPrefix as H, isOpenableByReader as I, normalizeSiteUrl as J, normalizeRedirectTarget as K, buildSiteUrl as L, UPLOAD_SESSION_STATES as M, VISIBILITIES as N, SYSTEM_NAV_KEYS as O, isFeedNavKey as P, sanitizeUrl as Q, extractDisplayDomain as R, SITE_MEMBER_ROLES as S, SORT_ORDERS as T, isFullUrl as U, getSiteOrigin as V, isSafeInternalRedirect as W, redirectTargetPath as X, redirectTargetHref as Y, sanitizeRichTextHref as Z, NAV_ITEM_TYPES as _, COLLECTION_SORT_ORDERS as a, toSameSitePath as at, READER_LISTED_VISIBILITIES as b, EARLIEST_FILTERABLE_YEAR as c, LATEST_FILTERABLE_YEAR as d, toAbsoluteAssetUrl as et, MAX_COLLECTION_DESCRIPTION_LENGTH as f, NAV_ITEM_PLACEMENTS as g, MEDIA_KINDS as h, COLLECTION_FRESHNESS_WINDOW_SECONDS as i, toPublicPath as it, THREAD_SORTS as j, SYSTEM_NAV_KEY_VALUES as k, FORMATS as l, MAX_SITE_FOOTER_LENGTH as m, ARCHIVE_VISIBILITIES as n, toInternalPath as nt, CONTENT_DISPOSITIONS as o, withRequestQuery as ot, MAX_SITE_DESCRIPTION_LENGTH as p, normalizeSitePathPrefix as q, COLLECTION_DIRECTORY_ENTRY_TYPES as r, toPublicHref as rt, DEFAULT_NAVIGATION_PROFILE as s, ARCHIVE_LAYOUTS as t, toAbsoluteSiteUrl as tt, GITHUB_APP_ACCOUNT_TYPES as u, PATH_KINDS as v, SMART_COLLECTION_SORT_ORDERS as w, SITE_DOMAIN_KINDS as x, PUBLIC_ARCHIVE_VISIBILITIES as y, extractDomain as z };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as createApp$1 } from "./app-CKQ9PqAr.js";
1
+ import { n as createApp$1 } from "./app-C8dETvgL.js";
2
2
  //#region src/index.ts
3
3
  /**
4
4
  * Jant - A microblog system
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as getTelegramWebhookSecret, B as isAssetPath, C as getConfiguredSingleSitePathPrefix, D as getPort, E as getHostedControlPlaneBaseUrl, F as getFontThemeCssVariables, I as resolveCjkFontProfile, L as buildThemeStyle, M as now, N as BUILTIN_FONT_THEMES, O as getSiteResolutionMode, P as getCjkFontCssVariables, R as BUILTIN_COLOR_THEMES, S as getConfiguredSingleSiteOrigin, T as getEnvString, _ as resolveConfig, a as createNodeCliRuntime, b as setWebhook, c as createSiteService, d as createExportService, f as createStorageDriver, g as schema_exports, h as createNodeDatabase, i as listPendingMigrations, j as shouldTrustProxy, k as getTelegramBotPool, l as getHostBasedStartupConfigurationIssues, m as sqliteSchemaBundle, n as createApp, o as createNodeRequestRuntime, p as pgSchemaBundle, r as PendingMigrationsError, s as setUpNodeInstance, u as resolveDatabaseDialect, v as getWebhookUrl, w as getConfiguredStorageDriver, x as getEnvValueIssues, y as setMyCommands, z as getPublicAssetBasePath } from "./app-CKQ9PqAr.js";
1
+ import { A as getTelegramBotPool, B as getPublicAssetBasePath, C as getConfiguredSingleSiteOrigin, D as getHostedControlPlaneBaseUrl, E as getEnvString, F as getCjkFontCssVariables, I as getFontThemeCssVariables, L as resolveCjkFontProfile, M as shouldTrustProxy, N as now, O as getPort, P as BUILTIN_FONT_THEMES, R as buildThemeStyle, S as getEnvValueIssues, T as getConfiguredStorageDriver, V as isAssetPath, _ as createNodeDatabase, a as createNodeCliRuntime, b as setMyCommands, c as createSiteService, d as resolveDatabaseDialect, f as createExportService, g as sqliteSchemaBundle, h as pgSchemaBundle, i as listPendingMigrations, j as getTelegramWebhookSecret, k as getSiteResolutionMode, l as viewBuffer, m as resolveConfig, n as createApp, o as createNodeRequestRuntime, p as createStorageDriver, r as PendingMigrationsError, s as setUpNodeInstance, u as getHostBasedStartupConfigurationIssues, v as schema_exports, w as getConfiguredSingleSitePathPrefix, x as setWebhook, y as getWebhookUrl, z as BUILTIN_COLOR_THEMES } from "./app-C8dETvgL.js";
2
2
  import { drizzle } from "drizzle-orm/better-sqlite3";
3
3
  import { serve } from "@hono/node-server";
4
4
  import Database from "better-sqlite3";
@@ -626,7 +626,7 @@ async function createNodeRequestHandler(options) {
626
626
  async function start(env = process.env, app, options = {}) {
627
627
  const handler = await createNodeRequestHandler({
628
628
  env,
629
- app: async () => app ?? (await import("./app-CKQ9PqAr.js").then((n) => n.t)).createApp(),
629
+ app: async () => app ?? (await import("./app-C8dETvgL.js").then((n) => n.t)).createApp(),
630
630
  assetRoot: options.assetRoot
631
631
  });
632
632
  const hostname = resolveHost(env);
@@ -664,6 +664,7 @@ async function start(env = process.env, app, options = {}) {
664
664
  });
665
665
  });
666
666
  } finally {
667
+ await viewBuffer.flush();
667
668
  await handler.close();
668
669
  }
669
670
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,6 +72,7 @@
72
72
  "@tiptap/extension-bold": "^3.31.3",
73
73
  "@tiptap/extension-code-block": "^3.27.3",
74
74
  "@tiptap/extension-hard-break": "^3.31.3",
75
+ "@tiptap/extension-heading": "^3.31.3",
75
76
  "@tiptap/extension-image": "^3.27.3",
76
77
  "@tiptap/extension-italic": "^3.31.3",
77
78
  "@tiptap/extension-link": "^3.27.3",
package/src/app.tsx CHANGED
@@ -79,6 +79,8 @@ import { defaultCacheControl, noStore } from "./middleware/cache-control.js";
79
79
  import { requireOnboarding } from "./middleware/onboarding.js";
80
80
  import { errorHandler, notFoundHandler } from "./middleware/error-handler.js";
81
81
  import { prefetchSettings, withConfig } from "./middleware/config.js";
82
+ import { viewCounter } from "./middleware/view-counter.js";
83
+ import { viewConfirmRoutes } from "./routes/view-confirm.js";
82
84
  import { secureHeadersMiddleware } from "./middleware/secure-headers.js";
83
85
  import { apiCors } from "./middleware/cors.js";
84
86
  import { rejectCrossOriginWrites } from "./middleware/cross-origin.js";
@@ -549,6 +551,12 @@ export function createApp(): HonoApp {
549
551
  app.use("*", withConfig());
550
552
  app.use("*", i18nMiddleware());
551
553
 
554
+ // Page views: the page routes below name what they rendered
555
+ // (`c.var.viewTarget`), this marks the response with a view token, and
556
+ // `/_/seen` counts the view once the browser confirms it. Needs the
557
+ // config above for the stats switch.
558
+ app.use("*", viewCounter());
559
+
552
560
  // --- Routes that need config ---
553
561
 
554
562
  // Public machine-readable site guide
@@ -606,6 +614,7 @@ export function createApp(): HonoApp {
606
614
  app.route("/subscribe", subscribeRoutes);
607
615
  app.route("/latest", latestRoutes);
608
616
  app.route("/", partialPageRoutes);
617
+ app.route("/_", viewConfirmRoutes);
609
618
  app.route("/_", brandRoutes);
610
619
  app.route("/_", themeSampleRoutes);
611
620
  app.route("/collections", collectionsPageRoutes);
@@ -315,6 +315,8 @@ export interface ComposeLabels {
315
315
  publishVisibilityPublicHint: string;
316
316
  publishVisibilityHiddenFromLatest: string;
317
317
  publishVisibilityHiddenFromLatestHint: string;
318
+ publishVisibilityUnlisted: string;
319
+ publishVisibilityUnlistedHint: string;
318
320
  publishVisibilityPrivate: string;
319
321
  publishVisibilityPrivateHint: string;
320
322
  publishDateLabel: string;
@@ -338,6 +340,7 @@ export interface ComposeLabels {
338
340
  publishSlugInvalid: string;
339
341
  publishSlugReserved: string;
340
342
  postHiddenFromLatest: string;
343
+ postUnlisted: string;
341
344
  postPrivately: string;
342
345
  quietReplyLabel: string;
343
346
  quietReplyHint: string;
@@ -347,6 +350,7 @@ export interface ComposeLabels {
347
350
  editing: string;
348
351
  composeDialogLabel: string;
349
352
  slashHint: string;
353
+ highlight: string;
350
354
  tableControls: TableControlLabels;
351
355
  collectionFormLabels: CollectionFormLabels;
352
356
  }
@@ -382,7 +386,8 @@ export interface ComposeFullscreenCloseDetail {
382
386
  editorIndex?: number;
383
387
  }
384
388
 
385
- export type ComposeVisibility = "public" | "latest_hidden" | "private";
389
+ export type ComposeVisibility =
390
+ "public" | "latest_hidden" | "unlisted" | "private";
386
391
 
387
392
  export type ComposeSubmitAttachment =
388
393
  | {
@@ -268,6 +268,10 @@ const COMPOSE_PUBLISH_VISIBILITY_ICONS: Record<ComposeVisibility, string> = {
268
268
  />
269
269
  <path d="M4.35 11.1 11.65 4.9" />
270
270
  `,
271
+ unlisted: `
272
+ <path d="M6.8 8.6a3 3 0 0 0 4.524.324l1.8-1.8a3 3 0 0 0-4.242-4.242l-1.032 1.026" />
273
+ <path d="M9.2 7.4a3 3 0 0 0-4.524-.324l-1.8 1.8a3 3 0 0 0 4.242 4.242l1.026-1.026" />
274
+ `,
271
275
  private: `
272
276
  <rect x="4.05" y="7.05" width="7.9" height="5.4" rx="1.75" />
273
277
  <path d="M5.95 7.05V5.9A2.05 2.05 0 0 1 8 3.85a2.05 2.05 0 0 1 2.05 2.05v1.15" />
@@ -614,7 +618,14 @@ export class JantComposeDialog extends LitElement {
614
618
  const v = globalThis.localStorage.getItem(
615
619
  JantComposeDialog._collectionVisibilityKey(collectionId),
616
620
  );
617
- if (v === "public" || v === "latest_hidden" || v === "private") return v;
621
+ if (
622
+ v === "public" ||
623
+ v === "latest_hidden" ||
624
+ v === "unlisted" ||
625
+ v === "private"
626
+ ) {
627
+ return v;
628
+ }
618
629
  } catch {
619
630
  // localStorage unavailable
620
631
  }
@@ -2970,6 +2981,7 @@ export class JantComposeDialog extends LitElement {
2970
2981
  content,
2971
2982
  toolbarMode: "compose",
2972
2983
  tableControlLabels: this.labels.tableControls,
2984
+ highlightLabel: this.labels.highlight,
2973
2985
  });
2974
2986
  this._focusAttachedEditorBoundary(content);
2975
2987
  });
@@ -5040,6 +5052,7 @@ export class JantComposeDialog extends LitElement {
5040
5052
  if (this._visibility === "latest_hidden") {
5041
5053
  return this.labels.postHiddenFromLatest;
5042
5054
  }
5055
+ if (this._visibility === "unlisted") return this.labels.postUnlisted;
5043
5056
  if (this._visibility === "private") return this.labels.postPrivately;
5044
5057
  return this.labels.post;
5045
5058
  }
@@ -5334,6 +5347,7 @@ export class JantComposeDialog extends LitElement {
5334
5347
  "compose-publish-visibility-icon-public": visibility === "public",
5335
5348
  "compose-publish-visibility-icon-latest_hidden":
5336
5349
  visibility === "latest_hidden",
5350
+ "compose-publish-visibility-icon-unlisted": visibility === "unlisted",
5337
5351
  "compose-publish-visibility-icon-private": visibility === "private",
5338
5352
  });
5339
5353
  return renderComposePublishVisibilityIcon(
@@ -6431,6 +6445,11 @@ export class JantComposeDialog extends LitElement {
6431
6445
  this.labels.publishVisibilityHiddenFromLatest,
6432
6446
  this.labels.publishVisibilityHiddenFromLatestHint,
6433
6447
  )}
6448
+ ${this._renderVisibilityRow(
6449
+ "unlisted",
6450
+ this.labels.publishVisibilityUnlisted,
6451
+ this.labels.publishVisibilityUnlistedHint,
6452
+ )}
6434
6453
  ${this._renderVisibilityRow(
6435
6454
  "private",
6436
6455
  this.labels.publishVisibilityPrivate,
@@ -6792,13 +6811,16 @@ export class JantComposeDialog extends LitElement {
6792
6811
  }
6793
6812
 
6794
6813
  /**
6795
- * Visibility has three states, so a checkbox cannot speak for all of them: it
6814
+ * Visibility has four states, so a checkbox cannot speak for all of them: it
6796
6815
  * covers the public ↔ hidden-from-Latest pair and steps aside once the post
6797
- * is private, where the panel's radio list is the only honest control.
6816
+ * is unlisted or private, where the panel's radio list is the only honest
6817
+ * control.
6798
6818
  */
6799
6819
  private _renderHideFromLatestQuickToggle() {
6800
6820
  if (this._visibilityLocked) return nothing;
6801
- if (this._visibility === "private") return nothing;
6821
+ if (this._visibility === "unlisted" || this._visibility === "private") {
6822
+ return nothing;
6823
+ }
6802
6824
 
6803
6825
  const checked = this._visibility === "latest_hidden";
6804
6826
  return html`
@@ -1130,6 +1130,7 @@ export class JantComposeEditor extends LitElement {
1130
1130
  },
1131
1131
  imageNodeLabels: getInlineImageNodeLabels(this.labels),
1132
1132
  tableControlLabels: this.labels.tableControls,
1133
+ highlightLabel: this.labels.highlight,
1133
1134
  });
1134
1135
  this._lastEditorSelection = this._readEditorSelection();
1135
1136
  // An editor built from existing content — after a format switch, or on a
@@ -1331,6 +1332,34 @@ export class JantComposeEditor extends LitElement {
1331
1332
  return this._attachments.some((a) => a.clientId === clientId);
1332
1333
  }
1333
1334
 
1335
+ /**
1336
+ * Ask for posters for the uploaded videos that have none. A clip that came
1337
+ * in through the API without a poster gets one made here, in the author's
1338
+ * browser, the only place every deployment can decode video. The bridge
1339
+ * stores it and shows it on the card.
1340
+ */
1341
+ #requestMissingPosters() {
1342
+ const attachments = this._attachments.flatMap((a) =>
1343
+ a.file.type.startsWith("video/") &&
1344
+ a.mediaId &&
1345
+ a.remoteUrl &&
1346
+ a.posterUrl === null
1347
+ ? [{ clientId: a.clientId, mediaId: a.mediaId, url: a.remoteUrl }]
1348
+ : [],
1349
+ );
1350
+ if (attachments.length === 0) return;
1351
+
1352
+ // Wait for the render, so the event leaves from a connected editor.
1353
+ void this.updateComplete.then(() => {
1354
+ this.dispatchEvent(
1355
+ new CustomEvent("jant:video-posters-missing", {
1356
+ bubbles: true,
1357
+ detail: { attachments },
1358
+ }),
1359
+ );
1360
+ });
1361
+ }
1362
+
1334
1363
  /** Pre-fill all fields for edit mode or draft restore */
1335
1364
  populate(data: {
1336
1365
  format: string;
@@ -1418,6 +1447,7 @@ export class JantComposeEditor extends LitElement {
1418
1447
  }));
1419
1448
  this._attachments = attachments;
1420
1449
  this._attachmentOrder = attachments.map((a) => a.clientId);
1450
+ this.#requestMissingPosters();
1421
1451
  }
1422
1452
 
1423
1453
  // Restore attached texts from server data
@@ -165,6 +165,7 @@ export class JantComposeFullscreen extends LitElement {
165
165
  },
166
166
  imageNodeLabels: getInlineImageNodeLabels(this.labels),
167
167
  tableControlLabels: this.labels.tableControls,
168
+ highlightLabel: this.labels.highlight,
168
169
  });
169
170
 
170
171
  const selection = this._selection;
@@ -13,7 +13,9 @@ import { LitElement, html, nothing, svg } from "lit";
13
13
  import { shouldUseShortVideoExperience } from "../../lib/video-playback.js";
14
14
  import {
15
15
  isMediaVideoPlaybackPaused,
16
+ MEDIA_LIGHTBOX_SHOW_EVENT,
16
17
  MEDIA_LIGHTBOX_TOGGLE_EVENT,
18
+ type MediaLightboxShowDetail,
17
19
  setMediaVideoPlaybackPaused,
18
20
  } from "../media-lightbox-events.js";
19
21
 
@@ -160,6 +162,9 @@ export class JantMediaLightbox extends LitElement {
160
162
  declare _videoPaused: boolean;
161
163
  declare _imageZoomed: boolean;
162
164
 
165
+ /** Where the open set of items came from, for `MEDIA_LIGHTBOX_SHOW_EVENT`. */
166
+ #source: globalThis.Element | null = null;
167
+
163
168
  createRenderRoot() {
164
169
  this.innerHTML = "";
165
170
  return this;
@@ -193,7 +198,12 @@ export class JantMediaLightbox extends LitElement {
193
198
  window.removeEventListener("resize", this.#handleViewportChange);
194
199
  }
195
200
 
196
- open(images: LightboxImage[], index: number) {
201
+ open(
202
+ images: LightboxImage[],
203
+ index: number,
204
+ source: globalThis.Element | null = null,
205
+ ) {
206
+ this.#source = source;
197
207
  this.#syncViewport();
198
208
  this.#pauseCurrentVideo();
199
209
  this._images = images;
@@ -244,7 +254,7 @@ export class JantMediaLightbox extends LitElement {
244
254
  group.dataset.lightboxGroup ?? "[]",
245
255
  );
246
256
  if (images.length > 0) {
247
- this.open(images, index);
257
+ this.open(images, index, group);
248
258
  }
249
259
  } catch {
250
260
  // JSON parse failed — fall through to default link behavior
@@ -272,7 +282,7 @@ export class JantMediaLightbox extends LitElement {
272
282
  ),
273
283
  }));
274
284
  const index = allImages.indexOf(img);
275
- if (images.length > 0) this.open(images, Math.max(0, index));
285
+ if (images.length > 0) this.open(images, Math.max(0, index), container);
276
286
  }
277
287
  };
278
288
 
@@ -621,6 +631,11 @@ export class JantMediaLightbox extends LitElement {
621
631
  if (changed.has("_currentIndex") || changed.has("_open")) {
622
632
  this.#syncCurrentVideo();
623
633
  this.#focusCurrentMedia();
634
+ document.dispatchEvent(
635
+ new CustomEvent<MediaLightboxShowDetail>(MEDIA_LIGHTBOX_SHOW_EVENT, {
636
+ detail: { source: this.#source, index: this._currentIndex },
637
+ }),
638
+ );
624
639
  }
625
640
  }
626
641
 
@@ -1811,6 +1811,8 @@ export class JantNavManager extends LitElement {
1811
1811
  );
1812
1812
  case "unpublished":
1813
1813
  return this.labels.addressUnpublished;
1814
+ case "unlisted":
1815
+ return this.labels.addressUnlisted;
1814
1816
  case "private":
1815
1817
  return this.labels.addressPrivate;
1816
1818
  case "untitled":
@@ -62,6 +62,14 @@ interface MenuLanguage {
62
62
  label: string;
63
63
  }
64
64
 
65
+ /** The visibility panel's choices, widest audience first. */
66
+ const POST_MENU_VISIBILITY_OPTIONS = [
67
+ { value: "public", label: "Public" },
68
+ { value: "latest_hidden", label: "Hidden from Latest" },
69
+ { value: "unlisted", label: "Unlisted" },
70
+ { value: "private", label: "Private" },
71
+ ] as const;
72
+
65
73
  /**
66
74
  * What the server made of an address pasted into the translation picker: the
67
75
  * Thread it names, or why that Thread cannot be linked to this one.
@@ -142,7 +150,8 @@ export function removeLeadingFeedDivider(
142
150
 
143
151
  /**
144
152
  * The image carries a QR code to the post, which a reader can open only once
145
- * it is published and not Private.
153
+ * it is published and not Private. An Unlisted post opens for anyone with the
154
+ * link, so it can be shared this way too.
146
155
  */
147
156
  function canShareAsImage(data: PostMenuData): boolean {
148
157
  return !data.isDraft && data.visibility !== "private";
@@ -1088,6 +1097,7 @@ export class JantPostMenu extends LitElement {
1088
1097
  const messages: Record<string, string> = {
1089
1098
  public: "Post made public.",
1090
1099
  latest_hidden: "Hidden from Latest.",
1100
+ unlisted: "Post made unlisted.",
1091
1101
  private: "Post made private.",
1092
1102
  };
1093
1103
  showToast(messages[newVisibility] ?? "Visibility updated.");
@@ -1522,14 +1532,10 @@ export class JantPostMenu extends LitElement {
1522
1532
  }
1523
1533
 
1524
1534
  #getVisibilityLabel(visibility: string) {
1525
- switch (visibility) {
1526
- case "private":
1527
- return "Private";
1528
- case "latest_hidden":
1529
- return "Hidden from Latest";
1530
- default:
1531
- return "Public";
1532
- }
1535
+ return (
1536
+ POST_MENU_VISIBILITY_OPTIONS.find((option) => option.value === visibility)
1537
+ ?.label ?? "Public"
1538
+ );
1533
1539
  }
1534
1540
 
1535
1541
  // --- Icons (inline SVG) ---
@@ -2140,86 +2146,33 @@ export class JantPostMenu extends LitElement {
2140
2146
  </div>
2141
2147
  <div role="menu" class="post-menu-list">
2142
2148
  <div class="post-menu-section">
2143
- <button
2144
- type="button"
2145
- role="menuitemradio"
2146
- aria-checked=${visibility === "public" ? "true" : "false"}
2147
- data-post-menu-visibility-option
2148
- data-post-menu-visibility-current=${
2149
- visibility === "public" ? "true" : "false"
2150
- }
2151
- class=${`post-menu-item${
2152
- visibility === "public" ? " post-menu-item-active" : ""
2153
- }`}
2154
- @click=${() =>
2155
- visibility === "public"
2156
- ? this.#showMainMenu("[data-post-menu-open-visibility]")
2157
- : this.#setVisibility("public")}
2158
- >
2159
- <span class="post-menu-item-label">Public</span>
2160
- ${
2161
- visibility === "public"
2162
- ? html`<span
2163
- class="post-menu-item-trailing post-menu-item-check"
2164
- >${this.#iconCheck()}</span
2165
- >`
2166
- : nothing
2167
- }
2168
- </button>
2169
-
2170
- <button
2171
- type="button"
2172
- role="menuitemradio"
2173
- aria-checked=${visibility === "latest_hidden" ? "true" : "false"}
2174
- data-post-menu-visibility-option
2175
- data-post-menu-visibility-current=${
2176
- visibility === "latest_hidden" ? "true" : "false"
2177
- }
2178
- class=${`post-menu-item${
2179
- visibility === "latest_hidden" ? " post-menu-item-active" : ""
2180
- }`}
2181
- @click=${() =>
2182
- visibility === "latest_hidden"
2183
- ? this.#showMainMenu("[data-post-menu-open-visibility]")
2184
- : this.#setVisibility("latest_hidden")}
2185
- >
2186
- <span class="post-menu-item-label">Hidden from Latest</span>
2187
- ${
2188
- visibility === "latest_hidden"
2189
- ? html`<span
2190
- class="post-menu-item-trailing post-menu-item-check"
2191
- >${this.#iconCheck()}</span
2192
- >`
2193
- : nothing
2194
- }
2195
- </button>
2196
-
2197
- <button
2198
- type="button"
2199
- role="menuitemradio"
2200
- aria-checked=${visibility === "private" ? "true" : "false"}
2201
- data-post-menu-visibility-option
2202
- data-post-menu-visibility-current=${
2203
- visibility === "private" ? "true" : "false"
2204
- }
2205
- class=${`post-menu-item${
2206
- visibility === "private" ? " post-menu-item-active" : ""
2207
- }`}
2208
- @click=${() =>
2209
- visibility === "private"
2210
- ? this.#showMainMenu("[data-post-menu-open-visibility]")
2211
- : this.#setVisibility("private")}
2212
- >
2213
- <span class="post-menu-item-label">Private</span>
2214
- ${
2215
- visibility === "private"
2216
- ? html`<span
2217
- class="post-menu-item-trailing post-menu-item-check"
2218
- >${this.#iconCheck()}</span
2219
- >`
2220
- : nothing
2221
- }
2222
- </button>
2149
+ ${POST_MENU_VISIBILITY_OPTIONS.map(({ value, label }) => {
2150
+ const current = visibility === value;
2151
+ return html`
2152
+ <button
2153
+ type="button"
2154
+ role="menuitemradio"
2155
+ aria-checked=${current ? "true" : "false"}
2156
+ data-post-menu-visibility-option
2157
+ data-post-menu-visibility-current=${current ? "true" : "false"}
2158
+ class=${`post-menu-item${current ? " post-menu-item-active" : ""}`}
2159
+ @click=${() =>
2160
+ current
2161
+ ? this.#showMainMenu("[data-post-menu-open-visibility]")
2162
+ : this.#setVisibility(value)}
2163
+ >
2164
+ <span class="post-menu-item-label">${label}</span>
2165
+ ${
2166
+ current
2167
+ ? html`<span
2168
+ class="post-menu-item-trailing post-menu-item-check"
2169
+ >${this.#iconCheck()}</span
2170
+ >`
2171
+ : nothing
2172
+ }
2173
+ </button>
2174
+ `;
2175
+ })}
2223
2176
  </div>
2224
2177
  </div>
2225
2178
  </div>
@@ -55,6 +55,7 @@ export type NavAddressResolution =
55
55
  | "link_only"
56
56
  | "untitled"
57
57
  | "unpublished"
58
+ | "unlisted"
58
59
  | "private"
59
60
  | "not_found";
60
61
  address: string;
@@ -134,6 +135,7 @@ export interface NavManagerLabels {
134
135
  addressAlreadyAdded: string;
135
136
  addressNotFound: string;
136
137
  addressUnpublished: string;
138
+ addressUnlisted: string;
137
139
  addressPrivate: string;
138
140
  addressUntitled: string;
139
141
  addressExternal: string;
@@ -102,7 +102,7 @@ export type SettingsAboutPageStatus =
102
102
  id: string;
103
103
  title: string | null;
104
104
  status: "draft" | "published";
105
- visibility: "public" | "latest_hidden" | "private";
105
+ visibility: "public" | "latest_hidden" | "unlisted" | "private";
106
106
  };
107
107
  }
108
108
  | {