@jant/core 0.10.0 → 0.11.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/db/execute-file.js +1 -1
- package/bin/commands/db/export.js +1 -1
- package/bin/commands/migrate.js +4 -4
- package/bin/commands/posts/rebuild-html.js +1 -1
- package/bin/commands/reset-password.js +1 -1
- package/bin/commands/search/reindex.js +1 -1
- package/bin/commands/setup.js +4 -2
- package/bin/commands/site/export.js +3 -0
- package/bin/commands/site/import.js +178 -91
- package/bin/commands/site/pull-media.js +3 -2
- package/bin/commands/site/snapshot/export.js +3 -1
- package/bin/commands/site/snapshot/import.js +3 -2
- package/bin/commands/start.js +44 -0
- package/bin/commands/telegram/register-webhooks.js +1 -1
- package/bin/commands/uploads/cleanup.js +48 -9
- package/bin/jant.js +39 -4
- package/bin/lib/import-sources.js +151 -0
- package/bin/lib/node-env.js +14 -9
- package/bin/lib/runtime-target.js +1 -1
- package/bin/lib/site-pull-media.js +56 -4
- package/bin/lib/site-snapshot.js +39 -2
- package/bin/lib/sql-export.js +66 -10
- package/dist/{app-DIVtyB4m.js → app-jQI4OPRe.js} +5055 -4448
- package/dist/client/.vite/manifest.json +38 -38
- package/dist/client/_assets/chunks/{create-editor-B-m7X7S5.js → create-editor-5Y49x7h5.js} +2 -2
- package/dist/client/_assets/chunks/{footnote-rail-CmeoVtnU.js → footnote-rail-BJwswtVQ.js} +1 -1
- package/dist/client/_assets/chunks/{settings-paths-C-ZZBTau.js → settings-paths-h6RjIe3C.js} +2 -2
- package/dist/client/_assets/chunks/{slug-format-BcIsNKz-.js → slug-format-Dsi0e9Xn.js} +1 -1
- package/dist/client/_assets/chunks/{slugify-373citbs.js → slugify-DlHLyUHS.js} +1 -1
- package/dist/client/_assets/chunks/sortable-list-DYMcJrlS.js +2 -0
- package/dist/client/_assets/chunks/unsafe-svg-DxrzM_Gb.js +2 -0
- package/dist/client/_assets/client-52vQhZAv.js +296 -0
- package/dist/client/_assets/client-BaqmpPQ-.css +2 -0
- package/dist/client/_assets/{client-auth-BpkkKTsV.js → client-auth-BDcCR6u1.js} +2 -2
- package/dist/client/_assets/client-author-CGVvrNZ8.css +2 -0
- package/dist/client/_assets/{client-compose-C-DXzcFR.js → client-compose-CzEwT5qX.js} +4 -4
- package/dist/client/_assets/{client-manage-BfT7ht4M.js → client-manage-CF7x21L4.js} +37 -37
- package/dist/client/_assets/{client-settings-CGR_nZ78.js → client-settings-DIM44Zqh.js} +2 -2
- package/dist/{url-CKlGzvdN.js → constants-DEgyqWDl.js} +340 -1
- package/dist/index.d.ts +44 -0
- package/dist/index.js +33 -1
- package/dist/node.js +57 -13
- package/package.json +13 -18
- package/src/__tests__/api-docs.test.ts +168 -1
- package/src/__tests__/bin/import-sources.test.ts +85 -0
- package/src/__tests__/bin/uploads-cleanup.test.ts +66 -26
- package/src/__tests__/cli-commands.test.ts +40 -0
- package/src/__tests__/config-docs.test.ts +119 -16
- package/src/__tests__/custom-url-redirects.test.ts +108 -0
- package/src/__tests__/export-collection-custom-urls.test.ts +69 -0
- package/src/__tests__/export-docs.test.ts +113 -41
- package/src/__tests__/export-feed-ids.test.ts +1 -0
- package/src/__tests__/export-format-version.test.ts +88 -0
- package/src/__tests__/export-hugo-build.test.ts +139 -4
- package/src/__tests__/export-import-roundtrip.test.ts +2 -1
- package/src/__tests__/export-service.test.ts +42 -13
- package/src/__tests__/export-smart-collection.test.ts +1 -1
- package/src/__tests__/feed-docs.test.ts +287 -21
- package/src/__tests__/feed-reply-addresses.test.ts +100 -0
- package/src/__tests__/feeds-disabled.test.ts +98 -0
- package/src/__tests__/fixtures/export-format/1.json +76 -0
- package/src/__tests__/fixtures/export-format/2.json +80 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/README.md +130 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/2thjq/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/2u5e5/_index.md +35 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/41q27/0x4nv/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/41q27/_index.md +44 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/41q27/faqyt/index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/41q27/the-potting-mix-guide-i-keep-rereading/index.md +20 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/5kayp/_index.md +23 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/5ynfs/_index.md +31 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/5ynfs/hu597/index.md +21 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/_index.md +5 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/a-night-heron-field-guide-for-my-walk-folder/_index.md +31 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/a-quiet-saturday-after-a-busy-week/_index.md +36 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/archive/_index.md +8 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/are-na-is-the-only-bookmark-pile-i-still-revisit/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/bought-too-many-lemons-again/_index.md +37 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/city-walks/_index.md +12 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/cleanshot-for-screenshots-ocr-and-screen-recording-on-the-mac/_index.md +33 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/cleanshotmac-shang-de-jie-tu-ocr-lu-ping-gong-ju/_index.md +32 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/co344/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/collections/_index.md +5 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/current-tea-rotation/_index.md +34 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/derek-sivers-still-writes-the-kind-of-internet-i-want-more-of/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/desk-but-better/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/e0kcg/_index.md +22 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/egi3c/_index.md +24 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/evf9j/_index.md +152 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/featured/_index.md +8 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/from-basho/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/from-epictetus/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/from-marcus-aurelius/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/from-seneca/_index.md +26 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/from-thoreau/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/gkbvv/2cl6d/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/gkbvv/3zqv7/index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/gkbvv/5oxsv/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/gkbvv/_index.md +39 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/gwob9/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/home-cooking/_index.md +12 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/hz729/_index.md +24 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/inaturalist-ai-zi-ran-she-qu/_index.md +44 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/j4v0q/_index.md +35 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/k278t/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/k4eee/_index.md +22 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/k5vh8/_index.md +32 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/k5vh8/a-reading-log-idea-i-might-steal/index.md +20 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/k5vh8/a83qu/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/k5vh8/from-seneca-5hibo/index.md +21 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/kan-qi-lai-bi-jiao-ku-de-gong-si-men/_index.md +41 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/l2m7y/_index.md +29 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/lan-ya-yao-kong-qi-chuang-shang-yue-du-de-fan-ye-shen-qi/_index.md +57 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/mynoise-for-rainy-afternoons/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/n09le/_index.md +23 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/ni-fu-jin-de-wei-ji-bai-ke-tiao-mu/_index.md +42 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/nts-archives-are-good-cleaning-music/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/qgfcu/_index.md +32 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/qgfcu/c91j0/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/qgfcu/qyucy/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/qgfcu/wsgck/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/rain-makes-my-neighborhood-look-better/_index.md +46 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/reading-notes/_index.md +12 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/s4r3e/_index.md +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/serious-eats-on-tomato-and-egg-soup/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/te812/_index.md +44 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/te812/cxiu6/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/te812/t77ms/index.md +18 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/te812/the-soup-trick-i-always-forget/index.md +20 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/telk3/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/telk3/from-thoreau-pawt2/index.md +21 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/the-five-minute-reset-is-still-the-best-habit-i-have/_index.md +36 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/the-hallway-light-took-12-minutes-and-3-months/_index.md +32 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/the-recurse-center-manual-is-weirdly-calming/_index.md +30 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/tiny-projects/_index.md +12 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/tong-wang-xing-fu-zhi-lu/_index.md +68 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/tou-ma-yan-jiang-ju-le-bu-chu-ti-yan/_index.md +62 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/useful-links/_index.md +12 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/weekend-notes/_index.md +12 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/content/what-i-actually-use-my-notebook-for/_index.md +52 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/data/jant.toml +124 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/hugo.toml +45 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/_redirects +25 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/40bc6cd1f12e-med_01kn8jtq3penf98tfq4gzmh9g9.png +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jtx8qenf98tm9ahxr48sw.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jv0jdenf98tp6qr9zgjjc.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jv452enf98trbkwrvhvgd.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jvb16enf98txp7p0pf5ge.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jve5nenf98tzap11gpxzr.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jvq58enf98v538w5vsqp4.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jvsaeenf98v6ct4gjzppc.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01kn8jw26cenf98vc7k0ppz5k8.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m313q1hme4e8cmby77dn66yy.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m313q2w7e4e8cmc20036yh66.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m313q7d2e4e8cmdeqjmyafby.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m313q887e4e8cmdjssych7yh.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167jx2f6ct88pkz45j3ycp-poster.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167jx2f6ct88pkz45j3ycp.mp4 +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167mbdf6ct88pr4ga1b9kf-poster.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167mbdf6ct88pr4ga1b9kf.mp4 +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167nsvf6ct88q1anhz4svb-poster.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167nsvf6ct88q1anhz4svb.mp4 +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167qaxf6ct88qfndwzxx83-poster.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167qaxf6ct88qfndwzxx83.mp4 +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167sm0f6ct88qw5brtsgcw.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167tf8f6ct88r169s51j49.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167vaaf6ct88rbx5ztenwb.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167w51f6ct88rp19pybkw1.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167x0nf6ct88rzajb84tw3.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167xxbf6ct88s5t2300bjk.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167yq5f6ct88s9pjwt5fxg.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/static/media/med_01m3167zg4f6ct88sge8jp28ja.webp +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/themes/jant/static/apple-touch-icon.png +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/themes/jant/static/custom.css +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/themes/jant/static/favicon.ico +0 -0
- package/src/__tests__/fixtures/releases/0.10.0/site-export/wrangler.jsonc +24 -0
- package/src/__tests__/fixtures/releases/0.10.0/snapshot/db.sql +322 -0
- package/src/__tests__/fixtures/releases/0.10.0/snapshot/meta.json +11 -0
- package/src/__tests__/helpers/app.ts +6 -1
- package/src/__tests__/helpers/export-fixtures.ts +1 -0
- package/src/__tests__/import-refused-aliases.test.ts +98 -0
- package/src/__tests__/import-site-command.test.ts +73 -8
- package/src/__tests__/public-types.test.ts +64 -0
- package/src/__tests__/release-fixtures.test.ts +79 -24
- package/src/__tests__/release-version.test.ts +84 -0
- package/src/__tests__/site-pull-media.test.ts +48 -0
- package/src/__tests__/snapshot-tables.test.ts +37 -0
- package/src/__tests__/sql-export.test.ts +21 -1
- package/src/__tests__/stored-file-headers.test.ts +94 -0
- package/src/__tests__/template-deploy-workflow.test.ts +101 -0
- package/src/__tests__/theme-docs.test.ts +113 -24
- package/src/__tests__/toolchain-versions.test.ts +54 -0
- package/src/__tests__/trailing-slash-redirect.test.ts +61 -0
- package/src/__tests__/vite-config-graph.test.ts +98 -0
- package/src/app.tsx +89 -66
- package/src/client/__tests__/compose-bridge-image-upload.test.ts +1 -0
- package/src/client/__tests__/compose-bridge.test.ts +87 -0
- package/src/client/__tests__/compose-shortcuts.test.ts +4 -4
- package/src/client/__tests__/footnote-rail.test.ts +1 -1
- package/src/client/__tests__/lazy-entries.test.ts +1 -1
- package/src/client/__tests__/media-scroll-hint.test.ts +2 -2
- package/src/client/avatar-upload.ts +10 -10
- package/src/client/components/__tests__/jant-compose-dialog.test.ts +295 -4
- package/src/client/components/__tests__/jant-compose-editor.test.ts +34 -0
- package/src/client/components/__tests__/jant-settings-general.test.ts +0 -32
- package/src/client/components/compose-types.ts +14 -0
- package/src/client/components/jant-compose-dialog.ts +96 -41
- package/src/client/components/jant-compose-editor.ts +21 -4
- package/src/client/components/jant-config-editor.ts +4 -6
- package/src/client/components/jant-media-lightbox.ts +4 -4
- package/src/client/components/jant-settings-general.ts +0 -4
- package/src/client/components/nav-manager-types.ts +6 -5
- package/src/client/compose-bridge.ts +15 -4
- package/src/client/compose-launch.ts +4 -6
- package/src/client/compose-shortcuts.ts +1 -1
- package/src/client/footnote-rail.ts +1 -1
- package/src/client/lazy-entries.ts +1 -1
- package/src/client/media-scroll-hint.ts +2 -2
- package/src/client/tiptap/__tests__/markdown-clipboard.test.ts +55 -0
- package/src/client/tiptap/markdown-clipboard.ts +50 -2
- package/src/client/upload-session.ts +7 -6
- package/src/db/__tests__/backfill-external-redirects.test.ts +59 -0
- package/src/db/__tests__/backfill-featured-discover.test.ts +56 -0
- package/src/db/backfills/0007_restore_external_redirect_scheme.sql +20 -0
- package/src/db/backfills/0008_turn_off_featured_only_discover.sql +11 -0
- package/src/i18n/locales/public/en.po +46 -48
- package/src/i18n/locales/public/en.ts +1 -1
- package/src/i18n/locales/public/zh-Hans.po +45 -46
- package/src/i18n/locales/public/zh-Hans.ts +1 -1
- package/src/i18n/locales/public/zh-Hant.po +45 -46
- package/src/i18n/locales/public/zh-Hant.ts +1 -1
- package/src/i18n/locales/settings/en.po +15 -29
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +15 -29
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +15 -29
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/index.ts +43 -2
- package/src/lib/__tests__/api-settings.test.ts +3 -3
- package/src/lib/__tests__/constants.test.ts +10 -0
- package/src/lib/__tests__/discover.test.ts +8 -9
- package/src/lib/__tests__/env-values.test.ts +125 -0
- package/src/lib/__tests__/feed-path.test.ts +29 -0
- package/src/lib/__tests__/feed.test.ts +50 -22
- package/src/lib/__tests__/filter-dimensions.test.ts +22 -8
- package/src/lib/__tests__/post-list-cursor.test.ts +0 -10
- package/src/lib/__tests__/rate-limit.test.ts +22 -7
- package/src/lib/__tests__/resolve-config.test.ts +5 -3
- package/src/lib/__tests__/schemas.test.ts +72 -23
- package/src/lib/__tests__/slugify.test.ts +9 -0
- package/src/lib/__tests__/startup-config.test.ts +12 -0
- package/src/lib/__tests__/storage-s3.test.ts +214 -0
- package/src/lib/__tests__/theme.test.ts +20 -1
- package/src/lib/__tests__/time.test.ts +56 -0
- package/src/lib/__tests__/timeline.test.ts +46 -0
- package/src/lib/__tests__/url-fetch.test.ts +65 -1
- package/src/lib/__tests__/url.test.ts +60 -1
- package/src/lib/api-nav-items.ts +16 -20
- package/src/lib/api-post-input.ts +34 -1
- package/src/lib/api-posts.ts +125 -23
- package/src/lib/api-public-posts.ts +28 -37
- package/src/lib/api-search.ts +49 -2
- package/src/lib/api-settings.ts +159 -54
- package/src/lib/api-threads.ts +34 -11
- package/src/lib/constants.ts +6 -0
- package/src/lib/discover.ts +7 -23
- package/src/lib/env-values.ts +140 -0
- package/src/lib/env.ts +203 -12
- package/src/lib/feed-path.ts +8 -2
- package/src/lib/feed-policy.ts +110 -7
- package/src/lib/feed.ts +69 -25
- package/src/lib/filter-dimensions.ts +17 -10
- package/src/lib/github-sync-site-config.ts +1 -0
- package/src/lib/hugo-markdown.ts +5 -6
- package/src/lib/navigation.ts +4 -1
- package/src/lib/post-list-cursor.ts +33 -29
- package/src/lib/public-storage.ts +43 -0
- package/src/lib/rate-limit.ts +31 -16
- package/src/lib/render.tsx +5 -0
- package/src/lib/resolve-config.ts +16 -19
- package/src/lib/schemas.ts +248 -180
- package/src/lib/slugify.ts +6 -1
- package/src/lib/sse.ts +1 -1
- package/src/lib/startup-config.ts +20 -1
- package/src/lib/theme.ts +8 -5
- package/src/lib/thread-fold.ts +6 -0
- package/src/lib/thread-query.ts +19 -24
- package/src/lib/time.ts +137 -17
- package/src/lib/timeline.ts +56 -13
- package/src/lib/url-fetch.ts +141 -40
- package/src/lib/url.ts +86 -1
- package/src/middleware/__tests__/auth.test.ts +27 -0
- package/src/middleware/__tests__/cors.test.ts +54 -0
- package/src/middleware/__tests__/cross-origin.test.ts +149 -0
- package/src/middleware/__tests__/public-content-access.test.ts +2 -42
- package/src/middleware/auth.ts +34 -3
- package/src/middleware/cors.ts +4 -4
- package/src/middleware/cross-origin.ts +124 -0
- package/src/middleware/error-handler.ts +7 -0
- package/src/middleware/public-content-access.ts +3 -26
- package/src/middleware/secure-headers.ts +8 -2
- package/src/node/__tests__/cli-migrate.test.ts +2 -2
- package/src/node/__tests__/cli-runtime-target.test.ts +13 -2
- package/src/node/__tests__/cli-site-snapshot.test.ts +57 -0
- package/src/node/__tests__/cli-snapshot-meta.test.ts +11 -1
- package/src/node/__tests__/cli-sql-export.test.ts +25 -1
- package/src/node/__tests__/cli-start.test.ts +66 -0
- package/src/node/__tests__/request-handler.test.ts +37 -0
- package/src/node/__tests__/runtime.test.ts +56 -1
- package/src/node/request-handler.ts +58 -5
- package/src/node/runtime.ts +37 -11
- package/src/preset.css +3 -3
- package/src/routes/__tests__/compose.test.ts +84 -0
- package/src/routes/api/__tests__/collections.test.ts +68 -0
- package/src/routes/api/__tests__/mcp.test.ts +164 -9
- package/src/routes/api/__tests__/media.test.ts +9 -1
- package/src/routes/api/__tests__/nav-items.test.ts +27 -1
- package/src/routes/api/__tests__/posts.test.ts +269 -78
- package/src/routes/api/__tests__/search.test.ts +17 -4
- package/src/routes/api/__tests__/settings.test.ts +119 -85
- package/src/routes/api/__tests__/telegram.test.ts +11 -6
- package/src/routes/api/__tests__/threads.test.ts +11 -0
- package/src/routes/api/__tests__/upload-response.test.ts +48 -0
- package/src/routes/api/__tests__/uploads.test.ts +35 -2
- package/src/routes/api/collections.ts +3 -3
- package/src/routes/api/custom-urls.ts +2 -1
- package/src/routes/api/export.ts +1 -0
- package/src/routes/api/internal/__tests__/post-body-html.test.ts +19 -0
- package/src/routes/api/internal/__tests__/uploads.test.ts +2 -0
- package/src/routes/api/internal/sites.ts +16 -4
- package/src/routes/api/mcp.ts +1 -0
- package/src/routes/api/media.ts +7 -8
- package/src/routes/api/nav-items.ts +2 -1
- package/src/routes/api/posts.ts +18 -24
- package/src/routes/api/public/__tests__/posts.test.ts +15 -0
- package/src/routes/api/public/__tests__/threads-collections.test.ts +12 -45
- package/src/routes/api/public/__tests__/threads.test.ts +41 -9
- package/src/routes/api/public/posts.ts +2 -2
- package/src/routes/api/public/threads.ts +16 -26
- package/src/routes/api/search.ts +7 -41
- package/src/routes/api/settings.ts +32 -28
- package/src/routes/api/smart-collections.ts +6 -1
- package/src/routes/api/threads.ts +25 -26
- package/src/routes/api/upload.ts +6 -21
- package/src/routes/api/uploads.ts +14 -20
- package/src/routes/auth/__tests__/dev.test.ts +16 -13
- package/src/routes/auth/__tests__/hosted-sso.test.ts +51 -0
- package/src/routes/auth/__tests__/setup-auth.test.ts +2 -0
- package/src/routes/auth/__tests__/setup-discover.test.ts +2 -0
- package/src/routes/auth/__tests__/setup-flow.test.ts +32 -0
- package/src/routes/auth/__tests__/setup-rate-limit.test.ts +72 -0
- package/src/routes/auth/__tests__/setup-steps.test.ts +2 -0
- package/src/routes/auth/__tests__/signin.test.ts +167 -2
- package/src/routes/auth/dev.ts +4 -6
- package/src/routes/auth/hosted-sso.ts +9 -6
- package/src/routes/auth/setup.tsx +35 -5
- package/src/routes/auth/signin.tsx +96 -1
- package/src/routes/compose.tsx +47 -47
- package/src/routes/dash/__tests__/settings-avatar.test.ts +59 -4
- package/src/routes/dash/__tests__/settings-demo-locks.test.ts +147 -0
- package/src/routes/dash/custom-urls.tsx +2 -0
- package/src/routes/dash/settings.tsx +79 -32
- package/src/routes/feed/__tests__/feed.test.ts +93 -3
- package/src/routes/feed/__tests__/sitemap.test.ts +42 -0
- package/src/routes/feed/feed.ts +128 -175
- package/src/routes/feed/sitemap.ts +9 -7
- package/src/routes/pages/__tests__/archive-years.test.ts +45 -0
- package/src/routes/pages/__tests__/collection-routing.test.ts +40 -0
- package/src/routes/pages/__tests__/collections.test.ts +3 -0
- package/src/routes/pages/__tests__/language-routing.test.ts +31 -0
- package/src/routes/pages/__tests__/post-page-round-trips.test.ts +34 -2
- package/src/routes/pages/__tests__/search.test.ts +5 -2
- package/src/routes/pages/__tests__/thread-gap.test.ts +207 -0
- package/src/routes/pages/archive.tsx +33 -94
- package/src/routes/pages/brand.tsx +1 -0
- package/src/routes/pages/collection.tsx +13 -84
- package/src/routes/pages/collections.tsx +2 -0
- package/src/routes/pages/featured.tsx +7 -2
- package/src/routes/pages/home.tsx +1 -0
- package/src/routes/pages/latest.tsx +6 -2
- package/src/routes/pages/new.tsx +1 -0
- package/src/routes/pages/page.tsx +73 -47
- package/src/routes/pages/search.tsx +5 -3
- package/src/routes/pages/smart-collection.tsx +11 -70
- package/src/routes/pages/subscribe.tsx +1 -0
- package/src/routes/pages/theme-sample.tsx +1 -0
- package/src/runtime/__tests__/readiness.test.ts +16 -0
- package/src/runtime/cloudflare.ts +2 -3
- package/src/runtime/index.ts +3 -1
- package/src/runtime/node.ts +3 -5
- package/src/runtime/readiness.ts +5 -0
- package/src/services/__tests__/auth.test.ts +115 -0
- package/src/services/__tests__/collection.test.ts +9 -0
- package/src/services/__tests__/github-sync-webhook.test.ts +78 -0
- package/src/services/__tests__/hosted-handoff.test.ts +208 -1
- package/src/services/__tests__/media.test.ts +47 -27
- package/src/services/__tests__/navigation.test.ts +67 -15
- package/src/services/__tests__/post.test.ts +103 -56
- package/src/services/__tests__/search.test.ts +38 -0
- package/src/services/__tests__/settings.test.ts +2 -14
- package/src/services/__tests__/smart-collection.test.ts +2 -2
- package/src/services/__tests__/telegram-ingest.test.ts +113 -0
- package/src/services/__tests__/thread.test.ts +26 -11
- package/src/services/auth.ts +36 -4
- package/src/services/collection.ts +46 -5
- package/src/services/custom-url.ts +11 -4
- package/src/services/export-theme/assets/client-site.css +1 -1
- package/src/services/export-theme/assets/client-site.js +2 -2
- package/src/services/export-theme/layouts/_default/baseof.html +1 -1
- package/src/services/export-theme/layouts/collection/single.html +1 -1
- package/src/services/export-theme/layouts/partials/featured-thread.html +8 -1
- package/src/services/export-theme/layouts/partials/head.html +1 -1
- package/src/services/export-theme/layouts/partials/media-gallery.html +6 -3
- package/src/services/export-theme/layouts/smart_collection/list.html +1 -1
- package/src/services/export-theme/styles/main.css +3 -3
- package/src/services/export.ts +68 -19
- package/src/services/github-sync.ts +10 -10
- package/src/services/hosted-handoff.ts +106 -6
- package/src/services/index.ts +3 -1
- package/src/services/language.ts +33 -0
- package/src/services/mcp.ts +176 -438
- package/src/services/media.ts +69 -21
- package/src/services/navigation.ts +19 -4
- package/src/services/path.ts +45 -3
- package/src/services/post.ts +329 -214
- package/src/services/search.ts +22 -3
- package/src/services/settings.ts +36 -3
- package/src/services/site-admin.ts +1 -0
- package/src/services/smart-collection.ts +10 -3
- package/src/services/telegram.ts +23 -6
- package/src/services/thread.ts +11 -3
- package/src/services/upload-session.ts +14 -15
- package/src/styles/components.css +2 -2
- package/src/styles/site-media.css +2 -2
- package/src/styles/tokens.css +19 -22
- package/src/styles/ui-author.css +73 -94
- package/src/styles/ui.css +62 -62
- package/src/types/app-context.ts +5 -1
- package/src/types/bindings.ts +11 -0
- package/src/types/config.ts +4 -4
- package/src/types/constants.ts +20 -0
- package/src/types/props.ts +34 -8
- package/src/types/views.ts +28 -13
- package/src/ui/color-themes.ts +6 -5
- package/src/ui/dash/settings/GeneralContent.tsx +0 -22
- package/src/ui/dash/settings/__tests__/GeneralContent.test.tsx +0 -21
- package/src/ui/feed/CuratedThreadPreview.tsx +7 -2
- package/src/ui/feed/LinkCard.tsx +1 -2
- package/src/ui/feed/NoteCard.tsx +1 -2
- package/src/ui/feed/QuoteCard.tsx +2 -2
- package/src/ui/feed/ThreadPreview.tsx +6 -6
- package/src/ui/feed/TimelineFeed.tsx +1 -7
- package/src/ui/feed/__tests__/thread-preview.test.ts +123 -10
- package/src/ui/feed/__tests__/timeline-cards.test.ts +18 -1
- package/src/ui/layouts/BaseLayout.tsx +5 -0
- package/src/ui/pages/ArchivePage.tsx +1 -1
- package/src/ui/pages/BrandPage.tsx +1 -1
- package/src/ui/pages/CollectionPage.tsx +0 -1
- package/src/ui/pages/CollectionsPage.tsx +2 -2
- package/src/ui/pages/ComposePage.tsx +1 -1
- package/src/ui/pages/FeaturedPage.tsx +1 -1
- package/src/ui/pages/HomePage.tsx +1 -1
- package/src/ui/pages/PostPage.tsx +1 -1
- package/src/ui/pages/SearchPage.tsx +1 -1
- package/src/ui/pages/SmartCollectionPage.tsx +2 -3
- package/src/ui/pages/SubscribePage.tsx +1 -1
- package/src/ui/pages/ThemeSamplePage.tsx +1 -1
- package/src/ui/shared/MediaGallery.tsx +1 -1
- package/src/vendor/datastar.js +9 -1956
- package/src/vendor/datastar.js.map +4 -4
- package/dist/client/_assets/chunks/sortable-list-BJyd-LXE.js +0 -2
- package/dist/client/_assets/chunks/unsafe-svg-DU_DNMy5.js +0 -2
- package/dist/client/_assets/client-D4AT9Iqr.js +0 -295
- package/dist/client/_assets/client-DRuw7XCt.css +0 -2
- package/dist/client/_assets/client-author-DQ8R-8KR.css +0 -2
package/bin/commands/start.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { loadNodeRuntime } from "../lib/load-node-runtime.js";
|
|
3
|
+
import { autoloadNodeEnv } from "../lib/node-env.js";
|
|
3
4
|
|
|
4
5
|
export async function run(argv) {
|
|
5
6
|
const { values } = parseArgs({
|
|
@@ -13,6 +14,10 @@ export async function run(argv) {
|
|
|
13
14
|
console.log("Usage: jant start");
|
|
14
15
|
console.log("");
|
|
15
16
|
console.log("Start the Node.js server using environment variables.");
|
|
17
|
+
console.log(
|
|
18
|
+
"Reads `.env` in the current directory, or the file JANT_ENV_FILE",
|
|
19
|
+
);
|
|
20
|
+
console.log("names. Variables already set in the environment win.");
|
|
16
21
|
console.log("");
|
|
17
22
|
console.log("Required:");
|
|
18
23
|
console.log(" AUTH_SECRET=your-secret");
|
|
@@ -40,7 +45,46 @@ export async function run(argv) {
|
|
|
40
45
|
process.exit(0);
|
|
41
46
|
}
|
|
42
47
|
|
|
48
|
+
autoloadNodeEnv();
|
|
43
49
|
const { start } = await loadNodeRuntime();
|
|
44
50
|
const handle = await start();
|
|
51
|
+
closeOnSignal(handle);
|
|
45
52
|
console.log(`Jant listening on ${handle.url}`);
|
|
46
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Close the server and the database when the process is asked to stop.
|
|
57
|
+
*
|
|
58
|
+
* Docker stops a container with SIGTERM, and node runs as PID 1 there, which
|
|
59
|
+
* ignores a signal it has no handler for: without this, the container is
|
|
60
|
+
* killed ten seconds later and SQLite's last writes stay in `jant.sqlite-wal`
|
|
61
|
+
* rather than in `jant.sqlite`, the file a backup copies. Closing the database
|
|
62
|
+
* writes them back. A second signal stops without waiting.
|
|
63
|
+
*
|
|
64
|
+
* @param {{ close(): Promise<void> }} handle - The running server
|
|
65
|
+
* @param {Pick<NodeJS.Process, "on" | "exit">} [target] - The process to watch
|
|
66
|
+
* @returns {void}
|
|
67
|
+
* @example
|
|
68
|
+
* closeOnSignal(await start());
|
|
69
|
+
*/
|
|
70
|
+
export function closeOnSignal(handle, target = process) {
|
|
71
|
+
let closing = false;
|
|
72
|
+
/** @param {NodeJS.Signals} signal */
|
|
73
|
+
const onSignal = (signal) => {
|
|
74
|
+
if (closing) {
|
|
75
|
+
target.exit(1);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
closing = true;
|
|
79
|
+
console.log(`Received ${signal}, closing...`);
|
|
80
|
+
handle.close().then(
|
|
81
|
+
() => target.exit(0),
|
|
82
|
+
(error) => {
|
|
83
|
+
console.error("Failed to close cleanly:", error);
|
|
84
|
+
target.exit(1);
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
target.on("SIGTERM", onSignal);
|
|
89
|
+
target.on("SIGINT", onSignal);
|
|
90
|
+
}
|
|
@@ -34,7 +34,7 @@ function printUsage() {
|
|
|
34
34
|
"If --url is omitted, uses SITE_ORIGIN + SITE_PATH_PREFIX from the environment.",
|
|
35
35
|
);
|
|
36
36
|
console.log("");
|
|
37
|
-
console.log("Environment (also read from .env
|
|
37
|
+
console.log("Environment (also read from .env):");
|
|
38
38
|
console.log(
|
|
39
39
|
" TELEGRAM_BOT_TOKENS Comma-separated <bot_id>:<secret> tokens",
|
|
40
40
|
);
|
|
@@ -3,6 +3,8 @@ import { resolveSiteUrl } from "../../lib/site-url.js";
|
|
|
3
3
|
|
|
4
4
|
const INTERNAL_ADMIN_TOKEN_ENV_VAR = "INTERNAL_ADMIN_TOKEN";
|
|
5
5
|
const DEFAULT_LIMIT = 20;
|
|
6
|
+
/** The largest batch the server runs; a larger `limit` is read as this. */
|
|
7
|
+
const MAX_LIMIT = 200;
|
|
6
8
|
|
|
7
9
|
function normalizeBaseUrl(value) {
|
|
8
10
|
const trimmed = value.trim();
|
|
@@ -22,8 +24,10 @@ function parseLimit(rawLimit) {
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const limit = Number.parseInt(rawLimit, 10);
|
|
25
|
-
if (!Number.isInteger(limit) || limit < 1 || limit >
|
|
26
|
-
throw new Error(
|
|
27
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Cleanup limit must be an integer between 1 and ${MAX_LIMIT}.`,
|
|
30
|
+
);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
return limit;
|
|
@@ -55,6 +59,7 @@ export async function run(argv) {
|
|
|
55
59
|
env: { type: "string" },
|
|
56
60
|
help: { type: "boolean", short: "h" },
|
|
57
61
|
limit: { type: "string" },
|
|
62
|
+
once: { type: "boolean", default: false },
|
|
58
63
|
token: { type: "string" },
|
|
59
64
|
url: { type: "string" },
|
|
60
65
|
},
|
|
@@ -63,11 +68,22 @@ export async function run(argv) {
|
|
|
63
68
|
if (values.help) {
|
|
64
69
|
console.log("Usage: jant uploads cleanup [--url <url>] [options]");
|
|
65
70
|
console.log("");
|
|
66
|
-
console.log(
|
|
71
|
+
console.log(
|
|
72
|
+
"Delete expired upload sessions and their temporary files, and purge",
|
|
73
|
+
);
|
|
74
|
+
console.log(
|
|
75
|
+
"deleted media whose 30-day recycle window has passed. Runs batch after",
|
|
76
|
+
);
|
|
77
|
+
console.log("batch until nothing is left.");
|
|
67
78
|
console.log("");
|
|
68
79
|
console.log("Options:");
|
|
69
80
|
console.log(" --url Target site URL");
|
|
70
|
-
console.log(
|
|
81
|
+
console.log(
|
|
82
|
+
` --limit Cleanup batch size (default: ${DEFAULT_LIMIT}, max: ${MAX_LIMIT})`,
|
|
83
|
+
);
|
|
84
|
+
console.log(
|
|
85
|
+
" --once Run a single batch and exit (default: loop until done)",
|
|
86
|
+
);
|
|
71
87
|
console.log(" --token Internal admin token");
|
|
72
88
|
console.log(
|
|
73
89
|
" --config Wrangler config file (default: wrangler.toml)",
|
|
@@ -113,9 +129,32 @@ export async function run(argv) {
|
|
|
113
129
|
const cleanupUrl = buildCleanupUrl(siteUrl);
|
|
114
130
|
|
|
115
131
|
console.log(`Cleaning expired uploads for ${siteUrl}...`);
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
const totals = {
|
|
133
|
+
deletedSessions: 0,
|
|
134
|
+
abortedMultipartUploads: 0,
|
|
135
|
+
purgedStorageObjects: 0,
|
|
136
|
+
};
|
|
137
|
+
let stalled = false;
|
|
138
|
+
for (;;) {
|
|
139
|
+
const result = await requestCleanup(cleanupUrl, token, limit);
|
|
140
|
+
totals.deletedSessions += result.deletedSessions;
|
|
141
|
+
totals.abortedMultipartUploads += result.abortedMultipartUploads;
|
|
142
|
+
totals.purgedStorageObjects += result.purgedStorageObjects;
|
|
143
|
+
if (values.once || result.done) break;
|
|
144
|
+
// A full batch that removed nothing would come back unchanged next time.
|
|
145
|
+
if (result.deletedSessions === 0 && result.purgedStorageObjects === 0) {
|
|
146
|
+
stalled = true;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
console.log(`Deleted sessions: ${totals.deletedSessions}`);
|
|
152
|
+
console.log(`Aborted multipart uploads: ${totals.abortedMultipartUploads}`);
|
|
153
|
+
console.log(`Purged storage objects: ${totals.purgedStorageObjects}`);
|
|
154
|
+
if (stalled) {
|
|
155
|
+
console.error(
|
|
156
|
+
"Stopped early: the last batch removed nothing, though more is due. The server log says why; the next run tries again.",
|
|
157
|
+
);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
121
160
|
}
|
package/bin/jant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { readdir } from "node:fs/promises";
|
|
3
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { dirname, join, relative } from "node:path";
|
|
6
6
|
import { PUBLIC_COMMAND_GROUPS } from "./lib/command-registry.js";
|
|
@@ -49,13 +49,27 @@ function showHelp() {
|
|
|
49
49
|
}
|
|
50
50
|
console.log("");
|
|
51
51
|
console.log("Run 'jant <command> --help' for command-specific help.");
|
|
52
|
+
console.log("Run 'jant --version' for the installed version.");
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
const argv = process.argv.slice(2);
|
|
55
56
|
const commandStart = argv.findIndex((arg) => !arg.startsWith("-"));
|
|
56
57
|
if (commandStart === -1) {
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const [option] = argv;
|
|
59
|
+
if (option === "--version" || option === "-v") {
|
|
60
|
+
const packageJson = JSON.parse(
|
|
61
|
+
await readFile(join(__dirname, "../package.json"), "utf8"),
|
|
62
|
+
);
|
|
63
|
+
console.log(packageJson.version);
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
if (option === undefined || option === "--help" || option === "-h") {
|
|
67
|
+
showHelp();
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
console.error(`Unknown option: ${option}`);
|
|
71
|
+
console.error("Run 'jant --help' for the list of commands.");
|
|
72
|
+
process.exit(1);
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
const commands = await listCommands();
|
|
@@ -107,6 +121,27 @@ if (!matched) {
|
|
|
107
121
|
process.exit(1);
|
|
108
122
|
}
|
|
109
123
|
|
|
124
|
+
/**
|
|
125
|
+
* The codes `node:util`'s `parseArgs` throws for arguments a command doesn't
|
|
126
|
+
* take. They are the user's mistake, so they get one line and a pointer to the
|
|
127
|
+
* command's help, not a stack trace.
|
|
128
|
+
*/
|
|
129
|
+
const ARGUMENT_ERROR_CODES = new Set([
|
|
130
|
+
"ERR_PARSE_ARGS_UNKNOWN_OPTION",
|
|
131
|
+
"ERR_PARSE_ARGS_INVALID_OPTION_VALUE",
|
|
132
|
+
"ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL",
|
|
133
|
+
]);
|
|
134
|
+
|
|
110
135
|
const commandIndex = commandStart + matched.length - 1;
|
|
111
136
|
const mod = await import(join(commandsDir, `${matched.join("/")}.js`));
|
|
112
|
-
|
|
137
|
+
try {
|
|
138
|
+
await mod.run(argv.slice(commandIndex + 1));
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (!ARGUMENT_ERROR_CODES.has(error?.code)) throw error;
|
|
141
|
+
// parseArgs appends its own advice about `--`, which names none of Jant's
|
|
142
|
+
// options; the first sentence is the part that says what went wrong.
|
|
143
|
+
const [reason] = String(error.message).split(/\. (?=To specify|Did you)/);
|
|
144
|
+
console.error(`Error: ${reason.replace(/\.$/, "")}.`);
|
|
145
|
+
console.error(`Run 'jant ${matched.join(" ")} --help' for its options.`);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where `jant site import` may read an export's files from.
|
|
3
|
+
*
|
|
4
|
+
* An export is a directory or archive someone else may have written, and its
|
|
5
|
+
* front matter names the files to upload. A path in it must stay inside the
|
|
6
|
+
* export, or `../../.ssh/id_rsa` is read and published as an attachment; a
|
|
7
|
+
* remote URL must be a public address, or the import fetches from the
|
|
8
|
+
* machine's own network and publishes what it finds.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { lookup } from "node:dns/promises";
|
|
12
|
+
import { BlockList, isIP } from "node:net";
|
|
13
|
+
import { relative, resolve, isAbsolute } from "node:path";
|
|
14
|
+
|
|
15
|
+
const MAX_REDIRECTS = 3;
|
|
16
|
+
|
|
17
|
+
/** Every address range an import must not fetch from. */
|
|
18
|
+
const PRIVATE_ADDRESSES = new BlockList();
|
|
19
|
+
for (const [network, prefix] of [
|
|
20
|
+
["0.0.0.0", 8],
|
|
21
|
+
["10.0.0.0", 8],
|
|
22
|
+
["100.64.0.0", 10],
|
|
23
|
+
["127.0.0.0", 8],
|
|
24
|
+
["169.254.0.0", 16],
|
|
25
|
+
["172.16.0.0", 12],
|
|
26
|
+
["192.0.0.0", 24],
|
|
27
|
+
["192.168.0.0", 16],
|
|
28
|
+
["198.18.0.0", 15],
|
|
29
|
+
["224.0.0.0", 3],
|
|
30
|
+
]) {
|
|
31
|
+
PRIVATE_ADDRESSES.addSubnet(network, prefix, "ipv4");
|
|
32
|
+
}
|
|
33
|
+
// An IPv4-mapped address (::ffff:a.b.c.d) is checked against the IPv4 rules
|
|
34
|
+
// above on its own; a `::ffff:0:0/96` rule would match every IPv4 address.
|
|
35
|
+
for (const [network, prefix] of [
|
|
36
|
+
// IPv4-compatible (covering :: and ::1), then the forms that carry an IPv4
|
|
37
|
+
// address inside: NAT64, 6to4, Teredo.
|
|
38
|
+
["::", 96],
|
|
39
|
+
["64:ff9b::", 96],
|
|
40
|
+
["64:ff9b:1::", 48],
|
|
41
|
+
["2002::", 16],
|
|
42
|
+
["2001::", 32],
|
|
43
|
+
["2001:db8::", 32],
|
|
44
|
+
["fe80::", 10],
|
|
45
|
+
["fc00::", 7],
|
|
46
|
+
["ff00::", 8],
|
|
47
|
+
]) {
|
|
48
|
+
PRIVATE_ADDRESSES.addSubnet(network, prefix, "ipv6");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Resolves a path from an export against a directory, refusing one that
|
|
53
|
+
* leaves it.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} root - Directory the path must stay inside
|
|
56
|
+
* @param {...string} segments - Path segments from the export
|
|
57
|
+
* @returns {string | null} The absolute path, or `null` when it escapes `root`
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* resolveInside("/tmp/site", "static", "media/a.webp"); // "/tmp/site/static/media/a.webp"
|
|
61
|
+
* resolveInside("/tmp/site", "static", "../../.ssh/id_rsa"); // null
|
|
62
|
+
*/
|
|
63
|
+
export function resolveInside(root, ...segments) {
|
|
64
|
+
const base = resolve(root);
|
|
65
|
+
const target = resolve(base, ...segments);
|
|
66
|
+
const path = relative(base, target);
|
|
67
|
+
if (path === "" || path.startsWith("..") || isAbsolute(path)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Whether an IP address is private, loopback, link-local, or otherwise not a
|
|
75
|
+
* public unicast address.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} address - An IPv4 or IPv6 address
|
|
78
|
+
* @returns {boolean}
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* isPrivateAddress("169.254.169.254"); // true
|
|
82
|
+
* isPrivateAddress("93.184.215.14"); // false
|
|
83
|
+
*/
|
|
84
|
+
export function isPrivateAddress(address) {
|
|
85
|
+
const family = isIP(address);
|
|
86
|
+
if (family === 0) return true;
|
|
87
|
+
return PRIVATE_ADDRESSES.check(address, family === 6 ? "ipv6" : "ipv4");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Refuses a URL an import must not fetch: anything but http(s), embedded
|
|
92
|
+
* credentials, `localhost`, or a host that resolves to a private address.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} rawUrl - The URL from the export
|
|
95
|
+
* @returns {Promise<URL>} The parsed URL
|
|
96
|
+
* @throws {Error} When the URL isn't a public http(s) address
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* await assertPublicUrl("https://example.com/media/a.webp");
|
|
100
|
+
*/
|
|
101
|
+
export async function assertPublicUrl(rawUrl) {
|
|
102
|
+
const url = new URL(rawUrl);
|
|
103
|
+
const refuse = (reason) =>
|
|
104
|
+
new Error(`Refusing to fetch ${url.href}: ${reason}.`);
|
|
105
|
+
|
|
106
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
107
|
+
throw refuse("only http and https URLs are fetched");
|
|
108
|
+
}
|
|
109
|
+
if (url.username || url.password) {
|
|
110
|
+
throw refuse("it includes credentials");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const host = url.hostname.replace(/^\[|\]$/g, "").replace(/\.+$/, "");
|
|
114
|
+
if (host === "localhost" || host.endsWith(".localhost")) {
|
|
115
|
+
throw refuse("it points to a private address");
|
|
116
|
+
}
|
|
117
|
+
const addresses = isIP(host)
|
|
118
|
+
? [host]
|
|
119
|
+
: (await lookup(host, { all: true, verbatim: true })).map(
|
|
120
|
+
(entry) => entry.address,
|
|
121
|
+
);
|
|
122
|
+
if (addresses.some(isPrivateAddress)) {
|
|
123
|
+
throw refuse("it points to a private address");
|
|
124
|
+
}
|
|
125
|
+
return url;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Fetches a file an export links to, checking the address of every redirect
|
|
130
|
+
* hop as well as the first.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} rawUrl - The URL from the export
|
|
133
|
+
* @returns {Promise<Response>} The final response
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* const response = await fetchPublic("https://example.com/media/a.webp");
|
|
137
|
+
*/
|
|
138
|
+
export async function fetchPublic(rawUrl) {
|
|
139
|
+
let url = await assertPublicUrl(rawUrl);
|
|
140
|
+
for (let hop = 0; ; hop += 1) {
|
|
141
|
+
const response = await fetch(url, { redirect: "manual" });
|
|
142
|
+
const location = response.headers.get("location");
|
|
143
|
+
if (response.status < 300 || response.status >= 400 || !location) {
|
|
144
|
+
return response;
|
|
145
|
+
}
|
|
146
|
+
if (hop === MAX_REDIRECTS) {
|
|
147
|
+
throw new Error(`Too many redirects fetching ${rawUrl}.`);
|
|
148
|
+
}
|
|
149
|
+
url = await assertPublicUrl(new URL(location, url).href);
|
|
150
|
+
}
|
|
151
|
+
}
|
package/bin/lib/node-env.js
CHANGED
|
@@ -22,7 +22,7 @@ function fileExists(envPath) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Locate
|
|
25
|
+
* Locate the env file the CLI and `jant start` load.
|
|
26
26
|
*
|
|
27
27
|
* `JANT_ENV_FILE` overrides the search whenever it is set: a path names the
|
|
28
28
|
* file to load, and an empty value means "load nothing". The empty form is
|
|
@@ -30,8 +30,13 @@ function fileExists(envPath) {
|
|
|
30
30
|
* see the `env` block in `vitest.config.ts`.
|
|
31
31
|
*
|
|
32
32
|
* Without the override, the search order is:
|
|
33
|
-
* 1. `<cwd>/.env
|
|
34
|
-
*
|
|
33
|
+
* 1. `<cwd>/.env` — the project directory, the file the Node and Docker
|
|
34
|
+
* docs and templates use
|
|
35
|
+
* 2. `packages/core/.env.node` — only in a checkout of the Jant repository,
|
|
36
|
+
* whose Node development environment lives there. It can't be
|
|
37
|
+
* `packages/core/.env`: Wrangler reads that file as Worker bindings
|
|
38
|
+
* whenever `.dev.vars` is missing. The published package has no such
|
|
39
|
+
* file.
|
|
35
40
|
*
|
|
36
41
|
* @param {string} [cwd] - Directory searched first, and the base a relative
|
|
37
42
|
* `JANT_ENV_FILE` resolves against. Defaults to `process.cwd()`.
|
|
@@ -63,7 +68,7 @@ export function findNodeEnvPath(cwd = process.cwd(), env = process.env) {
|
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
const candidates = [
|
|
66
|
-
resolve(cwd, ".env
|
|
71
|
+
resolve(cwd, ".env"),
|
|
67
72
|
resolve(dirname(fileURLToPath(import.meta.url)), "../../.env.node"),
|
|
68
73
|
];
|
|
69
74
|
|
|
@@ -77,7 +82,7 @@ export function findNodeEnvPath(cwd = process.cwd(), env = process.env) {
|
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
/**
|
|
80
|
-
* Parse
|
|
85
|
+
* Parse an env file and assign keys into `env`. Existing values in
|
|
81
86
|
* `env` are preserved (already-exported shell vars win over file values).
|
|
82
87
|
*
|
|
83
88
|
* Returns a result object useful for debug logging:
|
|
@@ -118,11 +123,11 @@ export function loadNodeEnvFile(envPath, env = process.env) {
|
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
/**
|
|
121
|
-
*
|
|
126
|
+
* Locate and load the env file for `jant start` and any DB-touching command.
|
|
122
127
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
128
|
+
* Called before `resolveCliRuntime()`, so DATABASE_URL / DATA_DIR defined in
|
|
129
|
+
* the file make `--node` (or auto-detect) work without requiring the user to
|
|
130
|
+
* source it.
|
|
126
131
|
*
|
|
127
132
|
* Honours `JANT_ENV_FILE` through {@link findNodeEnvPath}, so a caller that
|
|
128
133
|
* needs a fully controlled environment can opt out of the file entirely.
|
|
@@ -81,7 +81,7 @@ export function formatRuntimeBanner(runtime, env = process.env) {
|
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* One-call helper for DB-touching CLI commands:
|
|
84
|
-
* 1.
|
|
84
|
+
* 1. Load the env file (so DATABASE_URL/DATA_DIR work without sourcing).
|
|
85
85
|
* 2. Resolve the runtime from flags and env.
|
|
86
86
|
* 3. Print a one-line banner so the user immediately sees which target
|
|
87
87
|
* was picked, instead of finding out minutes later when something fails.
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "node:fs/promises";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
14
14
|
import { basename, dirname, extname, join, relative } from "node:path";
|
|
15
|
+
import { assertPublicUrl, resolveInside } from "./import-sources.js";
|
|
15
16
|
import { parse, stringify } from "smol-toml";
|
|
16
17
|
import {
|
|
17
18
|
collectMediaReferences as collectParsedMediaReferences,
|
|
@@ -168,7 +169,33 @@ function formatAssetRequestError(error) {
|
|
|
168
169
|
return "Download failed";
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Downloads one asset an export links to. Every hop, the first and each
|
|
174
|
+
* redirect, must be a public address (see `lib/import-sources.js`): the
|
|
175
|
+
* bytes end up in the export, and importing it publishes them. The one
|
|
176
|
+
* exception is the site being exported, which the person running the export
|
|
177
|
+
* named, and which can well be `http://127.0.0.1:3000`.
|
|
178
|
+
*/
|
|
179
|
+
async function requestAssetWithNode(url, redirectCount = 0, siteOrigin = "") {
|
|
180
|
+
if (!siteOrigin || originOf(url) !== siteOrigin) {
|
|
181
|
+
try {
|
|
182
|
+
await assertPublicUrl(url);
|
|
183
|
+
} catch (error) {
|
|
184
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return requestPublicAsset(url, redirectCount, siteOrigin);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function originOf(url) {
|
|
191
|
+
try {
|
|
192
|
+
return new URL(url).origin;
|
|
193
|
+
} catch {
|
|
194
|
+
return "";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function requestPublicAsset(url, redirectCount, siteOrigin) {
|
|
172
199
|
const maxRedirects = 5;
|
|
173
200
|
|
|
174
201
|
return new Promise((resolve) => {
|
|
@@ -213,6 +240,7 @@ function requestAssetWithNode(url, redirectCount = 0) {
|
|
|
213
240
|
requestAssetWithNode(
|
|
214
241
|
new URL(location, parsedUrl).toString(),
|
|
215
242
|
redirectCount + 1,
|
|
243
|
+
siteOrigin,
|
|
216
244
|
),
|
|
217
245
|
);
|
|
218
246
|
return;
|
|
@@ -275,7 +303,11 @@ async function fetchAsset(resolvedUrl, options = {}) {
|
|
|
275
303
|
let lastError = "Unknown download failure";
|
|
276
304
|
|
|
277
305
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
278
|
-
const result = await requestAssetWithNode(
|
|
306
|
+
const result = await requestAssetWithNode(
|
|
307
|
+
resolvedUrl,
|
|
308
|
+
0,
|
|
309
|
+
options.siteOrigin,
|
|
310
|
+
);
|
|
279
311
|
if (!("error" in result)) {
|
|
280
312
|
return result;
|
|
281
313
|
}
|
|
@@ -468,7 +500,10 @@ async function resolveExistingPulledPath(
|
|
|
468
500
|
return null;
|
|
469
501
|
}
|
|
470
502
|
|
|
471
|
-
const fullPath = join(rootDir, "static", pathname);
|
|
503
|
+
const fullPath = resolveInside(join(rootDir, "static"), pathname);
|
|
504
|
+
if (!fullPath) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
472
507
|
const fileStat = await stat(fullPath).catch(() => null);
|
|
473
508
|
if (!fileStat?.isFile()) {
|
|
474
509
|
return null;
|
|
@@ -477,6 +512,21 @@ async function resolveExistingPulledPath(
|
|
|
477
512
|
return toPulledPublicPath(pathname, sitePathPrefix);
|
|
478
513
|
}
|
|
479
514
|
|
|
515
|
+
/**
|
|
516
|
+
* Download the media an unpacked site export links to into its `static/`
|
|
517
|
+
* directory, and point the export at the local copies.
|
|
518
|
+
*
|
|
519
|
+
* @param {string} rootDir - The unpacked export
|
|
520
|
+
* @param {{
|
|
521
|
+
* assetLoader?: ((asset: object) => Promise<object | null>) | null,
|
|
522
|
+
* logger?: (event: object) => void,
|
|
523
|
+
* siteOrigin?: string,
|
|
524
|
+
* }} [options] - `siteOrigin` names the site being exported, whose files
|
|
525
|
+
* are fetched even from a private address; everything else has to be public
|
|
526
|
+
* @returns {Promise<object>} What was downloaded, reused, and failed
|
|
527
|
+
* @example
|
|
528
|
+
* await pullSiteExportDirectory(dir, { siteOrigin: "http://127.0.0.1:3000" });
|
|
529
|
+
*/
|
|
480
530
|
export async function pullSiteExportDirectory(rootDir, options = {}) {
|
|
481
531
|
const logger =
|
|
482
532
|
typeof options.logger === "function" ? options.logger : () => {};
|
|
@@ -566,7 +616,9 @@ export async function pullSiteExportDirectory(rootDir, options = {}) {
|
|
|
566
616
|
});
|
|
567
617
|
}
|
|
568
618
|
if (!asset) {
|
|
569
|
-
const fetched = await fetchAsset(resolvedUrl
|
|
619
|
+
const fetched = await fetchAsset(resolvedUrl, {
|
|
620
|
+
siteOrigin: options.siteOrigin,
|
|
621
|
+
});
|
|
570
622
|
if ("error" in fetched) {
|
|
571
623
|
assetError = fetched.error;
|
|
572
624
|
} else {
|
package/bin/lib/site-snapshot.js
CHANGED
|
@@ -262,7 +262,16 @@ export function getSnapshotSelectSql(tableName, siteId) {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
/**
|
|
265
|
-
*
|
|
265
|
+
* Settings that hold a storage key. The snapshot restores these settings, so
|
|
266
|
+
* the files they point at travel with it, whether or not a media row
|
|
267
|
+
* records them: sites that set an avatar before avatars had media rows have
|
|
268
|
+
* none.
|
|
269
|
+
*/
|
|
270
|
+
const STORAGE_KEY_SETTINGS = ["SITE_AVATAR", "SITE_FAVICON_APPLE_TOUCH"];
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* SQL listing a site's stored objects: media originals, video posters, and
|
|
274
|
+
* the files the avatar and icon settings name.
|
|
266
275
|
*
|
|
267
276
|
* @param {string} siteId Site whose media rows to read
|
|
268
277
|
* @returns {string} A query returning `key` and `contentType` columns
|
|
@@ -290,6 +299,17 @@ export function buildSnapshotStorageQuery(siteId) {
|
|
|
290
299
|
WHERE "poster_key" IS NOT NULL
|
|
291
300
|
AND "site_id" = '${escapeSqlString(siteId)}'
|
|
292
301
|
AND trim("poster_key") <> ''
|
|
302
|
+
|
|
303
|
+
UNION ALL
|
|
304
|
+
|
|
305
|
+
SELECT
|
|
306
|
+
"value" AS "key",
|
|
307
|
+
NULL AS "contentType"
|
|
308
|
+
FROM "site_setting"
|
|
309
|
+
WHERE "site_id" = '${escapeSqlString(siteId)}'
|
|
310
|
+
AND "key" IN (${quoteList(STORAGE_KEY_SETTINGS)})
|
|
311
|
+
AND "value" IS NOT NULL
|
|
312
|
+
AND trim("value") <> ''
|
|
293
313
|
)
|
|
294
314
|
WHERE "key" IS NOT NULL
|
|
295
315
|
AND trim("key") <> ''
|
|
@@ -449,8 +469,11 @@ export function assertSnapshotMeta(meta) {
|
|
|
449
469
|
}
|
|
450
470
|
|
|
451
471
|
if (!SUPPORTED_SNAPSHOT_VERSIONS.includes(meta.version)) {
|
|
472
|
+
const newest = Math.max(...SUPPORTED_SNAPSHOT_VERSIONS);
|
|
452
473
|
throw new Error(
|
|
453
|
-
|
|
474
|
+
typeof meta.version === "number" && meta.version > newest
|
|
475
|
+
? `This snapshot uses format version ${meta.version}, and this Jant reads up to version ${newest}. Upgrade @jant/core, then import again.`
|
|
476
|
+
: `Unsupported snapshot version: expected one of ${SUPPORTED_SNAPSHOT_VERSIONS.join(", ")}, got ${String(meta.version)}`,
|
|
454
477
|
);
|
|
455
478
|
}
|
|
456
479
|
|
|
@@ -1222,6 +1245,20 @@ export function orderSnapshotPostRows(rows) {
|
|
|
1222
1245
|
*/
|
|
1223
1246
|
export const DEFER_FOREIGN_KEYS_SQL = "PRAGMA defer_foreign_keys = ON;";
|
|
1224
1247
|
|
|
1248
|
+
/**
|
|
1249
|
+
* `ON CONFLICT` clauses a snapshot's inserts carry.
|
|
1250
|
+
*
|
|
1251
|
+
* `--replace` clears the settings the importing version knows to be in a
|
|
1252
|
+
* snapshot. A later version's snapshot can carry a setting this one doesn't
|
|
1253
|
+
* list; written as a plain INSERT, it would collide with the target's own row
|
|
1254
|
+
* and fail the import after its files were already uploaded. As an upsert it
|
|
1255
|
+
* replaces that row, whichever version imports it.
|
|
1256
|
+
*/
|
|
1257
|
+
export const SNAPSHOT_CONFLICT_CLAUSES = {
|
|
1258
|
+
site_setting:
|
|
1259
|
+
'ON CONFLICT ("site_id", "key") DO UPDATE SET "value" = excluded."value", "updated_at" = excluded."updated_at"',
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1225
1262
|
export function buildReplaceSql(siteId) {
|
|
1226
1263
|
const statements = [];
|
|
1227
1264
|
|