@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/src/lib/url.ts
CHANGED
|
@@ -90,6 +90,87 @@ export function isFullUrl(str: string): boolean {
|
|
|
90
90
|
return str.startsWith("http://") || str.startsWith("https://");
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* A custom URL's redirect target in the form it is stored: an `http(s)` URL
|
|
95
|
+
* as given, or a path on the site in the registry's form — no leading slash,
|
|
96
|
+
* lowercase, single slashes — with its query string and fragment kept as
|
|
97
|
+
* they were, since those can be case-sensitive.
|
|
98
|
+
*
|
|
99
|
+
* @param target - The target an author or an import gave
|
|
100
|
+
* @returns The stored form
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* normalizeRedirectTarget("/Archive/?format=Note"); // "archive?format=Note"
|
|
104
|
+
* normalizeRedirectTarget("https://Example.com/Page"); // "https://example.com/Page"
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export function normalizeRedirectTarget(target: string): string {
|
|
108
|
+
const trimmed = target.trim();
|
|
109
|
+
if (isFullUrl(trimmed)) return new URL(trimmed).toString();
|
|
110
|
+
const split = trimmed.search(/[?#]/);
|
|
111
|
+
return split === -1
|
|
112
|
+
? normalizePath(trimmed)
|
|
113
|
+
: `${normalizePath(trimmed.slice(0, split))}${trimmed.slice(split)}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Where a stored redirect target sends a reader: the URL itself, or the path
|
|
118
|
+
* with its leading slash. Callers add the site's path prefix to a path.
|
|
119
|
+
*
|
|
120
|
+
* @param stored - A target as {@link normalizeRedirectTarget} stored it
|
|
121
|
+
* @returns The target as an address
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* redirectTargetHref("archive?format=note"); // "/archive?format=note"
|
|
125
|
+
* redirectTargetHref("https://example.com/page"); // "https://example.com/page"
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export function redirectTargetHref(stored: string): string {
|
|
129
|
+
return isFullUrl(stored) ? stored : `/${stored}`;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Carry a request's query string onto a redirect within the site.
|
|
134
|
+
*
|
|
135
|
+
* An address reached another way — a later custom URL, other letter case, the
|
|
136
|
+
* slug of a post that has a custom URL — redirects to the one address, and a
|
|
137
|
+
* reader's `?sort=oldest` or `?page=2` has to arrive with them. A target with
|
|
138
|
+
* a query string of its own keeps it, and one off the site goes where it says.
|
|
139
|
+
*
|
|
140
|
+
* @param target - Where the redirect goes
|
|
141
|
+
* @param requestUrl - The URL that was requested
|
|
142
|
+
* @returns The target with the request's query string when it takes one
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* withRequestQuery("/notes", "https://example.com/More-Notes?sort=oldest");
|
|
146
|
+
* // "/notes?sort=oldest"
|
|
147
|
+
* withRequestQuery("/archive?format=note", "https://example.com/a?page=2");
|
|
148
|
+
* // "/archive?format=note"
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export function withRequestQuery(target: string, requestUrl: string): string {
|
|
152
|
+
if (isFullUrl(target) || /[?#]/.test(target)) return target;
|
|
153
|
+
return `${target}${new URL(requestUrl).search}`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The registry path a stored target names on this site, or null when it
|
|
158
|
+
* leaves the site.
|
|
159
|
+
*
|
|
160
|
+
* @param stored - A target as {@link normalizeRedirectTarget} stored it
|
|
161
|
+
* @returns The path without query string or fragment, or null
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* redirectTargetPath("archive?format=note"); // "archive"
|
|
165
|
+
* redirectTargetPath("https://example.com/"); // null
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export function redirectTargetPath(stored: string): string | null {
|
|
169
|
+
if (isFullUrl(stored)) return null;
|
|
170
|
+
const split = stored.search(/[?#]/);
|
|
171
|
+
return split === -1 ? stored : stored.slice(0, split);
|
|
172
|
+
}
|
|
173
|
+
|
|
93
174
|
/**
|
|
94
175
|
* If a full URL points at the site's own host, return its same-site path
|
|
95
176
|
* (`pathname` + `search` + `hash`). Returns `null` when the input is not a full
|
|
@@ -495,6 +576,10 @@ export function toPublicPath(path: string, sitePathPrefix = ""): string {
|
|
|
495
576
|
* an exported feed keeps it, which is why the rule lives here rather than
|
|
496
577
|
* inside `toPostView`.
|
|
497
578
|
*
|
|
579
|
+
* Custom paths already carry their leading `/`, so never prepend one to an
|
|
580
|
+
* alias by hand: `//blog/links/4` is a protocol-relative URL, and
|
|
581
|
+
* `new URL()` reads its first segment as another host.
|
|
582
|
+
*
|
|
498
583
|
* @param slug - The Post's current slug
|
|
499
584
|
* @param aliasPath - Its oldest custom path, `paths.getPostAliases()`'s first
|
|
500
585
|
* @returns Internal path rooted at `/`
|
|
@@ -502,7 +587,7 @@ export function toPublicPath(path: string, sitePathPrefix = ""): string {
|
|
|
502
587
|
* getPostPath("xta29"); // "/xta29"
|
|
503
588
|
* getPostPath("links-4", "/blog/links/4"); // "/blog/links/4"
|
|
504
589
|
*/
|
|
505
|
-
export function getPostPath(slug: string, aliasPath?: string): string {
|
|
590
|
+
export function getPostPath(slug: string, aliasPath?: string | null): string {
|
|
506
591
|
return aliasPath ?? `/${slug}`;
|
|
507
592
|
}
|
|
508
593
|
|
|
@@ -102,6 +102,7 @@ describe("hasValidLocalDevToken", () => {
|
|
|
102
102
|
hasValidLocalDevToken(
|
|
103
103
|
"https://jant.me/api/posts",
|
|
104
104
|
"127.0.0.1:8020",
|
|
105
|
+
"127.0.0.1",
|
|
105
106
|
"jnt_dev",
|
|
106
107
|
"jnt_dev",
|
|
107
108
|
),
|
|
@@ -113,6 +114,7 @@ describe("hasValidLocalDevToken", () => {
|
|
|
113
114
|
hasValidLocalDevToken(
|
|
114
115
|
"http://127.0.0.1:8020/api/posts",
|
|
115
116
|
undefined,
|
|
117
|
+
"unknown",
|
|
116
118
|
"jnt_dev",
|
|
117
119
|
"jnt_dev",
|
|
118
120
|
),
|
|
@@ -124,11 +126,36 @@ describe("hasValidLocalDevToken", () => {
|
|
|
124
126
|
hasValidLocalDevToken(
|
|
125
127
|
"https://jant.me/api/posts",
|
|
126
128
|
"jant.me",
|
|
129
|
+
"127.0.0.1",
|
|
127
130
|
"jnt_dev",
|
|
128
131
|
"jnt_dev",
|
|
129
132
|
),
|
|
130
133
|
).toBe(false);
|
|
131
134
|
});
|
|
135
|
+
|
|
136
|
+
it("rejects a forged local Host header from another machine", () => {
|
|
137
|
+
expect(
|
|
138
|
+
hasValidLocalDevToken(
|
|
139
|
+
"https://jant.me/api/posts",
|
|
140
|
+
"localhost",
|
|
141
|
+
"203.0.113.7",
|
|
142
|
+
"jnt_dev",
|
|
143
|
+
"jnt_dev",
|
|
144
|
+
),
|
|
145
|
+
).toBe(false);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("rejects a different token", () => {
|
|
149
|
+
expect(
|
|
150
|
+
hasValidLocalDevToken(
|
|
151
|
+
"http://127.0.0.1:8020/api/posts",
|
|
152
|
+
"127.0.0.1:8020",
|
|
153
|
+
"127.0.0.1",
|
|
154
|
+
"jnt_other",
|
|
155
|
+
"jnt_dev",
|
|
156
|
+
),
|
|
157
|
+
).toBe(false);
|
|
158
|
+
});
|
|
132
159
|
});
|
|
133
160
|
|
|
134
161
|
describe("requireAuth", () => {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { getCorsOrigins } from "../../lib/env.js";
|
|
4
|
+
import type { Bindings } from "../../types.js";
|
|
5
|
+
import { apiCors } from "../cors.js";
|
|
6
|
+
|
|
7
|
+
describe("getCorsOrigins", () => {
|
|
8
|
+
it("allows every origin when CORS_ORIGINS is unset or *", () => {
|
|
9
|
+
expect(getCorsOrigins({})).toBe("*");
|
|
10
|
+
expect(getCorsOrigins({ CORS_ORIGINS: "*" })).toBe("*");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("turns cross-origin access off when CORS_ORIGINS is set but empty", () => {
|
|
14
|
+
expect(getCorsOrigins({ CORS_ORIGINS: "" })).toBeUndefined();
|
|
15
|
+
expect(getCorsOrigins({ CORS_ORIGINS: " " })).toBeUndefined();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("lists the origins it names", () => {
|
|
19
|
+
expect(
|
|
20
|
+
getCorsOrigins({
|
|
21
|
+
CORS_ORIGINS: "https://a.example, chrome-extension://abc",
|
|
22
|
+
}),
|
|
23
|
+
).toEqual(["https://a.example", "chrome-extension://abc"]);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("apiCors", () => {
|
|
28
|
+
function preflight(env: Record<string, string>) {
|
|
29
|
+
const app = new Hono<{ Bindings: Bindings }>();
|
|
30
|
+
app.use("/api/*", apiCors());
|
|
31
|
+
app.get("/api/ping", (c) => c.text("ok"));
|
|
32
|
+
return app.request(
|
|
33
|
+
"/api/ping",
|
|
34
|
+
{
|
|
35
|
+
method: "OPTIONS",
|
|
36
|
+
headers: {
|
|
37
|
+
Origin: "https://elsewhere.example",
|
|
38
|
+
"Access-Control-Request-Method": "GET",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
env as unknown as Bindings,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
it("answers a preflight when cross-origin access is on", async () => {
|
|
46
|
+
const res = await preflight({});
|
|
47
|
+
expect(res.headers.get("Access-Control-Allow-Origin")).toBe("*");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("sends no CORS headers when CORS_ORIGINS is empty", async () => {
|
|
51
|
+
const res = await preflight({ CORS_ORIGINS: "" });
|
|
52
|
+
expect(res.headers.get("Access-Control-Allow-Origin")).toBeNull();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createApp } from "../../app.js";
|
|
3
|
+
import { createTestDatabase } from "../../__tests__/helpers/db.js";
|
|
4
|
+
import type { Bindings } from "../../types.js";
|
|
5
|
+
import { isAllowedWrite, type WriteRequestInfo } from "../cross-origin.js";
|
|
6
|
+
|
|
7
|
+
const SESSION = "better-auth.session_token=abc.def";
|
|
8
|
+
|
|
9
|
+
function write(overrides: Partial<WriteRequestInfo>): WriteRequestInfo {
|
|
10
|
+
return {
|
|
11
|
+
method: "POST",
|
|
12
|
+
cookie: SESSION,
|
|
13
|
+
secFetchSite: undefined,
|
|
14
|
+
origin: undefined,
|
|
15
|
+
siteHosts: ["mine.jant.blog"],
|
|
16
|
+
trustedOrigins: [],
|
|
17
|
+
...overrides,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe("isAllowedWrite", () => {
|
|
22
|
+
it("lets reads through whatever their origin", () => {
|
|
23
|
+
expect(
|
|
24
|
+
isAllowedWrite(
|
|
25
|
+
write({
|
|
26
|
+
method: "GET",
|
|
27
|
+
secFetchSite: "cross-site",
|
|
28
|
+
origin: "https://evil.example",
|
|
29
|
+
}),
|
|
30
|
+
),
|
|
31
|
+
).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("lets a write without a session cookie through, since there's no session to borrow", () => {
|
|
35
|
+
expect(
|
|
36
|
+
isAllowedWrite(
|
|
37
|
+
write({
|
|
38
|
+
cookie: "theme=dark",
|
|
39
|
+
secFetchSite: "cross-site",
|
|
40
|
+
origin: "https://evil.example",
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("refuses a signed-in write from a sibling blog on the same parent domain", () => {
|
|
47
|
+
expect(
|
|
48
|
+
isAllowedWrite(
|
|
49
|
+
write({ secFetchSite: "same-site", origin: "https://other.jant.blog" }),
|
|
50
|
+
),
|
|
51
|
+
).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("refuses a signed-in write from another site", () => {
|
|
55
|
+
expect(
|
|
56
|
+
isAllowedWrite(
|
|
57
|
+
write({ secFetchSite: "cross-site", origin: "https://evil.example" }),
|
|
58
|
+
),
|
|
59
|
+
).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("accepts a write the site's own page sent", () => {
|
|
63
|
+
expect(
|
|
64
|
+
isAllowedWrite(
|
|
65
|
+
write({
|
|
66
|
+
secFetchSite: "same-origin",
|
|
67
|
+
origin: "https://mine.jant.blog",
|
|
68
|
+
}),
|
|
69
|
+
),
|
|
70
|
+
).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("accepts an origin CORS_ORIGINS names, such as a browser extension", () => {
|
|
74
|
+
expect(
|
|
75
|
+
isAllowedWrite(
|
|
76
|
+
write({
|
|
77
|
+
secFetchSite: "cross-site",
|
|
78
|
+
origin: "chrome-extension://abc",
|
|
79
|
+
trustedOrigins: ["chrome-extension://abc"],
|
|
80
|
+
}),
|
|
81
|
+
),
|
|
82
|
+
).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("falls back to Origin for browsers without Sec-Fetch-Site", () => {
|
|
86
|
+
expect(isAllowedWrite(write({ origin: "https://mine.jant.blog" }))).toBe(
|
|
87
|
+
true,
|
|
88
|
+
);
|
|
89
|
+
expect(isAllowedWrite(write({ origin: "http://mine.jant.blog" }))).toBe(
|
|
90
|
+
true,
|
|
91
|
+
);
|
|
92
|
+
expect(isAllowedWrite(write({ origin: "https://other.jant.blog" }))).toBe(
|
|
93
|
+
false,
|
|
94
|
+
);
|
|
95
|
+
expect(isAllowedWrite(write({ origin: "null" }))).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("lets a request with neither header through, since no page sent it", () => {
|
|
99
|
+
expect(isAllowedWrite(write({}))).toBe(true);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe("cross-origin writes through createApp", () => {
|
|
104
|
+
const executionCtx = {
|
|
105
|
+
waitUntil() {},
|
|
106
|
+
passThroughOnException() {},
|
|
107
|
+
props: {},
|
|
108
|
+
} as unknown as Parameters<ReturnType<typeof createApp>["fetch"]>[2];
|
|
109
|
+
|
|
110
|
+
function bindings(): Bindings {
|
|
111
|
+
const { sqlite } = createTestDatabase();
|
|
112
|
+
return {
|
|
113
|
+
SITE_ORIGIN: "https://mine.jant.blog",
|
|
114
|
+
AUTH_SECRET: "x".repeat(40),
|
|
115
|
+
NODE_SQLITE: sqlite,
|
|
116
|
+
} as unknown as Bindings;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function postCodeInjection(headers: Record<string, string>) {
|
|
120
|
+
return createApp().fetch(
|
|
121
|
+
new Request("https://mine.jant.blog/settings/code-injection", {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: { Cookie: SESSION, "Content-Type": "text/plain", ...headers },
|
|
124
|
+
body: JSON.stringify({ customHeadHtml: "<script>alert(1)</script>" }),
|
|
125
|
+
}),
|
|
126
|
+
bindings(),
|
|
127
|
+
executionCtx,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
it("refuses a form another blog auto-submits to code injection", async () => {
|
|
132
|
+
const res = await postCodeInjection({
|
|
133
|
+
Origin: "https://other.jant.blog",
|
|
134
|
+
"Sec-Fetch-Site": "same-site",
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
expect(res.status).toBe(403);
|
|
138
|
+
await expect(res.text()).resolves.toContain("started on another site");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("leaves the site's own requests to the routes", async () => {
|
|
142
|
+
const res = await postCodeInjection({
|
|
143
|
+
Origin: "https://mine.jant.blog",
|
|
144
|
+
"Sec-Fetch-Site": "same-origin",
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
expect(res.status).not.toBe(403);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { createTestApp } from "../../__tests__/helpers/app.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
requirePublicApiEnabled,
|
|
6
|
-
requireRssFeedsEnabled,
|
|
7
|
-
} from "../public-content-access.js";
|
|
8
|
-
|
|
9
|
-
describe("public content access policies", () => {
|
|
10
|
-
it.each([
|
|
11
|
-
"/feed",
|
|
12
|
-
"/feed/latest",
|
|
13
|
-
"/feed/atom.xml",
|
|
14
|
-
"/latest/feed",
|
|
15
|
-
"/featured/feed/atom.xml",
|
|
16
|
-
"/archive/feed",
|
|
17
|
-
"/reading/feed",
|
|
18
|
-
"/settings-notes/feed",
|
|
19
|
-
"/collections/reading+movies/feed",
|
|
20
|
-
])("recognizes %s as a feed path", (path) => {
|
|
21
|
-
expect(isRssFeedPath(path)).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it.each([
|
|
25
|
-
"/",
|
|
26
|
-
"/archive",
|
|
27
|
-
"/api/example/feed",
|
|
28
|
-
"/settings/feed",
|
|
29
|
-
"/compose/feed",
|
|
30
|
-
"/_/theme/feed",
|
|
31
|
-
])("does not treat %s as a feed path", (path) => {
|
|
32
|
-
expect(isRssFeedPath(path)).toBe(false);
|
|
33
|
-
});
|
|
3
|
+
import { requirePublicApiEnabled } from "../public-content-access.js";
|
|
34
4
|
|
|
5
|
+
describe("public API access policy", () => {
|
|
35
6
|
it("returns 404 for the dedicated public API even with a session", async () => {
|
|
36
7
|
const { app, services } = createTestApp({ authenticated: true });
|
|
37
8
|
await services.settings.set("PUBLIC_API_ENABLED", "false");
|
|
@@ -43,15 +14,4 @@ describe("public content access policies", () => {
|
|
|
43
14
|
|
|
44
15
|
expect(response.status).toBe(404);
|
|
45
16
|
});
|
|
46
|
-
|
|
47
|
-
it("returns 404 for feed paths when feed publishing is off", async () => {
|
|
48
|
-
const { app, services } = createTestApp();
|
|
49
|
-
await services.settings.set("RSS_FEEDS_ENABLED", "false");
|
|
50
|
-
app.use("*", requireRssFeedsEnabled());
|
|
51
|
-
app.get("*", (c) => c.text("page"));
|
|
52
|
-
|
|
53
|
-
expect((await app.request("/settings-notes/feed")).status).toBe(404);
|
|
54
|
-
expect((await app.request("/settings/feed")).status).toBe(200);
|
|
55
|
-
expect((await app.request("/settings-notes")).status).toBe(200);
|
|
56
|
-
});
|
|
57
17
|
});
|
package/src/middleware/auth.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { getDevApiToken, getInternalAdminToken } from "../lib/env.js";
|
|
|
12
12
|
import { NotFoundError, UnauthorizedError } from "../lib/errors.js";
|
|
13
13
|
import { getRuntimeSitePathPrefix } from "../lib/site-resolution.js";
|
|
14
14
|
import { isSafeInternalRedirect, toPublicHref } from "../lib/url.js";
|
|
15
|
+
import { timingSafeEqualText } from "../lib/crypto.js";
|
|
16
|
+
import { getClientIp } from "../lib/rate-limit.js";
|
|
15
17
|
|
|
16
18
|
type Env = { Bindings: Bindings; Variables: AppVariables };
|
|
17
19
|
|
|
@@ -55,27 +57,55 @@ function getRequestHostname(
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Whether a client address is this machine's own.
|
|
62
|
+
*
|
|
63
|
+
* `unknown` counts: it means no proxy or edge reported an address, which only
|
|
64
|
+
* happens for a request made on the machine itself, such as a script calling
|
|
65
|
+
* the request handler directly. A request from elsewhere always arrives with
|
|
66
|
+
* the address the socket, the proxy, or Cloudflare reports.
|
|
67
|
+
*/
|
|
68
|
+
function isLoopbackClient(clientIp: string): boolean {
|
|
69
|
+
return (
|
|
70
|
+
clientIp === "unknown" ||
|
|
71
|
+
clientIp === "::1" ||
|
|
72
|
+
/^(::ffff:)?127\./.test(clientIp)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
/**
|
|
59
77
|
* Validates a local-only development token against the current request.
|
|
60
78
|
*
|
|
79
|
+
* The Host header is the client's to write, so a local hostname alone proves
|
|
80
|
+
* nothing on a server reachable from outside. The request must also come
|
|
81
|
+
* from the machine itself.
|
|
82
|
+
*
|
|
61
83
|
* @param requestUrl - Full request URL
|
|
62
84
|
* @param requestHost - Original Host header when available
|
|
85
|
+
* @param clientIp - The client address (see `getClientIp`)
|
|
63
86
|
* @param providedToken - Token supplied by the caller
|
|
64
87
|
* @param expectedToken - Token configured in the environment
|
|
65
|
-
* @returns `true` when the token matches on a local hostname
|
|
88
|
+
* @returns `true` when the token matches, on a local hostname, from this machine
|
|
66
89
|
*/
|
|
67
90
|
export function hasValidLocalDevToken(
|
|
68
91
|
requestUrl: string,
|
|
69
92
|
requestHost: string | undefined,
|
|
93
|
+
clientIp: string,
|
|
70
94
|
providedToken: string | undefined,
|
|
71
95
|
expectedToken: string | undefined,
|
|
72
96
|
): boolean {
|
|
73
|
-
if (
|
|
97
|
+
if (
|
|
98
|
+
!providedToken ||
|
|
99
|
+
!expectedToken ||
|
|
100
|
+
!timingSafeEqualText(providedToken, expectedToken)
|
|
101
|
+
) {
|
|
74
102
|
return false;
|
|
75
103
|
}
|
|
76
104
|
|
|
77
105
|
const hostname = getRequestHostname(requestUrl, requestHost);
|
|
78
|
-
return
|
|
106
|
+
return (
|
|
107
|
+
hostname !== null && isLocalHostname(hostname) && isLoopbackClient(clientIp)
|
|
108
|
+
);
|
|
79
109
|
}
|
|
80
110
|
|
|
81
111
|
/**
|
|
@@ -272,6 +302,7 @@ async function hasValidBearerApiToken(c: {
|
|
|
272
302
|
hasValidLocalDevToken(
|
|
273
303
|
c.req.url,
|
|
274
304
|
c.req.header("host"),
|
|
305
|
+
getClientIp(c),
|
|
275
306
|
rawToken,
|
|
276
307
|
getDevApiToken(c.env),
|
|
277
308
|
)
|
package/src/middleware/cors.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CORS Middleware
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Answers cross-origin API requests as `CORS_ORIGINS` says.
|
|
5
5
|
*
|
|
6
|
-
* - Not set →
|
|
7
|
-
* -
|
|
6
|
+
* - Not set, or `*` → allow all origins
|
|
7
|
+
* - Set but empty → cross-origin access off
|
|
8
8
|
* - Comma-separated origins → allow only those
|
|
9
9
|
* (e.g. `https://example.com,chrome-extension://abcdef`)
|
|
10
10
|
*/
|
|
@@ -37,7 +37,7 @@ export function apiCors(): MiddlewareHandler<Env> {
|
|
|
37
37
|
|
|
38
38
|
const handler = cors({
|
|
39
39
|
origin: origins,
|
|
40
|
-
allowMethods: ["GET", "POST", "PUT", "
|
|
40
|
+
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
41
41
|
allowHeaders: ["Content-Type", "Authorization", "MCP-Protocol-Version"],
|
|
42
42
|
exposeHeaders: ["Content-Type", "MCP-Protocol-Version"],
|
|
43
43
|
credentials: origins !== "*",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-origin write protection
|
|
3
|
+
*
|
|
4
|
+
* A browser attaches a `SameSite=Lax` session cookie to any request that
|
|
5
|
+
* starts on the same *site*, and a site is the registrable domain, not the
|
|
6
|
+
* origin. Hosted blogs share one parent domain, so without this check a page
|
|
7
|
+
* on one blog could post to another blog's settings with that blog's author
|
|
8
|
+
* signed in. `c.req.json()` parses a `text/plain` body too, so an ordinary
|
|
9
|
+
* auto-submitting form is enough.
|
|
10
|
+
*
|
|
11
|
+
* A request that changes state and carries a session cookie must therefore
|
|
12
|
+
* come from this site's own origin, or from an origin `CORS_ORIGINS` names.
|
|
13
|
+
* Browsers say where a request started with `Sec-Fetch-Site`, and older ones
|
|
14
|
+
* with `Origin`. A request with neither didn't come from a web page, so no
|
|
15
|
+
* ambient cookie is being borrowed and it passes, as does anything without a
|
|
16
|
+
* session cookie: API tokens travel in a header a page can't make a browser
|
|
17
|
+
* add on its own.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { MiddlewareHandler } from "hono";
|
|
21
|
+
import type { Bindings } from "../types.js";
|
|
22
|
+
import type { AppVariables } from "../types/app-context.js";
|
|
23
|
+
import { ForbiddenError } from "../lib/errors.js";
|
|
24
|
+
import { getCorsOrigins, getEnvString } from "../lib/env.js";
|
|
25
|
+
import { hasSessionCookie } from "../runtime/index.js";
|
|
26
|
+
|
|
27
|
+
type Env = { Bindings: Bindings; Variables: AppVariables };
|
|
28
|
+
|
|
29
|
+
const SAFE_METHODS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
30
|
+
|
|
31
|
+
/** What {@link isAllowedWrite} needs to know about one request. */
|
|
32
|
+
export interface WriteRequestInfo {
|
|
33
|
+
method: string;
|
|
34
|
+
cookie: string | undefined;
|
|
35
|
+
secFetchSite: string | undefined;
|
|
36
|
+
origin: string | undefined;
|
|
37
|
+
/** Hosts (`host[:port]`) this site answers on. */
|
|
38
|
+
siteHosts: readonly string[];
|
|
39
|
+
/** Origins `CORS_ORIGINS` lists by name; `*` never counts. */
|
|
40
|
+
trustedOrigins: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function hostOf(value: string): string | null {
|
|
44
|
+
try {
|
|
45
|
+
return new URL(value).host.toLowerCase();
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Decides whether a request may go on to a route that could change state.
|
|
53
|
+
*
|
|
54
|
+
* @param info - The request's method, cookie, provenance headers, and the
|
|
55
|
+
* hosts and origins this site trusts
|
|
56
|
+
* @returns `true` when the request is a read, carries no session, or started
|
|
57
|
+
* on this site or a trusted origin
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* isAllowedWrite({
|
|
62
|
+
* method: "POST",
|
|
63
|
+
* cookie: "better-auth.session_token=abc",
|
|
64
|
+
* secFetchSite: "same-site",
|
|
65
|
+
* origin: "https://other.jant.blog",
|
|
66
|
+
* siteHosts: ["mine.jant.blog"],
|
|
67
|
+
* trustedOrigins: [],
|
|
68
|
+
* }); // false
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function isAllowedWrite(info: WriteRequestInfo): boolean {
|
|
72
|
+
if (SAFE_METHODS.has(info.method.toUpperCase())) return true;
|
|
73
|
+
if (!hasSessionCookie(info.cookie)) return true;
|
|
74
|
+
|
|
75
|
+
if (info.origin && info.trustedOrigins.includes(info.origin)) return true;
|
|
76
|
+
|
|
77
|
+
const fetchSite = info.secFetchSite?.toLowerCase();
|
|
78
|
+
if (fetchSite) {
|
|
79
|
+
return fetchSite === "same-origin" || fetchSite === "none";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Browsers that predate `Sec-Fetch-Site` still send `Origin` on a POST.
|
|
83
|
+
if (!info.origin) return true;
|
|
84
|
+
const originHost = hostOf(info.origin);
|
|
85
|
+
return originHost !== null && info.siteHosts.includes(originHost);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Refuses a state-changing request that carries a session cookie but started
|
|
90
|
+
* on another site.
|
|
91
|
+
*
|
|
92
|
+
* @returns Hono middleware that throws `ForbiddenError` for such a request
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* app.use("*", rejectCrossOriginWrites());
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export function rejectCrossOriginWrites(): MiddlewareHandler<Env> {
|
|
100
|
+
return async (c, next) => {
|
|
101
|
+
const corsOrigins = getCorsOrigins(c.env);
|
|
102
|
+
const siteOrigin = getEnvString(c.env, "SITE_ORIGIN");
|
|
103
|
+
const siteHosts = [c.req.url, c.var.publicRequestUrl, siteOrigin]
|
|
104
|
+
.map((value) => (value ? hostOf(value) : null))
|
|
105
|
+
.filter((host): host is string => host !== null);
|
|
106
|
+
|
|
107
|
+
const allowed = isAllowedWrite({
|
|
108
|
+
method: c.req.method,
|
|
109
|
+
cookie: c.req.header("cookie"),
|
|
110
|
+
secFetchSite: c.req.header("sec-fetch-site"),
|
|
111
|
+
origin: c.req.header("origin"),
|
|
112
|
+
siteHosts,
|
|
113
|
+
trustedOrigins: Array.isArray(corsOrigins) ? corsOrigins : [],
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (!allowed) {
|
|
117
|
+
throw new ForbiddenError(
|
|
118
|
+
"This request started on another site, so it was refused. Open the page on this site and try again.",
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
await next();
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -12,6 +12,7 @@ import type { AppVariables } from "../types/app-context.js";
|
|
|
12
12
|
import {
|
|
13
13
|
ConfigurationError,
|
|
14
14
|
DomainError,
|
|
15
|
+
ForbiddenError,
|
|
15
16
|
NotFoundError,
|
|
16
17
|
SiteUnavailableError,
|
|
17
18
|
ValidationError,
|
|
@@ -92,6 +93,12 @@ export const errorHandler: ErrorHandler<Env> = (err, c) => {
|
|
|
92
93
|
return c.notFound();
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
// A refused request, such as a form another site submitted, is the
|
|
97
|
+
// caller's problem rather than a server fault.
|
|
98
|
+
if (err instanceof ForbiddenError) {
|
|
99
|
+
return c.text(err.message, 403);
|
|
100
|
+
}
|
|
101
|
+
|
|
95
102
|
if (err instanceof ConfigurationError) {
|
|
96
103
|
// eslint-disable-next-line no-console -- Configuration failures must stay visible in server logs.
|
|
97
104
|
console.error("[Jant] Configuration error:", err);
|