@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.
- package/bin/commands/site/import.js +2 -1
- package/bin/lib/site-snapshot.js +10 -0
- package/dist/{app-CKQ9PqAr.js → app-C8dETvgL.js} +9267 -5697
- package/dist/client/.vite/manifest.json +82 -93
- package/dist/client/_assets/chunks/{confirm-CMe01lne.js → confirm-BQebcuNB.js} +1 -1
- package/dist/client/_assets/chunks/{create-editor-BQkrw8Ax.js → create-editor-B8KuszlS.js} +38 -38
- package/dist/client/_assets/chunks/footnote-rail-DUrqz0Py.js +2 -0
- package/dist/client/_assets/chunks/{jant-locale-picker-2L4rkDaz.js → jant-locale-picker-CLq0iKDH.js} +1 -1
- package/dist/client/_assets/chunks/lit-BN4mrI3j.js +2 -0
- package/dist/client/_assets/chunks/{settings-paths-B0bNUaih.js → settings-paths-_fry4yWW.js} +1 -1
- package/dist/client/_assets/chunks/{slug-format-CYmQE5ln.js → slug-format-bcJ2ozr4.js} +1 -1
- package/dist/client/_assets/chunks/sortable-list-Bz2Na2E9.js +2 -0
- package/dist/client/_assets/chunks/types-DrYFqJH2.js +1 -0
- package/dist/client/_assets/chunks/{unsafe-html-CWos3v6N.js → unsafe-html-OJ9m154w.js} +1 -1
- package/dist/client/_assets/chunks/unsafe-svg-DVJ4NPcb.js +1 -0
- package/dist/client/_assets/client-CoNHvipV.css +2 -0
- package/dist/client/_assets/{client-auth-CG55rWb5.js → client-auth-CbnZkLJ6.js} +99 -129
- package/dist/client/_assets/{client-author-CGVvrNZ8.css → client-author-2WYBkgni.css} +1 -1
- package/dist/client/_assets/client-compose-DYtDlYm-.js +2008 -0
- package/dist/client/_assets/{client-manage-DnYdQAhf.js → client-manage-BODyYP5Z.js} +157 -157
- package/dist/client/_assets/client-pq6sVS7y.js +354 -0
- package/dist/client/_assets/{client-settings-CHgsIqXJ.js → client-settings-DDpe_tXJ.js} +166 -166
- package/dist/client/_assets/client-share-B9OsXx9p.js +149 -0
- package/dist/{constants-DEgyqWDl.js → constants-C2CdWAqt.js} +55 -5
- package/dist/index.js +1 -1
- package/dist/node.js +3 -2
- package/package.json +2 -1
- package/src/app.tsx +9 -0
- package/src/client/components/compose-types.ts +6 -1
- package/src/client/components/jant-compose-dialog.ts +26 -4
- package/src/client/components/jant-compose-editor.ts +30 -0
- package/src/client/components/jant-compose-fullscreen.ts +1 -0
- package/src/client/components/jant-media-lightbox.ts +18 -3
- package/src/client/components/jant-nav-manager.ts +2 -0
- package/src/client/components/jant-post-menu.ts +42 -89
- package/src/client/components/nav-manager-types.ts +2 -0
- package/src/client/components/settings-types.ts +1 -1
- package/src/client/compose-bridge.ts +61 -1
- package/src/client/feed-video-player.ts +6 -0
- package/src/client/list-views.ts +382 -0
- package/src/client/media-lightbox-events.ts +12 -0
- package/src/client/runtime-paths.ts +12 -0
- package/src/client/share-capture.ts +63 -0
- package/src/client/share-launch.ts +36 -9
- package/src/client/tiptap/bubble-menu.ts +25 -2
- package/src/client/tiptap/create-editor.ts +6 -0
- package/src/client/tiptap/embed-node.ts +3 -1
- package/src/client/tiptap/extensions.ts +4 -0
- package/src/client/tiptap/html-block-node.ts +3 -1
- package/src/client/tiptap/image-node.ts +3 -1
- package/src/client/video-processor.ts +106 -52
- package/src/client/view-confirm.ts +136 -0
- package/src/client.ts +2 -0
- package/src/db/migrations/0035_brainy_next_avengers.sql +9 -0
- package/src/db/migrations/0036_gorgeous_smasher.sql +7 -0
- package/src/db/migrations/0037_round_post.sql +16 -0
- package/src/db/migrations/0038_flashy_changeling.sql +15 -0
- package/src/db/migrations/0039_mixed_sister_grimm.sql +1 -0
- package/src/db/migrations/meta/0035_snapshot.json +2877 -0
- package/src/db/migrations/meta/0036_snapshot.json +2924 -0
- package/src/db/migrations/meta/0037_snapshot.json +2932 -0
- package/src/db/migrations/meta/0038_snapshot.json +2924 -0
- package/src/db/migrations/meta/0039_snapshot.json +2931 -0
- package/src/db/migrations/meta/_journal.json +35 -0
- package/src/db/migrations/pg/0033_cute_magdalene.sql +10 -0
- package/src/db/migrations/pg/0034_material_agent_brand.sql +8 -0
- package/src/db/migrations/pg/0035_flimsy_outlaw_kid.sql +3 -0
- package/src/db/migrations/pg/0036_milky_wolverine.sql +5 -0
- package/src/db/migrations/pg/0037_fuzzy_hammerhead.sql +1 -0
- package/src/db/migrations/pg/meta/0033_snapshot.json +3719 -0
- package/src/db/migrations/pg/meta/0034_snapshot.json +3766 -0
- package/src/db/migrations/pg/meta/0035_snapshot.json +3773 -0
- package/src/db/migrations/pg/meta/0036_snapshot.json +3766 -0
- package/src/db/migrations/pg/meta/0037_snapshot.json +3772 -0
- package/src/db/migrations/pg/meta/_journal.json +35 -0
- package/src/db/pg/schema.ts +41 -0
- package/src/db/post-visibility.ts +37 -6
- package/src/db/schema.ts +64 -0
- package/src/i18n/locales/glossary.zh-Hans.yml +4 -0
- package/src/i18n/locales/glossary.zh-Hant.yml +4 -0
- package/src/i18n/locales/public/en.po +26 -7
- package/src/i18n/locales/public/en.ts +1 -1
- package/src/i18n/locales/public/zh-Hans.po +25 -6
- package/src/i18n/locales/public/zh-Hans.ts +1 -1
- package/src/i18n/locales/public/zh-Hant.po +25 -6
- package/src/i18n/locales/public/zh-Hant.ts +1 -1
- package/src/i18n/locales/settings/en.po +159 -0
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +159 -0
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +159 -0
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/lib/api-public-posts.ts +10 -0
- package/src/lib/env.ts +20 -0
- package/src/lib/feed-policy.ts +2 -2
- package/src/lib/filter-dimensions.ts +11 -4
- package/src/lib/github-app-state.ts +1 -1
- package/src/lib/github-app.ts +183 -1
- package/src/lib/hugo-markdown.ts +7 -0
- package/src/lib/icons.ts +2 -0
- package/src/lib/link-preview.ts +499 -0
- package/src/lib/list-views.ts +117 -0
- package/src/lib/markdown-manager.ts +169 -2
- package/src/lib/navigation.ts +1 -1
- package/src/lib/post-meta.ts +13 -3
- package/src/lib/referrer-aliases.ts +311 -0
- package/src/lib/render.tsx +10 -0
- package/src/lib/resolve-config.ts +14 -0
- package/src/lib/share-card.ts +4 -3
- package/src/lib/summary.ts +152 -54
- package/src/lib/thread-query.ts +6 -2
- package/src/lib/timeline.ts +12 -11
- package/src/lib/tiptap-render.ts +1 -0
- package/src/lib/upload.ts +21 -1
- package/src/lib/url-fetch.ts +291 -74
- package/src/lib/video-playback.ts +55 -0
- package/src/lib/view-buffer.ts +201 -0
- package/src/lib/view-counting.ts +540 -0
- package/src/lib/view-token.ts +199 -0
- package/src/lib/view.ts +30 -1
- package/src/middleware/view-counter.ts +145 -0
- package/src/node/runtime.ts +4 -0
- package/src/preset.css +36 -17
- package/src/routes/api/media.ts +21 -3
- package/src/routes/api/search.ts +1 -1
- package/src/routes/dash/settings.tsx +434 -169
- package/src/routes/feed/sitemap.ts +1 -1
- package/src/routes/pages/archive.tsx +26 -19
- package/src/routes/pages/collection.tsx +9 -3
- package/src/routes/pages/collections.tsx +1 -0
- package/src/routes/pages/featured.tsx +1 -0
- package/src/routes/pages/home.tsx +1 -0
- package/src/routes/pages/page.tsx +18 -3
- package/src/routes/pages/search.tsx +3 -3
- package/src/routes/pages/smart-collection.tsx +2 -0
- package/src/routes/pages/subscribe.tsx +1 -0
- package/src/routes/view-confirm.ts +71 -0
- package/src/services/collection.ts +1 -1
- package/src/services/export-theme/assets/client-site.js +19 -19
- package/src/services/export-theme/layouts/archive/list.html +4 -2
- package/src/services/export-theme/layouts/partials/collection-members.html +4 -3
- package/src/services/export-theme/layouts/partials/featured-members.html +3 -3
- package/src/services/export-theme/layouts/partials/head.html +2 -0
- package/src/services/export-theme/layouts/partials/latest-members.html +4 -4
- package/src/services/export-theme/layouts/partials/post-card.html +1 -9
- package/src/services/export-theme/layouts/partials/reply.html +1 -9
- package/src/services/export-theme/layouts/partials/smart-collection-members.html +4 -3
- package/src/services/export-theme/layouts/post/list.html +1 -9
- package/src/services/export-theme/styles/main.css +41 -47
- package/src/services/export.ts +12 -3
- package/src/services/index.ts +17 -0
- package/src/services/mcp.ts +36 -6
- package/src/services/media.ts +63 -0
- package/src/services/navigation.ts +9 -4
- package/src/services/post.ts +102 -112
- package/src/services/search.ts +22 -7
- package/src/services/smart-collection.ts +3 -3
- package/src/services/stats.ts +1137 -0
- package/src/services/thread.ts +6 -2
- package/src/styles/components-author.css +242 -3
- package/src/styles/components.css +11 -3
- package/src/styles/tokens.css +89 -55
- package/src/styles/ui-author.css +140 -353
- package/src/styles/ui.css +90 -45
- package/src/types/app-context.ts +9 -0
- package/src/types/bindings.ts +5 -0
- package/src/types/config.ts +54 -0
- package/src/types/constants.ts +68 -4
- package/src/types/entities.ts +1 -0
- package/src/types/views.ts +8 -0
- package/src/ui/compose/ComposeDialog.tsx +26 -1
- package/src/ui/dash/StatusBadge.tsx +11 -0
- package/src/ui/dash/appearance/FontThemeContent.tsx +1 -1
- package/src/ui/dash/appearance/NavigationContent.tsx +8 -0
- package/src/ui/dash/settings/SettingsRootContent.tsx +24 -6
- package/src/ui/dash/settings/StatsContent.tsx +855 -0
- package/src/ui/feed/LinkCard.tsx +19 -2
- package/src/ui/feed/PostStatusBadges.tsx +19 -3
- package/src/ui/feed/TimelineFeed.tsx +3 -0
- package/src/ui/font-themes.ts +56 -6
- package/src/ui/layouts/BaseLayout.tsx +4 -2
- package/src/ui/layouts/SiteLayout.tsx +8 -3
- package/src/ui/pages/ArchivePage.tsx +1 -0
- package/src/ui/shared/MediaGallery.tsx +19 -3
- package/src/ui/shared/PostFooter.tsx +1 -22
- package/src/ui/shared/custom-icons.ts +5 -5
- package/dist/client/_assets/chunks/footnote-rail-B08scyhW.js +0 -2
- package/dist/client/_assets/chunks/lit-Bw_voPoW.js +0 -2
- package/dist/client/_assets/chunks/runtime-paths-y0_gHowM.js +0 -1
- package/dist/client/_assets/chunks/sortable-list-t11Ma1Ek.js +0 -2
- package/dist/client/_assets/chunks/types-D5iF3H1a.js +0 -1
- package/dist/client/_assets/chunks/unsafe-svg-DZl-yjas.js +0 -1
- package/dist/client/_assets/client-B0-s9sqx.css +0 -2
- package/dist/client/_assets/client-Dp46QSht.js +0 -354
- package/dist/client/_assets/client-compose-DkUTuavR.js +0 -2004
- package/dist/client/_assets/client-share-C59mOLJ1.js +0 -149
|
@@ -91,17 +91,24 @@ h1 {
|
|
|
91
91
|
|
|
92
92
|
h2 {
|
|
93
93
|
font-size: var(--type-content-title);
|
|
94
|
-
margin: 2.
|
|
94
|
+
margin: 2.6rem 0 0.9rem;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
h3 {
|
|
98
98
|
font-size: var(--type-content-subtitle);
|
|
99
|
-
margin: 2rem 0
|
|
99
|
+
margin: 2.2rem 0 0.75rem;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
h4 {
|
|
103
103
|
font-size: var(--type-content-body);
|
|
104
|
-
|
|
104
|
+
margin: 1.8rem 0 0.6rem;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* The block after a heading gives up its own top margin, so the heading's
|
|
108
|
+
bottom margin is the whole gap; otherwise a paragraph's 1.4rem wins the
|
|
109
|
+
margin collapse and the heading floats 1.4rem from both neighbours. */
|
|
110
|
+
:is(h1, h2, h3, h4, h5, h6) + * {
|
|
111
|
+
margin-top: 0;
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
h5,
|
|
@@ -303,7 +310,9 @@ time {
|
|
|
303
310
|
* max-width = body-max-width / 0.835 so the inner content area exactly
|
|
304
311
|
* equals `--layout-body-max-width` on wide viewports. min() caps keep
|
|
305
312
|
* padding from growing beyond 210px / 67px. Mobile widens to 5% / 5%
|
|
306
|
-
* and the 55% content column collapses to 100% (via tokens.css).
|
|
313
|
+
* and the 55% content column collapses to 100% (via tokens.css). Below
|
|
314
|
+
* 1024px, where the sidenote gutter is gone, the frame narrows to the
|
|
315
|
+
* reading measure and centers, as on the main site.
|
|
307
316
|
* ------------------------------------------------------------------------- */
|
|
308
317
|
|
|
309
318
|
.site-page {
|
|
@@ -316,6 +325,8 @@ time {
|
|
|
316
325
|
.site-page > main,
|
|
317
326
|
.site-page > footer,
|
|
318
327
|
.site-page > .home-branding-credit {
|
|
328
|
+
--site-frame-gutter-start: max(5%, 28px);
|
|
329
|
+
--site-frame-gutter-end: 5%;
|
|
319
330
|
width: 100%;
|
|
320
331
|
max-width: calc(var(--layout-body-max-width) / 0.835);
|
|
321
332
|
padding-left: min(12.5%, 210px);
|
|
@@ -324,13 +335,17 @@ time {
|
|
|
324
335
|
margin-right: auto;
|
|
325
336
|
}
|
|
326
337
|
|
|
327
|
-
@media (max-width:
|
|
338
|
+
@media (max-width: 1024px) {
|
|
328
339
|
.site-page > header,
|
|
329
340
|
.site-page > main,
|
|
330
341
|
.site-page > footer,
|
|
331
342
|
.site-page > .home-branding-credit {
|
|
332
|
-
|
|
333
|
-
|
|
343
|
+
max-width: calc(
|
|
344
|
+
var(--layout-reading-measure) + var(--site-frame-gutter-start) +
|
|
345
|
+
var(--site-frame-gutter-end)
|
|
346
|
+
);
|
|
347
|
+
padding-left: var(--site-frame-gutter-start);
|
|
348
|
+
padding-right: var(--site-frame-gutter-end);
|
|
334
349
|
}
|
|
335
350
|
}
|
|
336
351
|
|
|
@@ -344,6 +359,8 @@ time {
|
|
|
344
359
|
* ------------------------------------------------------------------------- */
|
|
345
360
|
|
|
346
361
|
.site-header {
|
|
362
|
+
/* The nav collapses by this width (Tiered responsive collapse, below). */
|
|
363
|
+
container: site-header / inline-size;
|
|
347
364
|
padding-top: 24px;
|
|
348
365
|
background-color: var(--site-page-bg);
|
|
349
366
|
}
|
|
@@ -600,14 +617,15 @@ time {
|
|
|
600
617
|
|
|
601
618
|
/* --- Tiered responsive collapse ---------------------------------------- *
|
|
602
619
|
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
*
|
|
620
|
+
* By the header's own width, as on the main site:
|
|
621
|
+
* < 802px — 5th+ inline link collapses into More (tier-lg)
|
|
622
|
+
* < 652px — also 4th collapses (tier-md)
|
|
623
|
+
* < 522px — also 3rd collapses (tier-sm)
|
|
606
624
|
* The first two links always stay inline. No hamburger on static export —
|
|
607
625
|
* at very narrow widths 2 inline links + More button is the floor.
|
|
608
626
|
*/
|
|
609
627
|
|
|
610
|
-
@
|
|
628
|
+
@container site-header (width < 802px) {
|
|
611
629
|
.site-header-link-collapse-lg {
|
|
612
630
|
display: none;
|
|
613
631
|
}
|
|
@@ -625,7 +643,7 @@ time {
|
|
|
625
643
|
}
|
|
626
644
|
}
|
|
627
645
|
|
|
628
|
-
@
|
|
646
|
+
@container site-header (width < 652px) {
|
|
629
647
|
.site-header-link-collapse-md {
|
|
630
648
|
display: none;
|
|
631
649
|
}
|
|
@@ -639,7 +657,7 @@ time {
|
|
|
639
657
|
}
|
|
640
658
|
}
|
|
641
659
|
|
|
642
|
-
@
|
|
660
|
+
@container site-header (width < 522px) {
|
|
643
661
|
.site-header-link-collapse-sm {
|
|
644
662
|
display: none;
|
|
645
663
|
}
|
|
@@ -879,18 +897,18 @@ hr.feed-divider {
|
|
|
879
897
|
|
|
880
898
|
.post-card > .post-card-summary :is(h1, h2),
|
|
881
899
|
.post-card > .post-card-quote-commentary :is(h1, h2) {
|
|
882
|
-
font-size: calc(var(--type-content-body) * 1.
|
|
883
|
-
font-weight: var(--
|
|
884
|
-
margin-top: 1.
|
|
885
|
-
margin-bottom: 0.
|
|
900
|
+
font-size: calc(var(--type-content-body) * 1.2);
|
|
901
|
+
font-weight: var(--type-heading-weight);
|
|
902
|
+
margin-top: 1.6rem;
|
|
903
|
+
margin-bottom: 0.6rem;
|
|
886
904
|
}
|
|
887
905
|
|
|
888
906
|
.post-card > .post-card-summary :is(h3, h4),
|
|
889
907
|
.post-card > .post-card-quote-commentary :is(h3, h4) {
|
|
890
|
-
font-size: var(--type-content-body);
|
|
891
|
-
font-weight: var(--
|
|
892
|
-
margin-top: 1.
|
|
893
|
-
margin-bottom: 0.
|
|
908
|
+
font-size: calc(var(--type-content-body) * 1.08);
|
|
909
|
+
font-weight: var(--type-heading-weight);
|
|
910
|
+
margin-top: 1.4rem;
|
|
911
|
+
margin-bottom: 0.5rem;
|
|
894
912
|
}
|
|
895
913
|
|
|
896
914
|
.post-card > .post-card-summary :is(h5, h6),
|
|
@@ -903,7 +921,8 @@ hr.feed-divider {
|
|
|
903
921
|
}
|
|
904
922
|
|
|
905
923
|
/* Link card domain row — shown ABOVE the title (matches main site's
|
|
906
|
-
`.feed-link-domain` pattern). Inline flex
|
|
924
|
+
`.feed-link-domain` pattern). Inline flex: host text, then the external-link
|
|
925
|
+
mark. */
|
|
907
926
|
.post-card-link-domain,
|
|
908
927
|
.thread-link-domain,
|
|
909
928
|
.reply-link-domain {
|
|
@@ -1242,31 +1261,6 @@ hr.feed-divider {
|
|
|
1242
1261
|
text-decoration: underline;
|
|
1243
1262
|
}
|
|
1244
1263
|
|
|
1245
|
-
.post-footer-external-link {
|
|
1246
|
-
display: inline-flex;
|
|
1247
|
-
align-items: center;
|
|
1248
|
-
justify-content: center;
|
|
1249
|
-
width: 1.6rem;
|
|
1250
|
-
height: 1.6rem;
|
|
1251
|
-
border-radius: 0.6rem;
|
|
1252
|
-
color: var(--site-text-secondary);
|
|
1253
|
-
text-decoration: none;
|
|
1254
|
-
transition:
|
|
1255
|
-
color 0.18s ease,
|
|
1256
|
-
background-color 0.16s ease;
|
|
1257
|
-
flex-shrink: 0;
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
.post-footer-external-link:hover,
|
|
1261
|
-
.post-footer-external-link:focus {
|
|
1262
|
-
color: var(--site-text-primary);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
.post-footer-external-link svg {
|
|
1266
|
-
width: 1rem;
|
|
1267
|
-
height: 1rem;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
1264
|
.post-collection-tags {
|
|
1271
1265
|
display: inline-flex;
|
|
1272
1266
|
align-items: center;
|
package/src/services/export.ts
CHANGED
|
@@ -101,6 +101,7 @@ import { makeZip } from "client-zip";
|
|
|
101
101
|
import {
|
|
102
102
|
SYSTEM_NAV_KEYS,
|
|
103
103
|
isFeedNavKey,
|
|
104
|
+
isListedForReader,
|
|
104
105
|
type Collection,
|
|
105
106
|
type Media,
|
|
106
107
|
type NavItem,
|
|
@@ -118,7 +119,7 @@ import {
|
|
|
118
119
|
* importing the export and silently dropping what it doesn't know.
|
|
119
120
|
* `export-format-version.test.ts` freezes the fields each version reads.
|
|
120
121
|
*/
|
|
121
|
-
export const SITE_EXPORT_FORMAT_VERSION =
|
|
122
|
+
export const SITE_EXPORT_FORMAT_VERSION = 3;
|
|
122
123
|
|
|
123
124
|
/** A file of the exported Hugo site whose text or bytes the export holds. */
|
|
124
125
|
export interface ExportContentFile {
|
|
@@ -1232,6 +1233,11 @@ async function buildThreadBundle(
|
|
|
1232
1233
|
draft: rootIsUnpublished ? true : undefined,
|
|
1233
1234
|
aliases: aliases.length > 0 ? aliases : undefined,
|
|
1234
1235
|
feed_id: feedId,
|
|
1236
|
+
// An Unlisted Thread's page is built, so its link keeps working, but no
|
|
1237
|
+
// page collection includes it: not Latest, the archive, a collection, a
|
|
1238
|
+
// feed, or the sitemap.
|
|
1239
|
+
build: root.visibility === "unlisted" ? { list: "never" } : undefined,
|
|
1240
|
+
sitemap: root.visibility === "unlisted" ? { disable: true } : undefined,
|
|
1235
1241
|
format: root.format,
|
|
1236
1242
|
status: root.status,
|
|
1237
1243
|
visibility: root.visibility,
|
|
@@ -1746,8 +1752,9 @@ function buildExportedCollectionMetrics(
|
|
|
1746
1752
|
}
|
|
1747
1753
|
|
|
1748
1754
|
for (const post of posts) {
|
|
1749
|
-
// Drafts and private posts
|
|
1750
|
-
|
|
1755
|
+
// Drafts and private posts won't reach Hugo, and Unlisted ones are in no
|
|
1756
|
+
// list, so none of them counts toward a collection's directory entry.
|
|
1757
|
+
if (post.status === "draft" || !isListedForReader(post.visibility)) {
|
|
1751
1758
|
continue;
|
|
1752
1759
|
}
|
|
1753
1760
|
// Replies roll up into their thread root for directory metrics.
|
|
@@ -1877,6 +1884,8 @@ function buildHugoToml(config: SiteConfig): string {
|
|
|
1877
1884
|
" [markup.goldmark]",
|
|
1878
1885
|
" [markup.goldmark.renderer]",
|
|
1879
1886
|
" unsafe = true",
|
|
1887
|
+
" [markup.goldmark.extensions.extras.mark]",
|
|
1888
|
+
" enable = true",
|
|
1880
1889
|
"",
|
|
1881
1890
|
// Emit an Atom 2005 feed at the site root (/index.xml). Per-section
|
|
1882
1891
|
// feeds (featured, archive, each collection) are opted in via each
|
package/src/services/index.ts
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
type GitHubAppInstallationsService,
|
|
56
56
|
} from "./github-app-installations.js";
|
|
57
57
|
import { createTelegramService, type TelegramService } from "./telegram.js";
|
|
58
|
+
import { createStatsService, type StatsService } from "./stats.js";
|
|
58
59
|
import type { HostedControlPlaneClient } from "../lib/hosted-control-plane.js";
|
|
59
60
|
import type { EnsureSingleSiteOptions } from "./site.js";
|
|
60
61
|
|
|
@@ -82,6 +83,7 @@ export interface Services {
|
|
|
82
83
|
githubAppInstallations: GitHubAppInstallationsService;
|
|
83
84
|
telegram: TelegramService;
|
|
84
85
|
textAttachments: TextAttachmentService;
|
|
86
|
+
stats: StatsService;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
export function createServices(
|
|
@@ -197,10 +199,25 @@ export function createServices(
|
|
|
197
199
|
databaseSchema,
|
|
198
200
|
),
|
|
199
201
|
telegram: createTelegramService(db, siteId, databaseSchema),
|
|
202
|
+
stats: createStatsService(db, siteId, databaseSchema, dialect, {
|
|
203
|
+
settings,
|
|
204
|
+
}),
|
|
200
205
|
};
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
export type { SettingsService } from "./settings.js";
|
|
209
|
+
export type {
|
|
210
|
+
StatsService,
|
|
211
|
+
StatsOverview,
|
|
212
|
+
StatsPage,
|
|
213
|
+
StatsPageDetail,
|
|
214
|
+
StatsPageRow,
|
|
215
|
+
StatsReferrerRow,
|
|
216
|
+
StatsReferrers,
|
|
217
|
+
StatsSeries,
|
|
218
|
+
StatsSeriesPoint,
|
|
219
|
+
StatsWindow,
|
|
220
|
+
} from "./stats.js";
|
|
204
221
|
export type { SiteService } from "./site.js";
|
|
205
222
|
export type { PathService } from "./path.js";
|
|
206
223
|
export type { PostService, PostFilters, PostDeleteDeps } from "./post.js";
|
package/src/services/mcp.ts
CHANGED
|
@@ -168,7 +168,18 @@ const UploadMediaToolSchema = z.object({
|
|
|
168
168
|
blurhash: z.string().max(200).optional(),
|
|
169
169
|
waveform: z.string().max(2000).optional(),
|
|
170
170
|
chars: z.number().int().nonnegative().optional(),
|
|
171
|
-
posterBase64: z
|
|
171
|
+
posterBase64: z
|
|
172
|
+
.string()
|
|
173
|
+
.min(1)
|
|
174
|
+
.optional()
|
|
175
|
+
.describe(
|
|
176
|
+
"Video only: a still for the clip as base64 WebP or PNG, shown in its place in the timeline, share cards, and feeds. Without one, readers' browsers draw a frame from the file.",
|
|
177
|
+
),
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const SetMediaPosterToolSchema = z.object({
|
|
181
|
+
id: MediaIdSchema.describe("Media TypeID of a video"),
|
|
182
|
+
posterBase64: z.string().min(1).describe("The poster as base64 WebP or PNG"),
|
|
172
183
|
});
|
|
173
184
|
|
|
174
185
|
const AddCollectionThreadToolSchema = z.object({
|
|
@@ -632,6 +643,25 @@ const mcpTools: McpToolDefinition[] = [
|
|
|
632
643
|
return serializeMedia(updatedMedia, context.appConfig);
|
|
633
644
|
},
|
|
634
645
|
},
|
|
646
|
+
{
|
|
647
|
+
name: "jant_media_set_poster",
|
|
648
|
+
description:
|
|
649
|
+
"Give a video its poster, or replace the one it has, and return the updated media record.",
|
|
650
|
+
inputSchema: toolInputSchema(SetMediaPosterToolSchema),
|
|
651
|
+
async execute(args, context) {
|
|
652
|
+
const input = SetMediaPosterToolSchema.parse(args ?? {});
|
|
653
|
+
const media = await context.services.media.setPoster(
|
|
654
|
+
input.id,
|
|
655
|
+
decodeBase64Bytes(input.posterBase64, "posterBase64"),
|
|
656
|
+
{ storage: requireStorage(context.storage) },
|
|
657
|
+
);
|
|
658
|
+
if (!media) {
|
|
659
|
+
throw new NotFoundError("Media");
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
return serializeMedia(media, context.appConfig);
|
|
663
|
+
},
|
|
664
|
+
},
|
|
635
665
|
{
|
|
636
666
|
name: "jant_media_delete",
|
|
637
667
|
description: "Delete a media item and its stored object.",
|
|
@@ -749,17 +779,17 @@ const mcpTools: McpToolDefinition[] = [
|
|
|
749
779
|
{
|
|
750
780
|
name: "jant_posts_search",
|
|
751
781
|
description:
|
|
752
|
-
"Search published posts, including private ones. Each result carries its visibility.",
|
|
782
|
+
"Search published posts, including unlisted and private ones. Each result carries its visibility.",
|
|
753
783
|
inputSchema: toolInputSchema(SearchPostsToolSchema),
|
|
754
784
|
async execute(args, context) {
|
|
755
785
|
const input = SearchPostsToolSchema.parse(args ?? {});
|
|
756
|
-
// The author's search, the same as `GET /api/search`:
|
|
757
|
-
// match, and each result says which visibility it has, so
|
|
758
|
-
// tell before linking one.
|
|
786
|
+
// The author's search, the same as `GET /api/search`: unlisted and
|
|
787
|
+
// private posts match, and each result says which visibility it has, so
|
|
788
|
+
// an agent can tell before linking one.
|
|
759
789
|
const results = await context.services.search.search(input.q, {
|
|
760
790
|
limit: input.limit,
|
|
761
791
|
status: ["published"],
|
|
762
|
-
|
|
792
|
+
asAuthor: true,
|
|
763
793
|
});
|
|
764
794
|
|
|
765
795
|
return {
|
package/src/services/media.ts
CHANGED
|
@@ -25,8 +25,12 @@ import { markdownToTiptapJson } from "../lib/markdown-to-tiptap.js";
|
|
|
25
25
|
import { extractBodyText } from "../lib/summary.js";
|
|
26
26
|
import { now } from "../lib/time.js";
|
|
27
27
|
import { supportsCopy, type StorageDriver } from "../lib/storage.js";
|
|
28
|
+
import { generateRandomId } from "../lib/nanoid.js";
|
|
28
29
|
import {
|
|
30
|
+
detectPosterMimeType,
|
|
29
31
|
generateStorageKey,
|
|
32
|
+
getPosterExtension,
|
|
33
|
+
getPosterStorageKey,
|
|
30
34
|
imageExtensionForMimeType,
|
|
31
35
|
isAllowedSideloadImageType,
|
|
32
36
|
SITE_ASSET_STORAGE_KEY_LIKE_PATTERN,
|
|
@@ -314,6 +318,24 @@ export interface MediaService {
|
|
|
314
318
|
attachToPost(postId: string, mediaIds: string[]): Promise<void>;
|
|
315
319
|
detachFromPost(postId: string): Promise<void>;
|
|
316
320
|
updateAlt(id: string, alt: string): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Give a video its poster, or replace the one it has: the still that stands
|
|
323
|
+
* in for the clip in the timeline, share cards, and feeds. A replacement
|
|
324
|
+
* goes to a new key and the old object is deleted, since posters are served
|
|
325
|
+
* `immutable` and one rewritten in place would stay stale in caches.
|
|
326
|
+
*
|
|
327
|
+
* @param id - Media record ID
|
|
328
|
+
* @param bytes - The poster, as WebP or PNG bytes
|
|
329
|
+
* @param deps.storage - Storage driver the poster is written to
|
|
330
|
+
* @returns The updated record, or null when there is no such media
|
|
331
|
+
* @throws ValidationError when the media is not a video, or the bytes are
|
|
332
|
+
* neither WebP nor PNG
|
|
333
|
+
*/
|
|
334
|
+
setPoster(
|
|
335
|
+
id: string,
|
|
336
|
+
bytes: Uint8Array,
|
|
337
|
+
deps: { storage: StorageDriver },
|
|
338
|
+
): Promise<Media | null>;
|
|
317
339
|
}
|
|
318
340
|
|
|
319
341
|
export interface CreateMediaData {
|
|
@@ -954,6 +976,47 @@ export function createMediaService(
|
|
|
954
976
|
.where(and(eq(media.siteId, siteId), eq(media.id, id)));
|
|
955
977
|
},
|
|
956
978
|
|
|
979
|
+
async setPoster(id, bytes, { storage }) {
|
|
980
|
+
const record = await this.getById(id);
|
|
981
|
+
if (!record) return null;
|
|
982
|
+
|
|
983
|
+
if (!record.mimeType.startsWith("video/")) {
|
|
984
|
+
throw new ValidationError(
|
|
985
|
+
`Only a video takes a poster. This media is ${record.mimeType}.`,
|
|
986
|
+
);
|
|
987
|
+
}
|
|
988
|
+
const contentType = detectPosterMimeType(bytes);
|
|
989
|
+
if (!contentType) {
|
|
990
|
+
throw new ValidationError(
|
|
991
|
+
"Unsupported poster format. Only WebP and PNG are accepted.",
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
const previousKey = record.posterKey;
|
|
996
|
+
const posterKey = getPosterStorageKey(
|
|
997
|
+
siteId,
|
|
998
|
+
id,
|
|
999
|
+
getPosterExtension(contentType),
|
|
1000
|
+
previousKey ? generateRandomId(8) : undefined,
|
|
1001
|
+
);
|
|
1002
|
+
await storage.put(posterKey, bytes, { contentType });
|
|
1003
|
+
await db
|
|
1004
|
+
.update(media)
|
|
1005
|
+
.set({ posterKey, updatedAt: now() })
|
|
1006
|
+
.where(and(eq(media.siteId, siteId), eq(media.id, id)));
|
|
1007
|
+
|
|
1008
|
+
if (previousKey && previousKey !== posterKey) {
|
|
1009
|
+
// The poster is derived from the clip, so the one it replaces goes
|
|
1010
|
+
// straight away rather than through the recycle window.
|
|
1011
|
+
await storage.delete(previousKey).catch((err) => {
|
|
1012
|
+
// eslint-disable-next-line no-console -- Error logging is intentional
|
|
1013
|
+
console.error("Storage delete error:", err);
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
return this.getById(id);
|
|
1018
|
+
},
|
|
1019
|
+
|
|
957
1020
|
async delete(id, storage) {
|
|
958
1021
|
const record = await this.getById(id);
|
|
959
1022
|
if (!record) return false;
|
|
@@ -32,6 +32,7 @@ import type {
|
|
|
32
32
|
NavigationPageCandidate,
|
|
33
33
|
} from "../types.js";
|
|
34
34
|
import { SYSTEM_NAV_KEYS } from "../types.js";
|
|
35
|
+
import { isListedForReader } from "../types/constants.js";
|
|
35
36
|
|
|
36
37
|
const POSITION_RETRY_ATTEMPTS = 5;
|
|
37
38
|
const SUGGESTED_NAV_LINK_CANDIDATES = [
|
|
@@ -47,6 +48,7 @@ export interface ListSuggestedLinksOptions {
|
|
|
47
48
|
// Re-export shared constraint detection — see db/dialect.ts
|
|
48
49
|
import { isUniqueConstraintError } from "../db/dialect.js";
|
|
49
50
|
import {
|
|
51
|
+
buildListedForReaderCondition,
|
|
50
52
|
buildReaderVisibilityConditions,
|
|
51
53
|
type ReaderVisibilityOptions,
|
|
52
54
|
} from "../db/post-visibility.js";
|
|
@@ -85,6 +87,8 @@ export type NavTargetResolution =
|
|
|
85
87
|
| { status: "unpublished" }
|
|
86
88
|
/** Published but private: a menu entry nobody could open. */
|
|
87
89
|
| { status: "private" }
|
|
90
|
+
/** Published but unlisted: a menu entry would list it on every page. */
|
|
91
|
+
| { status: "unlisted" }
|
|
88
92
|
| { status: "not_found" };
|
|
89
93
|
|
|
90
94
|
export interface NavTargetCollection {
|
|
@@ -286,7 +290,7 @@ export function createNavItemService(
|
|
|
286
290
|
inArray(posts.translationGroupId, groupIds),
|
|
287
291
|
eq(posts.language, language),
|
|
288
292
|
eq(posts.status, "published"),
|
|
289
|
-
|
|
293
|
+
buildListedForReaderCondition(posts.visibility),
|
|
290
294
|
isNull(posts.replyToId),
|
|
291
295
|
sql`trim(${posts.title}) != ''`,
|
|
292
296
|
),
|
|
@@ -430,7 +434,7 @@ export function createNavItemService(
|
|
|
430
434
|
eq(posts.id, data.postId),
|
|
431
435
|
eq(posts.format, "note"),
|
|
432
436
|
eq(posts.status, "published"),
|
|
433
|
-
|
|
437
|
+
buildListedForReaderCondition(posts.visibility),
|
|
434
438
|
isNull(posts.replyToId),
|
|
435
439
|
sql`trim(${posts.title}) != ''`,
|
|
436
440
|
),
|
|
@@ -590,7 +594,7 @@ export function createNavItemService(
|
|
|
590
594
|
eq(posts.siteId, siteId),
|
|
591
595
|
eq(posts.format, "note"),
|
|
592
596
|
eq(posts.status, "published"),
|
|
593
|
-
|
|
597
|
+
buildListedForReaderCondition(posts.visibility),
|
|
594
598
|
isNull(posts.replyToId),
|
|
595
599
|
sql`trim(${posts.title}) != ''`,
|
|
596
600
|
isNull(navItems.id),
|
|
@@ -710,6 +714,7 @@ export function createNavItemService(
|
|
|
710
714
|
|
|
711
715
|
if (row.status !== "published") return { status: "unpublished" };
|
|
712
716
|
if (row.visibility === "private") return { status: "private" };
|
|
717
|
+
if (row.visibility === "unlisted") return { status: "unlisted" };
|
|
713
718
|
const title = row.title?.trim() ?? "";
|
|
714
719
|
if (!title) return { status: "untitled" };
|
|
715
720
|
|
|
@@ -1054,7 +1059,7 @@ export function createNavItemService(
|
|
|
1054
1059
|
!post ||
|
|
1055
1060
|
post.format !== "note" ||
|
|
1056
1061
|
post.status !== "published" ||
|
|
1057
|
-
post.visibility
|
|
1062
|
+
!isListedForReader(post.visibility ?? "public") ||
|
|
1058
1063
|
post.replyToId !== null ||
|
|
1059
1064
|
!post.title?.trim()
|
|
1060
1065
|
) {
|