@geekity/cms 0.42.0 → 0.42.2
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/dist/admin/admin-bar.d.ts +2 -3
- package/dist/admin/admin-bar.d.ts.map +1 -1
- package/dist/admin/admin-bar.js +4 -5
- package/dist/admin/admin-bar.js.map +1 -1
- package/dist/admin/app-activity.d.ts +1 -1
- package/dist/admin/appearance.d.ts +5 -5
- package/dist/admin/appearance.js +5 -5
- package/dist/admin/comments.d.ts +3 -3
- package/dist/admin/comments.js +2 -2
- package/dist/admin/comments.js.map +1 -1
- package/dist/admin/connected-apps.d.ts +1 -1
- package/dist/admin/connected-apps.js +1 -1
- package/dist/admin/credentials.d.ts +3 -3
- package/dist/admin/credentials.js +3 -3
- package/dist/admin/dashboard.js +2 -2
- package/dist/admin/dashboard.js.map +1 -1
- package/dist/admin/documents.d.ts +4 -4
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +150 -144
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/editor-actions.d.ts +1 -1
- package/dist/admin/editor-actions.js +1 -1
- package/dist/admin/federation.d.ts +11 -11
- package/dist/admin/federation.d.ts.map +1 -1
- package/dist/admin/federation.js +10 -10
- package/dist/admin/flash.d.ts +8 -0
- package/dist/admin/flash.d.ts.map +1 -1
- package/dist/admin/flash.js +11 -0
- package/dist/admin/flash.js.map +1 -1
- package/dist/admin/indieauth-consent.d.ts +1 -1
- package/dist/admin/indieauth-consent.js +1 -1
- package/dist/admin/legacy-migrations.d.ts +20 -19
- package/dist/admin/legacy-migrations.d.ts.map +1 -1
- package/dist/admin/legacy-migrations.js +14 -13
- package/dist/admin/legacy-migrations.js.map +1 -1
- package/dist/admin/media.js +1 -1
- package/dist/admin/menu.d.ts +1 -1
- package/dist/admin/menu.js +4 -4
- package/dist/admin/menu.js.map +1 -1
- package/dist/admin/messages.d.ts +2 -2
- package/dist/admin/messages.js +2 -2
- package/dist/admin/navigation.d.ts +3 -3
- package/dist/admin/navigation.js +3 -3
- package/dist/admin/personal-data.d.ts +1 -1
- package/dist/admin/personal-data.js +1 -1
- package/dist/admin/plugins.d.ts +1 -1
- package/dist/admin/plugins.js +1 -1
- package/dist/admin/preview.js +3 -3
- package/dist/admin/preview.js.map +1 -1
- package/dist/admin/recovery.d.ts +1 -1
- package/dist/admin/recovery.js +1 -1
- package/dist/admin/routes.d.ts +3 -3
- package/dist/admin/routes.js +14 -14
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/settings-discussion.d.ts +3 -3
- package/dist/admin/settings-discussion.js +3 -3
- package/dist/admin/settings-federation.d.ts +2 -2
- package/dist/admin/settings-federation.js +5 -5
- package/dist/admin/settings-federation.js.map +1 -1
- package/dist/admin/settings-general.d.ts +1 -1
- package/dist/admin/settings-general.js +2 -2
- package/dist/admin/settings-general.js.map +1 -1
- package/dist/admin/settings-page.d.ts +2 -2
- package/dist/admin/settings-page.js +1 -1
- package/dist/admin/settings-pages.d.ts +1 -1
- package/dist/admin/settings-pages.js +1 -1
- package/dist/admin/settings-reading.d.ts +2 -2
- package/dist/admin/settings-reading.js +2 -2
- package/dist/admin/syndication-targets.d.ts +2 -2
- package/dist/admin/syndication-targets.js +2 -2
- package/dist/admin/taxonomy.d.ts +4 -4
- package/dist/admin/taxonomy.js +4 -4
- package/dist/admin/templates.d.ts +2 -2
- package/dist/admin/templates.js +2 -2
- package/dist/admin/tools.d.ts +1 -1
- package/dist/admin/tools.js +1 -1
- package/dist/admin/users.d.ts +0 -159
- package/dist/admin/users.d.ts.map +1 -1
- package/dist/admin/users.js +204 -498
- package/dist/admin/users.js.map +1 -1
- package/dist/avatars/avatars.d.ts +2 -2
- package/dist/avatars/avatars.js +2 -2
- package/dist/cache.d.ts +1 -1
- package/dist/cache.js +1 -1
- package/dist/cli/args.d.ts +20 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +138 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands.d.ts +10 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +261 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/database-in-use.d.ts +9 -0
- package/dist/cli/database-in-use.d.ts.map +1 -0
- package/dist/cli/database-in-use.js +38 -0
- package/dist/cli/database-in-use.js.map +1 -0
- package/dist/cli/dev-mode.d.ts +3 -0
- package/dist/cli/dev-mode.d.ts.map +1 -0
- package/dist/cli/dev-mode.js +31 -0
- package/dist/cli/dev-mode.js.map +1 -0
- package/dist/cli/export.d.ts +3 -0
- package/dist/cli/export.d.ts.map +1 -0
- package/dist/cli/export.js +53 -0
- package/dist/cli/export.js.map +1 -0
- package/dist/cli/format.d.ts +3 -0
- package/dist/cli/format.d.ts.map +1 -0
- package/dist/cli/format.js +10 -0
- package/dist/cli/format.js.map +1 -0
- package/dist/cli/gemini.d.ts +3 -0
- package/dist/cli/gemini.d.ts.map +1 -0
- package/dist/cli/gemini.js +34 -0
- package/dist/cli/gemini.js.map +1 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +111 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/import.d.ts +3 -0
- package/dist/cli/import.d.ts.map +1 -0
- package/dist/cli/import.js +84 -0
- package/dist/cli/import.js.map +1 -0
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +21 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/maintenance.d.ts +3 -0
- package/dist/cli/maintenance.d.ts.map +1 -0
- package/dist/cli/maintenance.js +57 -0
- package/dist/cli/maintenance.js.map +1 -0
- package/dist/cli/options.d.ts +16 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +27 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/password.d.ts +21 -0
- package/dist/cli/password.d.ts.map +1 -0
- package/dist/cli/password.js +52 -0
- package/dist/cli/password.js.map +1 -0
- package/dist/cli/plugin-commands.d.ts +11 -0
- package/dist/cli/plugin-commands.d.ts.map +1 -0
- package/dist/cli/plugin-commands.js +79 -0
- package/dist/cli/plugin-commands.js.map +1 -0
- package/dist/cli/plugin-folder.d.ts +3 -0
- package/dist/cli/plugin-folder.d.ts.map +1 -0
- package/dist/cli/plugin-folder.js +93 -0
- package/dist/cli/plugin-folder.js.map +1 -0
- package/dist/cli/rebuild.d.ts +5 -0
- package/dist/cli/rebuild.d.ts.map +1 -0
- package/dist/cli/rebuild.js +44 -0
- package/dist/cli/rebuild.js.map +1 -0
- package/dist/cli/resend.d.ts +3 -0
- package/dist/cli/resend.d.ts.map +1 -0
- package/dist/cli/resend.js +36 -0
- package/dist/cli/resend.js.map +1 -0
- package/dist/cli/run-job.d.ts +5 -0
- package/dist/cli/run-job.d.ts.map +1 -0
- package/dist/cli/run-job.js +29 -0
- package/dist/cli/run-job.js.map +1 -0
- package/dist/cli/serve.d.ts +3 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +65 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/settings.d.ts +5 -0
- package/dist/cli/settings.d.ts.map +1 -0
- package/dist/cli/settings.js +144 -0
- package/dist/cli/settings.js.map +1 -0
- package/dist/cli/site-plugins.d.ts +5 -0
- package/dist/cli/site-plugins.d.ts.map +1 -0
- package/dist/cli/site-plugins.js +7 -0
- package/dist/cli/site-plugins.js.map +1 -0
- package/dist/cli/strip-metadata.d.ts +3 -0
- package/dist/cli/strip-metadata.d.ts.map +1 -0
- package/dist/cli/strip-metadata.js +20 -0
- package/dist/cli/strip-metadata.js.map +1 -0
- package/dist/cli/sync.d.ts +3 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +22 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/user.d.ts +3 -0
- package/dist/cli/user.d.ts.map +1 -0
- package/dist/cli/user.js +54 -0
- package/dist/cli/user.js.map +1 -0
- package/dist/cli.d.ts +0 -62
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -1566
- package/dist/cli.js.map +1 -1
- package/dist/cms/app.js +10 -10
- package/dist/cms/app.js.map +1 -1
- package/dist/cms/boot.js +5 -5
- package/dist/cms/boot.js.map +1 -1
- package/dist/cms/create.d.ts +17 -17
- package/dist/cms/create.d.ts.map +1 -1
- package/dist/cms/create.js +1 -1
- package/dist/cms/create.js.map +1 -1
- package/dist/cms/server-error.d.ts +1 -1
- package/dist/cms/server-error.js +1 -1
- package/dist/cms/services.js +14 -14
- package/dist/cms/services.js.map +1 -1
- package/dist/comments/akismet.d.ts +4 -4
- package/dist/comments/akismet.js +6 -6
- package/dist/comments/akismet.js.map +1 -1
- package/dist/comments/conversation.d.ts +29 -29
- package/dist/comments/conversation.d.ts.map +1 -1
- package/dist/comments/conversation.js +2 -2
- package/dist/comments/conversation.js.map +1 -1
- package/dist/comments/form.d.ts +3 -3
- package/dist/comments/form.d.ts.map +1 -1
- package/dist/comments/intake.d.ts +4 -4
- package/dist/comments/intake.d.ts.map +1 -1
- package/dist/comments/intake.js +1 -1
- package/dist/comments/migrations.d.ts +3 -3
- package/dist/comments/migrations.js +3 -3
- package/dist/comments/moderate.d.ts +2 -2
- package/dist/comments/moderate.js +2 -2
- package/dist/comments/page-form.d.ts +1 -1
- package/dist/comments/page-form.js +1 -1
- package/dist/comments/records.d.ts +9 -9
- package/dist/comments/records.d.ts.map +1 -1
- package/dist/comments/records.js +11 -10
- package/dist/comments/records.js.map +1 -1
- package/dist/comments/reply-notices.d.ts +2 -2
- package/dist/comments/reply-post.d.ts +2 -2
- package/dist/comments/submission.d.ts +8 -8
- package/dist/comments/submission.d.ts.map +1 -1
- package/dist/comments/submission.js +9 -9
- package/dist/comments/submission.js.map +1 -1
- package/dist/config.d.ts +27 -27
- package/dist/config.js +3 -3
- package/dist/contact/index.d.ts +1 -1
- package/dist/contact/index.js +1 -1
- package/dist/contact/records.d.ts +7 -7
- package/dist/contact/records.js +7 -7
- package/dist/content/alt-text.d.ts +2 -2
- package/dist/content/alt-text.js +2 -2
- package/dist/content/authors.d.ts +6 -6
- package/dist/content/authors.d.ts.map +1 -1
- package/dist/content/authors.js +6 -6
- package/dist/content/authors.js.map +1 -1
- package/dist/content/citation.d.ts +1 -1
- package/dist/content/content-tree.d.ts +5 -0
- package/dist/content/content-tree.d.ts.map +1 -0
- package/dist/content/content-tree.js +54 -0
- package/dist/content/content-tree.js.map +1 -0
- package/dist/content/content-watcher.d.ts +15 -0
- package/dist/content/content-watcher.d.ts.map +1 -0
- package/dist/content/content-watcher.js +104 -0
- package/dist/content/content-watcher.js.map +1 -0
- package/dist/content/document-form.d.ts +25 -24
- package/dist/content/document-form.d.ts.map +1 -1
- package/dist/content/document-form.js +7 -7
- package/dist/content/document-form.js.map +1 -1
- package/dist/content/document-kind.d.ts +6 -6
- package/dist/content/document.d.ts +1 -1
- package/dist/content/enclosure-form.js +1 -1
- package/dist/content/enclosure.js +1 -1
- package/dist/content/event-form.d.ts +2 -2
- package/dist/content/event.d.ts +3 -3
- package/dist/content/event.js +3 -3
- package/dist/content/guids.d.ts +6 -6
- package/dist/content/guids.d.ts.map +1 -1
- package/dist/content/guids.js +7 -7
- package/dist/content/guids.js.map +1 -1
- package/dist/content/handles.d.ts +1 -1
- package/dist/content/handles.js +1 -1
- package/dist/content/html-to-markdown.js +2 -2
- package/dist/content/language.d.ts +1 -1
- package/dist/content/language.js +1 -1
- package/dist/content/locale.d.ts +1 -1
- package/dist/content/locale.js +1 -1
- package/dist/content/markdown.d.ts +1 -1
- package/dist/content/markdown.js +1 -1
- package/dist/content/parser.d.ts +1 -1
- package/dist/content/parser.d.ts.map +1 -1
- package/dist/content/permalinks.d.ts +4 -4
- package/dist/content/permalinks.js +4 -4
- package/dist/content/photo-form.js +2 -2
- package/dist/content/photo.d.ts +2 -2
- package/dist/content/photo.js +1 -1
- package/dist/content/pinned.d.ts +3 -3
- package/dist/content/pinned.js +3 -3
- package/dist/content/post-fields.js +2 -2
- package/dist/content/post-fields.js.map +1 -1
- package/dist/content/post-type.d.ts +4 -4
- package/dist/content/post-type.js +1 -1
- package/dist/content/reconcile.d.ts +15 -0
- package/dist/content/reconcile.d.ts.map +1 -0
- package/dist/content/reconcile.js +106 -0
- package/dist/content/reconcile.js.map +1 -0
- package/dist/content/redirects.d.ts +2 -3
- package/dist/content/redirects.d.ts.map +1 -1
- package/dist/content/redirects.js +2 -3
- package/dist/content/redirects.js.map +1 -1
- package/dist/content/rsvp.d.ts +1 -1
- package/dist/content/rsvp.js +1 -1
- package/dist/content/sanitize.js +1 -1
- package/dist/content/save.d.ts +3 -3
- package/dist/content/save.js +4 -4
- package/dist/content/scan.d.ts +12 -0
- package/dist/content/scan.d.ts.map +1 -0
- package/dist/content/scan.js +58 -0
- package/dist/content/scan.js.map +1 -0
- package/dist/content/search.d.ts +3 -3
- package/dist/content/search.js +3 -3
- package/dist/content/served.d.ts +5 -5
- package/dist/content/served.js +4 -4
- package/dist/content/site-links.d.ts +3 -4
- package/dist/content/site-links.d.ts.map +1 -1
- package/dist/content/site-links.js +1 -2
- package/dist/content/site-links.js.map +1 -1
- package/dist/content/sqlite/clauses.d.ts +1 -1
- package/dist/content/sqlite/clauses.js +1 -1
- package/dist/content/sqlite/rows.d.ts +1 -1
- package/dist/content/sqlite/rows.js +1 -1
- package/dist/content/store.d.ts +26 -26
- package/dist/content/sync.d.ts +3 -3
- package/dist/content/sync.d.ts.map +1 -1
- package/dist/content/sync.js +65 -382
- package/dist/content/sync.js.map +1 -1
- package/dist/content/taxonomy.d.ts +9 -8
- package/dist/content/taxonomy.d.ts.map +1 -1
- package/dist/content/taxonomy.js +9 -8
- package/dist/content/taxonomy.js.map +1 -1
- package/dist/content/time.d.ts +1 -1
- package/dist/content/time.js +1 -1
- package/dist/content/trash.d.ts +4 -5
- package/dist/content/trash.d.ts.map +1 -1
- package/dist/content/trash.js +4 -5
- package/dist/content/trash.js.map +1 -1
- package/dist/content/write.d.ts +4 -4
- package/dist/content/write.js +19 -19
- package/dist/content/write.js.map +1 -1
- package/dist/drain.d.ts +1 -1
- package/dist/drain.js +1 -1
- package/dist/federation/actor.d.ts +9 -9
- package/dist/federation/actor.js +10 -10
- package/dist/federation/article.d.ts +14 -14
- package/dist/federation/article.js +27 -27
- package/dist/federation/article.js.map +1 -1
- package/dist/federation/backfill.d.ts +2 -2
- package/dist/federation/backfill.js +2 -2
- package/dist/federation/citations.d.ts +1 -1
- package/dist/federation/citations.js +1 -1
- package/dist/federation/cited-post.d.ts +1 -1
- package/dist/federation/cited-post.js +1 -1
- package/dist/federation/delivery-plan.d.ts +1 -1
- package/dist/federation/delivery.d.ts +3 -3
- package/dist/federation/delivery.d.ts.map +1 -1
- package/dist/federation/delivery.js +11 -12
- package/dist/federation/delivery.js.map +1 -1
- package/dist/federation/federation.d.ts +3 -3
- package/dist/federation/federation.d.ts.map +1 -1
- package/dist/federation/federation.js +7 -8
- package/dist/federation/federation.js.map +1 -1
- package/dist/federation/handles.d.ts +1 -1
- package/dist/federation/handles.js +1 -1
- package/dist/federation/inbox.d.ts +6 -6
- package/dist/federation/inbox.js +9 -9
- package/dist/federation/keys.d.ts +3 -3
- package/dist/federation/keys.js +3 -3
- package/dist/federation/object-ids.d.ts +1 -1
- package/dist/federation/paths.d.ts +8 -8
- package/dist/federation/paths.js +8 -8
- package/dist/federation/profiles.d.ts +2 -3
- package/dist/federation/profiles.d.ts.map +1 -1
- package/dist/federation/profiles.js +2 -3
- package/dist/federation/profiles.js.map +1 -1
- package/dist/federation/quotes.d.ts +1 -1
- package/dist/federation/records.d.ts +24 -24
- package/dist/federation/records.js +23 -23
- package/dist/federation/records.js.map +1 -1
- package/dist/federation/refusals.d.ts +1 -1
- package/dist/federation/relays.d.ts +1 -1
- package/dist/federation/relays.js +6 -6
- package/dist/federation/webfinger.d.ts +2 -2
- package/dist/federation/webfinger.js +2 -2
- package/dist/files/atomic.d.ts +2 -2
- package/dist/files/atomic.js +1 -1
- package/dist/forms/checker.d.ts +2 -2
- package/dist/forms/checker.d.ts.map +1 -1
- package/dist/forms/protection.d.ts +1 -1
- package/dist/forms/protection.js +1 -1
- package/dist/gemini/certificate.js +1 -1
- package/dist/images/markup.d.ts +2 -2
- package/dist/images/variants.d.ts +8 -8
- package/dist/images/variants.js +1 -1
- package/dist/indexnow.d.ts +1 -1
- package/dist/indieauth/grants.d.ts +2 -2
- package/dist/indieauth/identity.d.ts +3 -5
- package/dist/indieauth/identity.d.ts.map +1 -1
- package/dist/indieauth/identity.js +3 -5
- package/dist/indieauth/identity.js.map +1 -1
- package/dist/indieauth/redeem.d.ts +2 -2
- package/dist/indieauth/redeem.js +2 -2
- package/dist/indieauth/request.d.ts +2 -2
- package/dist/indieauth/request.js +2 -2
- package/dist/indieauth/tokens.d.ts +3 -5
- package/dist/indieauth/tokens.d.ts.map +1 -1
- package/dist/indieauth/tokens.js +3 -5
- package/dist/indieauth/tokens.js.map +1 -1
- package/dist/jobs/file-records.d.ts +1 -1
- package/dist/jobs/file-records.js +1 -1
- package/dist/jobs/in-process.d.ts +1 -1
- package/dist/jobs/in-process.js +1 -1
- package/dist/jobs/queue.d.ts +1 -1
- package/dist/jobs/queue.js +1 -1
- package/dist/mail/provider.d.ts +2 -2
- package/dist/mail/provider.js +2 -2
- package/dist/media/library.d.ts +2 -2
- package/dist/media/uploads.js +2 -2
- package/dist/media/uploads.js.map +1 -1
- package/dist/micropub/create.d.ts +1 -1
- package/dist/micropub/endpoint.d.ts +7 -7
- package/dist/micropub/endpoint.js +8 -8
- package/dist/micropub/endpoint.js.map +1 -1
- package/dist/micropub/media.d.ts +4 -4
- package/dist/micropub/media.js +4 -4
- package/dist/micropub/update.d.ts +1 -1
- package/dist/micropub/update.js +1 -1
- package/dist/notifications/comments.d.ts +1 -1
- package/dist/notifications/comments.js +2 -2
- package/dist/notifications/comments.js.map +1 -1
- package/dist/notifications/digest.d.ts +7 -7
- package/dist/notifications/digest.js +7 -7
- package/dist/notifications/mail-service.d.ts +4 -4
- package/dist/notifications/mail-service.d.ts.map +1 -1
- package/dist/notifications/mail-service.js +3 -3
- package/dist/notifications/mail-templates.d.ts +3 -3
- package/dist/notifications/optouts.d.ts +1 -1
- package/dist/notifications/optouts.js +1 -1
- package/dist/notifications/tokens.d.ts +2 -2
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.js +5 -5
- package/dist/plugins/changes.js +2 -2
- package/dist/plugins/folder.d.ts +2 -2
- package/dist/plugins/folder.js +2 -2
- package/dist/plugins/install.d.ts +1 -1
- package/dist/plugins/install.js +1 -1
- package/dist/plugins/registry.d.ts +1 -1
- package/dist/plugins/registry.js +1 -1
- package/dist/plugins/site.d.ts +1 -1
- package/dist/plugins/site.js +1 -1
- package/dist/privacy/erase.d.ts +1 -1
- package/dist/privacy/erase.js +1 -1
- package/dist/privacy/retention.d.ts +2 -2
- package/dist/privacy/retention.js +2 -2
- package/dist/site/admin-paths.d.ts +2 -2
- package/dist/site/admin-paths.js +2 -2
- package/dist/site/authors.d.ts +6 -6
- package/dist/site/authors.js +5 -5
- package/dist/site/dashboard-layout.d.ts +1 -1
- package/dist/site/indexnow-key.js +1 -1
- package/dist/site/namespace.d.ts +1 -1
- package/dist/site/namespace.js +1 -1
- package/dist/site/navigation.d.ts +10 -10
- package/dist/site/navigation.js +10 -10
- package/dist/site/notification-preferences.d.ts +3 -3
- package/dist/site/notification-preferences.js +2 -2
- package/dist/site/retention-policy.d.ts +1 -1
- package/dist/site/retention-policy.js +1 -1
- package/dist/site/users.d.ts +23 -24
- package/dist/site/users.d.ts.map +1 -1
- package/dist/site/users.js +6 -6
- package/dist/site/users.js.map +1 -1
- package/dist/store/admin-store.d.ts +2 -2
- package/dist/store/comments.d.ts +17 -17
- package/dist/store/comments.d.ts.map +1 -1
- package/dist/store/comments.js +14 -21
- package/dist/store/comments.js.map +1 -1
- package/dist/store/conversation.d.ts +2 -2
- package/dist/store/deliveries.d.ts +1 -1
- package/dist/store/deliveries.d.ts.map +1 -1
- package/dist/store/deliveries.js +10 -15
- package/dist/store/deliveries.js.map +1 -1
- package/dist/store/followers.d.ts +5 -5
- package/dist/store/followers.d.ts.map +1 -1
- package/dist/store/followers.js +7 -10
- package/dist/store/followers.js.map +1 -1
- package/dist/store/inbox-replies.d.ts +4 -4
- package/dist/store/inbox-replies.js +4 -4
- package/dist/store/inbox.d.ts +5 -5
- package/dist/store/inbox.d.ts.map +1 -1
- package/dist/store/inbox.js +21 -34
- package/dist/store/inbox.js.map +1 -1
- package/dist/store/profiles.d.ts +5 -5
- package/dist/store/profiles.d.ts.map +1 -1
- package/dist/store/profiles.js +4 -5
- package/dist/store/profiles.js.map +1 -1
- package/dist/store/relays.d.ts.map +1 -1
- package/dist/store/relays.js +7 -9
- package/dist/store/relays.js.map +1 -1
- package/dist/store/rows.d.ts +6 -20
- package/dist/store/rows.d.ts.map +1 -1
- package/dist/store/rows.js +10 -15
- package/dist/store/rows.js.map +1 -1
- package/dist/store/schema.js +35 -35
- package/dist/store/schema.js.map +1 -1
- package/dist/store/sessions.d.ts +1 -1
- package/dist/store/sessions.d.ts.map +1 -1
- package/dist/store/sessions.js +10 -10
- package/dist/store/sessions.js.map +1 -1
- package/dist/store/state.d.ts.map +1 -1
- package/dist/store/state.js +2 -2
- package/dist/store/state.js.map +1 -1
- package/dist/store/tokens.d.ts +1 -1
- package/dist/store/tokens.d.ts.map +1 -1
- package/dist/store/tokens.js +5 -5
- package/dist/store/tokens.js.map +1 -1
- package/dist/store/webmentions.d.ts +2 -2
- package/dist/store/webmentions.d.ts.map +1 -1
- package/dist/store/webmentions.js +11 -11
- package/dist/store/webmentions.js.map +1 -1
- package/dist/supervisor/plugin-watcher.d.ts +26 -0
- package/dist/supervisor/plugin-watcher.d.ts.map +1 -0
- package/dist/supervisor/plugin-watcher.js +90 -0
- package/dist/supervisor/plugin-watcher.js.map +1 -0
- package/dist/supervisor/primary.d.ts +4 -7
- package/dist/supervisor/primary.d.ts.map +1 -1
- package/dist/supervisor/primary.js +37 -94
- package/dist/supervisor/primary.js.map +1 -1
- package/dist/supervisor/protocol.d.ts +1 -1
- package/dist/supervisor/protocol.js +1 -1
- package/dist/supervisor/reload-queue.d.ts +10 -0
- package/dist/supervisor/reload-queue.d.ts.map +1 -0
- package/dist/supervisor/reload-queue.js +28 -0
- package/dist/supervisor/reload-queue.js.map +1 -0
- package/dist/supervisor/supervision.d.ts +2 -2
- package/dist/supervisor/supervision.js +2 -2
- package/dist/supervisor/worker.d.ts +1 -1
- package/dist/supervisor/worker.js +1 -1
- package/dist/theme/site-data.d.ts +3 -3
- package/dist/theme/site-data.js +2 -2
- package/dist/theme/templates.d.ts +3 -3
- package/dist/theme/templates.js +16 -16
- package/dist/theme/templates.js.map +1 -1
- package/dist/theme/themes.d.ts +11 -13
- package/dist/theme/themes.d.ts.map +1 -1
- package/dist/theme/themes.js +8 -9
- package/dist/theme/themes.js.map +1 -1
- package/dist/web/activity-folding.d.ts +33 -0
- package/dist/web/activity-folding.d.ts.map +1 -0
- package/dist/web/activity-folding.js +238 -0
- package/dist/web/activity-folding.js.map +1 -0
- package/dist/web/archive.d.ts +2 -3
- package/dist/web/archive.d.ts.map +1 -1
- package/dist/web/archive.js +2 -3
- package/dist/web/archive.js.map +1 -1
- package/dist/web/asset-routes.d.ts +1 -1
- package/dist/web/asset-routes.js +1 -1
- package/dist/web/comment-routes.js +2 -2
- package/dist/web/comment-routes.js.map +1 -1
- package/dist/web/compression.d.ts +1 -1
- package/dist/web/compression.js +1 -1
- package/dist/web/context.d.ts +21 -21
- package/dist/web/context.d.ts.map +1 -1
- package/dist/web/context.js +7 -7
- package/dist/web/conversation-context.d.ts +15 -0
- package/dist/web/conversation-context.d.ts.map +1 -0
- package/dist/web/conversation-context.js +2 -0
- package/dist/web/conversation-context.js.map +1 -0
- package/dist/web/conversation-feed.d.ts +18 -0
- package/dist/web/conversation-feed.d.ts.map +1 -0
- package/dist/web/conversation-feed.js +53 -0
- package/dist/web/conversation-feed.js.map +1 -0
- package/dist/web/conversation-gather.d.ts +12 -0
- package/dist/web/conversation-gather.d.ts.map +1 -0
- package/dist/web/conversation-gather.js +189 -0
- package/dist/web/conversation-gather.js.map +1 -0
- package/dist/web/conversation-lookup.d.ts +15 -0
- package/dist/web/conversation-lookup.d.ts.map +1 -0
- package/dist/web/conversation-lookup.js +101 -0
- package/dist/web/conversation-lookup.js.map +1 -0
- package/dist/web/conversation-threads.d.ts +12 -0
- package/dist/web/conversation-threads.d.ts.map +1 -0
- package/dist/web/conversation-threads.js +144 -0
- package/dist/web/conversation-threads.js.map +1 -0
- package/dist/web/conversation.d.ts +25 -61
- package/dist/web/conversation.d.ts.map +1 -1
- package/dist/web/conversation.js +14 -854
- package/dist/web/conversation.js.map +1 -1
- package/dist/web/document-page.js +4 -4
- package/dist/web/document-page.js.map +1 -1
- package/dist/web/document-render.d.ts +9 -0
- package/dist/web/document-render.d.ts.map +1 -0
- package/dist/web/document-render.js +130 -0
- package/dist/web/document-render.js.map +1 -0
- package/dist/web/document-site.d.ts +1 -1
- package/dist/web/document-site.d.ts.map +1 -1
- package/dist/web/document-site.js +1 -1
- package/dist/web/document-site.js.map +1 -1
- package/dist/web/env.d.ts +19 -19
- package/dist/web/env.d.ts.map +1 -1
- package/dist/web/federation-routes.d.ts +2 -2
- package/dist/web/federation-routes.d.ts.map +1 -1
- package/dist/web/federation-routes.js +22 -21
- package/dist/web/federation-routes.js.map +1 -1
- package/dist/web/feed-atom.d.ts +3 -3
- package/dist/web/feed-atom.js +3 -3
- package/dist/web/feed-item.d.ts +15 -16
- package/dist/web/feed-item.d.ts.map +1 -1
- package/dist/web/feed-item.js +1 -1
- package/dist/web/feed-item.js.map +1 -1
- package/dist/web/feed-json.d.ts +4 -4
- package/dist/web/feed-json.d.ts.map +1 -1
- package/dist/web/feed-json.js +2 -2
- package/dist/web/feed-routes.d.ts +3 -3
- package/dist/web/feed-routes.js +4 -4
- package/dist/web/feed-routes.js.map +1 -1
- package/dist/web/feed-rss.d.ts +2 -2
- package/dist/web/feed-rss.js +4 -4
- package/dist/web/feed-rss.js.map +1 -1
- package/dist/web/feed-source.d.ts +5 -5
- package/dist/web/feed-source.d.ts.map +1 -1
- package/dist/web/feed-source.js +2 -2
- package/dist/web/feed-source.js.map +1 -1
- package/dist/web/feed-xml.d.ts +4 -4
- package/dist/web/feed-xml.d.ts.map +1 -1
- package/dist/web/feed-xml.js +4 -4
- package/dist/web/feed-xml.js.map +1 -1
- package/dist/web/font-routes.d.ts +1 -1
- package/dist/web/font-routes.js +1 -1
- package/dist/web/health.d.ts +1 -1
- package/dist/web/index.d.ts +5 -3
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +4 -2
- package/dist/web/index.js.map +1 -1
- package/dist/web/indieauth-activity-log.js +1 -1
- package/dist/web/indieauth-bearer.d.ts +2 -2
- package/dist/web/indieauth-discovery.d.ts +12 -12
- package/dist/web/indieauth-discovery.d.ts.map +1 -1
- package/dist/web/indieauth-discovery.js +12 -12
- package/dist/web/indieauth-discovery.js.map +1 -1
- package/dist/web/indieauth-token.d.ts +2 -2
- package/dist/web/indieauth-token.js +2 -2
- package/dist/web/listing-render.d.ts +11 -0
- package/dist/web/listing-render.d.ts.map +1 -0
- package/dist/web/listing-render.js +76 -0
- package/dist/web/listing-render.js.map +1 -0
- package/dist/web/listing-subject.js +1 -1
- package/dist/web/listing-subject.js.map +1 -1
- package/dist/web/llms.d.ts +1 -1
- package/dist/web/llms.js +1 -1
- package/dist/web/maintenance.d.ts +1 -1
- package/dist/web/maintenance.js +1 -1
- package/dist/web/manifest.d.ts +1 -1
- package/dist/web/manifest.js +1 -1
- package/dist/web/markdown-chrome.d.ts +11 -0
- package/dist/web/markdown-chrome.d.ts.map +1 -0
- package/dist/web/markdown-chrome.js +178 -0
- package/dist/web/markdown-chrome.js.map +1 -0
- package/dist/web/markdown-conversation.d.ts +1 -1
- package/dist/web/markdown-conversation.d.ts.map +1 -1
- package/dist/web/markdown-environment.d.ts +10 -0
- package/dist/web/markdown-environment.d.ts.map +1 -0
- package/dist/web/markdown-environment.js +56 -0
- package/dist/web/markdown-environment.js.map +1 -0
- package/dist/web/markdown-representation.d.ts +1 -1
- package/dist/web/markdown-representation.d.ts.map +1 -1
- package/dist/web/markdown-representation.js +2 -2
- package/dist/web/markdown-representation.js.map +1 -1
- package/dist/web/negotiate.d.ts +9 -6
- package/dist/web/negotiate.d.ts.map +1 -1
- package/dist/web/negotiate.js +17 -13
- package/dist/web/negotiate.js.map +1 -1
- package/dist/web/oembed.d.ts +3 -3
- package/dist/web/oembed.js +3 -3
- package/dist/web/opensearch.d.ts +1 -1
- package/dist/web/opensearch.js +1 -1
- package/dist/web/page-context.d.ts +29 -0
- package/dist/web/page-context.d.ts.map +1 -0
- package/dist/web/page-context.js +126 -0
- package/dist/web/page-context.js.map +1 -0
- package/dist/web/page-tags.js +1 -1
- package/dist/web/page-tags.js.map +1 -1
- package/dist/web/paths.d.ts +1 -1
- package/dist/web/paths.js +3 -3
- package/dist/web/plugin-federation.d.ts +1 -1
- package/dist/web/plugin-federation.js +1 -1
- package/dist/web/render-scope.d.ts +20 -0
- package/dist/web/render-scope.d.ts.map +1 -0
- package/dist/web/render-scope.js +36 -0
- package/dist/web/render-scope.js.map +1 -0
- package/dist/web/render.d.ts +21 -363
- package/dist/web/render.d.ts.map +1 -1
- package/dist/web/render.js +46 -899
- package/dist/web/render.js.map +1 -1
- package/dist/web/request.d.ts +1 -1
- package/dist/web/request.js +1 -1
- package/dist/web/robots.d.ts +1 -1
- package/dist/web/robots.js +1 -1
- package/dist/web/routes.js +19 -19
- package/dist/web/routes.js.map +1 -1
- package/dist/web/search.d.ts +1 -1
- package/dist/web/search.js +1 -1
- package/dist/web/session.d.ts +8 -8
- package/dist/web/session.js +8 -8
- package/dist/web/share-image.d.ts +2 -3
- package/dist/web/share-image.d.ts.map +1 -1
- package/dist/web/share-image.js +1 -1
- package/dist/web/share-image.js.map +1 -1
- package/dist/web/site-view.d.ts +2 -2
- package/dist/web/status-pages.d.ts +1 -1
- package/dist/web/status-pages.d.ts.map +1 -1
- package/dist/web/theme-environment.d.ts +14 -0
- package/dist/web/theme-environment.d.ts.map +1 -0
- package/dist/web/theme-environment.js +112 -0
- package/dist/web/theme-environment.js.map +1 -0
- package/dist/web/theme-templates.d.ts +67 -0
- package/dist/web/theme-templates.d.ts.map +1 -0
- package/dist/web/theme-templates.js +65 -0
- package/dist/web/theme-templates.js.map +1 -0
- package/dist/webmention/microformats.d.ts +5 -5
- package/dist/webmention/microformats.d.ts.map +1 -1
- package/dist/webmention/receive.d.ts +7 -7
- package/dist/webmention/receive.d.ts.map +1 -1
- package/dist/webmention/receive.js +4 -4
- package/dist/webmention/receive.js.map +1 -1
- package/dist/webmention/reply-context/oembed.js +1 -1
- package/dist/webmention/reply-context.d.ts +10 -10
- package/dist/webmention/reply-context.d.ts.map +1 -1
- package/dist/webmention/reply-context.js +5 -5
- package/dist/webmention/reply-contexts.d.ts +6 -6
- package/dist/webmention/reply-contexts.d.ts.map +1 -1
- package/dist/webmention/reply-contexts.js +2 -2
- package/dist/webmention/service.d.ts +13 -13
- package/dist/webmention/service.js +9 -9
- package/dist/webmention/syndication.d.ts +6 -6
- package/dist/webmention/syndication.d.ts.map +1 -1
- package/dist/webmention/syndication.js +6 -6
- package/dist/webmention/syndication.js.map +1 -1
- package/package.json +2 -2
package/dist/web/render.js
CHANGED
|
@@ -1,914 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { MAXIMUM_FORM_AGE_SECONDS } from '../forms/protection.js';
|
|
12
|
-
import { iconSetting, siteIcons } from '../images/icons.js';
|
|
13
|
-
import { LLMS_TXT_PATH } from './llms.js';
|
|
14
|
-
import { archiveMonths, archiveOpen } from './archive.js';
|
|
15
|
-
import { authorContext, siteAuthorContext } from '../site/authors.js';
|
|
16
|
-
import { backlinkContext, citedPhotoContext, citedPictureContext, documentContext, locationContext, syndicationLinks, } from './context.js';
|
|
17
|
-
import { createSiteDataSource, frontPageSlugs, postsPerPage, siteColors, siteLocale, siteTimezone, taxonomyBases, termRedirects, themeName, } from '../theme/site-data.js';
|
|
18
|
-
import { commentAnchor } from '../comments/conversation.js';
|
|
19
|
-
import { commentPageHref } from '../content/guids.js';
|
|
20
|
-
import { activityStreamsId } from '../content/permalinks.js';
|
|
21
|
-
import { currentObjectId, readObjectIds } from '../federation/object-ids.js';
|
|
22
|
-
import { isServed } from '../content/served.js';
|
|
23
|
-
import { calendarDayIn } from '../content/time.js';
|
|
24
|
-
import { commentsFeedPath } from './feeds.js';
|
|
25
|
-
import { markdownConversation } from './markdown-conversation.js';
|
|
26
|
-
import { bioOf, escapeMarkdown, HOME_LINK, oneLine } from './markdown-page.js';
|
|
27
|
-
import { navigationLinks, navigationMenus } from '../site/navigation.js';
|
|
28
|
-
import { resolveLicense } from '../content/license.js';
|
|
29
|
-
import { shareImage } from './share-image.js';
|
|
30
|
-
import { snippetHtml } from './search.js';
|
|
31
|
-
import { termHref } from '../content/taxonomy.js';
|
|
32
|
-
import { createTemplateEnvironment, useThemeDirs } from '../theme/templates.js';
|
|
33
|
-
import { createThemeSource, findThemeFile } from '../theme/themes.js';
|
|
34
|
-
import { representationHref } from './negotiate.js';
|
|
35
|
-
import { schemeTokens } from '../theme/scheme-tokens.js';
|
|
36
|
-
import { formatFileSize } from '../util/file-size.js';
|
|
37
|
-
import { absoluteUrl } from '../util/url.js';
|
|
38
|
-
import { capsuleUrl } from '../gemini/capsule.js';
|
|
39
|
-
import { citedPictureAlt } from '../webmention/cited-picture.js';
|
|
40
|
-
import { readCitedStart } from '../webmention/cited-start.js';
|
|
41
|
-
import { handSyndicationOf } from '../webmention/syndication.js';
|
|
42
|
-
import { pingbackEndpointFor } from '../webmention/pingback.js';
|
|
43
|
-
import { webmentionEndpointFor } from '../webmention/endpoint.js';
|
|
44
|
-
/** Templates the default theme ships and the public routes ask for by name. */
|
|
45
|
-
export const TEMPLATES = {
|
|
46
|
-
home: 'layouts/home.njk',
|
|
47
|
-
post: 'layouts/post.njk',
|
|
48
|
-
page: 'layouts/page.njk',
|
|
49
|
-
tag: 'layouts/tag.njk',
|
|
50
|
-
category: 'layouts/category.njk',
|
|
51
|
-
author: 'layouts/author.njk',
|
|
52
|
-
search: 'layouts/search.njk',
|
|
53
|
-
comment: 'layouts/comment.njk',
|
|
54
|
-
notFound: 'layouts/404.njk',
|
|
55
|
-
gone: 'layouts/410.njk',
|
|
56
|
-
serverError: 'layouts/500.njk',
|
|
57
|
-
maintenance: 'layouts/503.njk',
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* The two templates named for the Reading choice, which a theme may write and
|
|
61
|
-
* which fall back to an ordinary layout when it has not.
|
|
62
|
-
*
|
|
63
|
-
* They are WordPress's own `front-page.php` and `home.php`, and they exist for
|
|
64
|
-
* the same reason: a front page is often the one page of a site that looks
|
|
65
|
-
* like nothing else, and saying so should not mean overriding the layout every
|
|
66
|
-
* other page uses. The default theme ships `front-page.njk` (TASK-85) and no
|
|
67
|
-
* posts page layout, so a site that sets a posts page gets the listing layout
|
|
68
|
-
* until it writes one.
|
|
69
|
-
*/
|
|
70
|
-
export const OPTIONAL_TEMPLATES = {
|
|
71
|
-
/**
|
|
72
|
-
* The front page alone. The default theme ships one (TASK-85), so the
|
|
73
|
-
* fallback is only reached by a theme that replaced it with nothing.
|
|
74
|
-
*/
|
|
75
|
-
frontPage: 'layouts/front-page.njk',
|
|
76
|
-
/** The listing on the posts page. Falls back to {@link TEMPLATES.home}. */
|
|
77
|
-
postsPage: 'layouts/posts-page.njk',
|
|
78
|
-
};
|
|
79
|
-
const CHROME_TEMPLATES = {
|
|
80
|
-
header: { markdown: 'partials/markdown-header.md.njk', gemini: 'partials/gemini-header.gmi.njk' },
|
|
81
|
-
footer: { markdown: 'partials/markdown-footer.md.njk', gemini: 'partials/gemini-footer.gmi.njk' },
|
|
82
|
-
};
|
|
83
|
-
const signedInReader = new AsyncLocalStorage();
|
|
84
|
-
/** Run `draw` as the request of a signed-in reader, so its pages say `signedIn`. */
|
|
85
|
-
export function drawnForSignedInReader(draw) {
|
|
86
|
-
return signedInReader.run(true, draw);
|
|
87
|
-
}
|
|
88
|
-
const requestInputs = new AsyncLocalStorage();
|
|
89
|
-
export function drawnWith(inputs, draw) {
|
|
90
|
-
return requestInputs.run(inputs, draw);
|
|
91
|
-
}
|
|
92
|
-
const pageTags = new AsyncLocalStorage();
|
|
93
|
-
export function drawnWithPageTags(tags, draw) {
|
|
94
|
-
return pageTags.run(tags, draw);
|
|
95
|
-
}
|
|
96
|
-
function pluginTagsContext() {
|
|
97
|
-
const { headEnd, bodyEnd } = pageTags.getStore() ?? NO_PAGE_TAGS;
|
|
98
|
-
return {
|
|
99
|
-
headEnd: new nunjucks.runtime.SafeString(headEnd),
|
|
100
|
-
bodyEnd: new nunjucks.runtime.SafeString(bodyEnd),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function requestSite() {
|
|
104
|
-
return requestInputs.getStore()?.site ?? DEFAULT_SITE_SETTINGS;
|
|
105
|
-
}
|
|
106
|
-
function pageFontsContext(fonts) {
|
|
107
|
-
return {
|
|
108
|
-
stylesheets: [...new Set(fonts.map((font) => font.href))],
|
|
109
|
-
properties: fonts.map((font) => ({ property: font.font.property, value: font.value })),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/** Half the time a form stays submittable: the oldest stamp a 304 hands back. */
|
|
113
|
-
const STAMP_WINDOW_MS = (MAXIMUM_FORM_AGE_SECONDS * 1000) / 2;
|
|
1
|
+
import { createSiteDataSource, frontPageSlugs, postsPerPage, taxonomyBases, termRedirects, themeName, } from '../theme/site-data.js';
|
|
2
|
+
import { createThemeSource } from '../theme/themes.js';
|
|
3
|
+
import { createDocumentPages } from './document-render.js';
|
|
4
|
+
import { createListingPages } from './listing-render.js';
|
|
5
|
+
import { createMarkdownChrome } from './markdown-chrome.js';
|
|
6
|
+
import { createMarkdownEnvironment } from './markdown-environment.js';
|
|
7
|
+
import { createPageContexts } from './page-context.js';
|
|
8
|
+
import { requestSite } from './render-scope.js';
|
|
9
|
+
import { createThemeEnvironment, siteColorsWithTokens } from './theme-environment.js';
|
|
10
|
+
import { STATUS_PAGES, untilContext } from './theme-templates.js';
|
|
114
11
|
export function createRenderer(options) {
|
|
115
|
-
const
|
|
116
|
-
const siteData =
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// Random per renderer so no post, reply or theme text can spell it.
|
|
123
|
-
const stampMark = `geekity-stamp-${randomUUID()}`;
|
|
124
|
-
// Which theme every render below reads from. Built here when the caller did
|
|
125
|
-
// not bring one so that a renderer made on its own — a test over one
|
|
126
|
-
// template, a site rendering a fragment of its own — still follows the
|
|
127
|
-
// `theme` in `site.json`; `createCms` hands in the one the mail templates
|
|
128
|
-
// and the `/theme/` assets share, so a site has a single answer and logs a
|
|
129
|
-
// bad choice once.
|
|
130
|
-
const themes = options.themes ??
|
|
131
|
-
createThemeSource({ themesDir: config.themesDir, chosen: () => themeName(siteData.read()) });
|
|
132
|
-
const environment = createTemplateEnvironment({
|
|
133
|
-
themeDirs: themes.current().dirs,
|
|
134
|
-
baseUrl: config.baseUrl,
|
|
135
|
-
now: config.now,
|
|
136
|
-
noCache: config.watch,
|
|
137
|
-
});
|
|
138
|
-
const markdownEnvironment = createTemplateEnvironment({
|
|
139
|
-
themeDirs: themes.current().dirs,
|
|
140
|
-
baseUrl: config.baseUrl,
|
|
141
|
-
now: config.now,
|
|
142
|
-
noCache: config.watch,
|
|
143
|
-
autoescape: false,
|
|
144
|
-
});
|
|
145
|
-
markdownEnvironment.addFilter('escapeMarkdown', (value) => escapeMarkdown(filterText(value)));
|
|
146
|
-
markdownEnvironment.addFilter('fileSize', (value) => typeof value === 'number' ? formatFileSize(value) : '');
|
|
147
|
-
markdownEnvironment.addFilter('nest', (value, width) => nest(value instanceof nunjucks.runtime.SafeString ? value.toString() : filterText(value), typeof width === 'number' ? width : 2));
|
|
148
|
-
markdownEnvironment.addFilter('quote', (value) => quote(filterText(value)));
|
|
149
|
-
for (const name of ['markdownUrl', 'geminiUrl']) {
|
|
150
|
-
markdownEnvironment.addFilter(name, function (value) {
|
|
151
|
-
const url = filterText(value);
|
|
152
|
-
const lookup = this?.lookup;
|
|
153
|
-
const write = typeof lookup === 'function' ? lookup.call(this, name) : undefined;
|
|
154
|
-
return typeof write === 'function' ? write(url) : url;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
const pages = options.pages ?? (() => []);
|
|
158
|
-
const users = options.users ?? (() => []);
|
|
159
|
-
function render(template, context = {}) {
|
|
160
|
-
const site = siteData.read();
|
|
161
|
-
// Before anything is looked up: a theme chosen on the Appearance screen, or
|
|
162
|
-
// written into `site.json` by hand, decides this very render rather than
|
|
163
|
-
// the next boot. It costs a comparison of two short arrays when nothing
|
|
164
|
-
// has changed, which is every render of a site that is not being rethemed.
|
|
165
|
-
const chosen = themes.current();
|
|
166
|
-
useThemeDirs(environment, chosen.dirs);
|
|
167
|
-
// The menus are built here rather than by each caller because every page
|
|
168
|
-
// of the site carries them: a listing, a document, the 404 and the
|
|
169
|
-
// editor's preview all go through here, and a menu that appeared on some
|
|
170
|
-
// of them and not others would be a worse contract than one that is
|
|
171
|
-
// simply always there. It is `menus` rather than `menus` read off `site`
|
|
172
|
-
// because these items know which one the reader is on; a template reading
|
|
173
|
-
// `site.menus` would be reading the raw lists.
|
|
174
|
-
//
|
|
175
|
-
// Every menu the site stores is here, keyed by name, not only the ones the
|
|
176
|
-
// theme declares an area for: a name nothing loops over is rendered
|
|
177
|
-
// nowhere and kept (TASK-107), and the declaration in `theme.json` is for
|
|
178
|
-
// the screen that edits menus rather than a filter on the render.
|
|
179
|
-
const menus = navigationMenus({ site, url: currentUrl(context) });
|
|
180
|
-
// Who the page is by, for the bio, the `rel="me"` links and the structured
|
|
181
|
-
// data (decision-16). It is here rather than in each caller because every
|
|
182
|
-
// page of the site carries it, for the reason the menus do — and it is
|
|
183
|
-
// the site's own author only when the page is about nobody in particular:
|
|
184
|
-
// a document's byline and an author archive's person are put on the
|
|
185
|
-
// context by the callers below, and win by going on last.
|
|
186
|
-
const siteOwner = siteAuthorContext(users(), site.author);
|
|
187
|
-
const owner = context['siteAuthor'] === undefined ? siteOwner : undefined;
|
|
188
|
-
// The site's icons, as the links a head carries (TASK-81, TASK-147). They
|
|
189
|
-
// are computed here rather than in the layout because only this side knows
|
|
190
|
-
// where a derived file is served and whether the site can derive one at
|
|
191
|
-
// all: a theme that was handed the icon's path would have to build the URL
|
|
192
|
-
// itself and would link 404s on a site with image optimization off.
|
|
193
|
-
const icons = siteIcons(config, iconSetting(site));
|
|
194
|
-
// The icon a header prints before the title, when the site asks for one
|
|
195
|
-
// (TASK-486): the SVG itself if it is one, which is sharp at any size.
|
|
196
|
-
const headerIcon = site['headerIcon'] === true ? svgElseTouchIconHref(icons) : undefined;
|
|
197
|
-
// The picture a shared link shows (TASK-146), here for the reason the
|
|
198
|
-
// icons are: its alt text and its size are in files only this side reads.
|
|
199
|
-
const title = [context['title'], context['label']].find((value) => typeof value === 'string' && value !== '');
|
|
200
|
-
const by = (context['siteAuthor'] ?? siteOwner);
|
|
201
|
-
// A photo post is shown by its first photo (TASK-166).
|
|
202
|
-
const [photo] = (context['photos'] ?? []);
|
|
203
|
-
const image = shareImage({
|
|
204
|
-
config,
|
|
205
|
-
image: context['image'],
|
|
206
|
-
imageAlt: context['imageAlt'],
|
|
207
|
-
title: title ?? site.title,
|
|
208
|
-
fallbacks: [
|
|
209
|
-
...(photo === undefined
|
|
210
|
-
? []
|
|
211
|
-
: [{ url: photo.url, describedAs: photo.alt || (title ?? site.title) }]),
|
|
212
|
-
{ url: site.avatar, describedAs: siteOwner?.name ?? site.title },
|
|
213
|
-
{ url: by?.avatar, describedAs: by?.name ?? site.title },
|
|
214
|
-
{ url: iconSetting(site), describedAs: site.title },
|
|
215
|
-
],
|
|
216
|
-
});
|
|
217
|
-
const fonts = options.fonts?.(site, chosen.fonts) ?? [];
|
|
218
|
-
return environment.render(template, {
|
|
219
|
-
site,
|
|
220
|
-
menus,
|
|
221
|
-
icons,
|
|
222
|
-
...(fonts.length === 0 ? {} : { fonts: pageFontsContext(fonts) }),
|
|
223
|
-
theme: { ...chosen.colors, ...siteColors(site, chosen.schemes) },
|
|
224
|
-
// Where the index for language models is (TASK-149), while the site
|
|
225
|
-
// serves one, so a theme asks `{% if llmsTxt %}`.
|
|
226
|
-
...(site['llmsTxt'] === false ? {} : { llmsTxt: LLMS_TXT_PATH }),
|
|
227
|
-
...(headerIcon === undefined ? {} : { headerIcon }),
|
|
228
|
-
...(image === undefined ? {} : { shareImage: image }),
|
|
229
|
-
...(owner === undefined ? {} : { siteAuthor: owner }),
|
|
230
|
-
// Who the homepage speaks for, on a site whose author is a user (TASK-180,
|
|
231
|
-
// TASK-192): the bio on the homepage and the `rel="me"` claims between
|
|
232
|
-
// it and their archive. Every page carries it, because the archive is
|
|
233
|
-
// where the claim back is printed. A site with several authors has none.
|
|
234
|
-
...(siteOwner === undefined ? {} : { soloAuthor: siteOwner }),
|
|
235
|
-
...context,
|
|
236
|
-
...licenseContext(site, context),
|
|
237
|
-
devMode: requestInputs.getStore()?.devMode === true,
|
|
238
|
-
signedIn: signedInReader.getStore() === true,
|
|
239
|
-
pluginTags: pluginTagsContext(),
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* What the pages a post cites say about themselves, as a theme reads them,
|
|
244
|
-
* when they were fetched. `replyContext` is what a reply answers (TASK-123),
|
|
245
|
-
* on the context only when it is known, so a theme draws the bare link from
|
|
246
|
-
* `inReplyTo` and fills it in from it. `citations` is what it reposts, likes
|
|
247
|
-
* or bookmarks, each with its `context` when that is known (TASK-244).
|
|
248
|
-
*/
|
|
249
|
-
function citedBy(document) {
|
|
250
|
-
const shown = previewShown(document.extra);
|
|
251
|
-
const contextOf = (target, property) => {
|
|
252
|
-
const cited = citedPage?.(target);
|
|
253
|
-
if (cited === undefined)
|
|
254
|
-
return undefined;
|
|
255
|
-
const { picture, author, ...rest } = cited;
|
|
256
|
-
const image = citesAnImage(cited);
|
|
257
|
-
const alt = citedPictureAlt(property, cited, document);
|
|
258
|
-
const { photo, ...named } = author ?? { name: '' };
|
|
259
|
-
return {
|
|
260
|
-
...replyContextFor(rest),
|
|
261
|
-
...(author === undefined
|
|
262
|
-
? {}
|
|
263
|
-
: {
|
|
264
|
-
author: {
|
|
265
|
-
...named,
|
|
266
|
-
...(photo === undefined || !shown
|
|
267
|
-
? {}
|
|
268
|
-
: { photo: citedPhotoContext(photo, config) }),
|
|
269
|
-
},
|
|
270
|
-
}),
|
|
271
|
-
...(image ? { image } : {}),
|
|
272
|
-
...(picture === undefined || !shown
|
|
273
|
-
? {}
|
|
274
|
-
: { picture: citedPictureContext(picture, property, alt, config) }),
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
const target = replyTarget(document);
|
|
278
|
-
const replyContext = target === undefined ? undefined : contextOf(target, 'in-reply-to');
|
|
279
|
-
return {
|
|
280
|
-
...(replyContext === undefined ? {} : { replyContext }),
|
|
281
|
-
citations: citationsOf(document.extra).map((citation) => {
|
|
282
|
-
const context = contextOf(citation.url, citation.property);
|
|
283
|
-
return context === undefined ? citation : { ...citation, context };
|
|
284
|
-
}),
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* One entry of a listing: the document as a template sees it, and what it
|
|
289
|
-
* answers when it is a reply, so a feed cites a reply's target the way the
|
|
290
|
-
* reply's own page does (doc-9).
|
|
291
|
-
*/
|
|
292
|
-
function entryContext(document, people, loading) {
|
|
293
|
-
const context = documentContext(document, config, authorContext(people, document.author), loading, citedPage);
|
|
294
|
-
return { ...context, ...citedBy(document) };
|
|
295
|
-
}
|
|
296
|
-
function newestPostsContext(page) {
|
|
297
|
-
const source = options.newestPosts;
|
|
298
|
-
if (source === undefined)
|
|
299
|
-
return {};
|
|
300
|
-
const pageLeads = page.html.includes('<img');
|
|
301
|
-
return {
|
|
302
|
-
newestPosts: (count) => {
|
|
303
|
-
if (typeof count !== 'number' || !Number.isInteger(count) || count < 1) {
|
|
304
|
-
throw new RangeError(`newestPosts(count) takes a whole number of posts, at least 1, not ${String(count)}`);
|
|
305
|
-
}
|
|
306
|
-
const people = users();
|
|
307
|
-
return source(count).map((document, index) => entryContext(document, people, { lead: !pageLeads && index === 0 }));
|
|
308
|
-
},
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* The whole archive as the months an archive page heads, or nothing at all
|
|
313
|
-
* for every other document.
|
|
314
|
-
*
|
|
315
|
-
* The front matter key decides, so the list is on the context of exactly the
|
|
316
|
-
* page that asked for it and a layout writes `{% if archiveMonths %}` rather
|
|
317
|
-
* than reading front matter for itself — the way `contactForm` works.
|
|
318
|
-
*/
|
|
319
|
-
function archiveContext(document) {
|
|
320
|
-
const months = archiveOf(document);
|
|
321
|
-
return months === undefined ? {} : { archiveMonths: months };
|
|
322
|
-
}
|
|
323
|
-
function archiveOf(document) {
|
|
324
|
-
if (!archiveOpen(document))
|
|
325
|
-
return undefined;
|
|
326
|
-
const posts = options.archivePosts?.();
|
|
327
|
-
if (posts === undefined)
|
|
328
|
-
return undefined;
|
|
329
|
-
const site = siteData.read();
|
|
330
|
-
return archiveMonths(posts, siteTimezone(site), siteLocale(site), citedPage);
|
|
331
|
-
}
|
|
332
|
-
function markdownArchiveContext(document, gemfeed) {
|
|
333
|
-
const months = document === undefined ? undefined : archiveOf(document);
|
|
334
|
-
if (months === undefined)
|
|
335
|
-
return {};
|
|
336
|
-
const timezone = siteTimezone(siteData.read());
|
|
337
|
-
const markdownMonths = months.map(({ month, posts }) => ({
|
|
338
|
-
month,
|
|
339
|
-
posts: posts.map((entry) => ({
|
|
340
|
-
label: entry.title,
|
|
341
|
-
url: entry.url,
|
|
342
|
-
date: calendarDayIn(entry.date, timezone),
|
|
343
|
-
description: gemfeed || entry.description === undefined ? undefined : oneLine(entry.description),
|
|
344
|
-
})),
|
|
345
|
-
}));
|
|
346
|
-
return { archiveMonths: markdownMonths };
|
|
347
|
-
}
|
|
348
|
-
function markdownLinksContext(document) {
|
|
349
|
-
if (document === undefined)
|
|
350
|
-
return {};
|
|
351
|
-
const site = siteData.read();
|
|
352
|
-
const bases = taxonomyBases(site);
|
|
353
|
-
const timezone = siteTimezone(site);
|
|
354
|
-
const terms = (taxonomy, names) => document.type === 'post'
|
|
355
|
-
? names.map((term) => ({ label: term, url: termHref({ taxonomy, term }, 0, bases) }))
|
|
356
|
-
: [];
|
|
357
|
-
const backlinks = (options.backlinks?.(document) ?? []).map((linking) => ({
|
|
358
|
-
label: postLabel(linking, citedPage),
|
|
359
|
-
url: linking.permalink,
|
|
360
|
-
date: linking.date === undefined ? undefined : calendarDayIn(linking.date, timezone),
|
|
361
|
-
}));
|
|
362
|
-
return {
|
|
363
|
-
categories: terms('category', document.categories),
|
|
364
|
-
tags: terms('tag', document.tags),
|
|
365
|
-
backlinks,
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
function markdownKindContext(document) {
|
|
369
|
-
if (document?.type !== 'post')
|
|
370
|
-
return {};
|
|
371
|
-
const { postType, lang, rsvp, event, review, enclosure, photos } = documentContext(document, config, undefined, undefined, citedPage);
|
|
372
|
-
const cite = (verb, target) => {
|
|
373
|
-
const context = citedPage?.(target);
|
|
374
|
-
const url = context?.original ?? target;
|
|
375
|
-
const name = citedPageName(url, context);
|
|
376
|
-
const author = context?.author?.name.trim();
|
|
377
|
-
const named = author !== undefined &&
|
|
378
|
-
author !== '' &&
|
|
379
|
-
name.trim().toLowerCase().endsWith(` by ${author.toLowerCase()}`);
|
|
380
|
-
const { startDate, startZone, published } = replyContextFor(context ?? { url });
|
|
381
|
-
return {
|
|
382
|
-
verb,
|
|
383
|
-
url,
|
|
384
|
-
name,
|
|
385
|
-
...(author === undefined || named ? {} : { author }),
|
|
386
|
-
...(author === undefined && context?.site !== undefined ? { site: context.site } : {}),
|
|
387
|
-
...(startDate instanceof Date
|
|
388
|
-
? { startDate, ...(typeof startZone === 'string' ? { startZone } : {}) }
|
|
389
|
-
: published instanceof Date
|
|
390
|
-
? { published }
|
|
391
|
-
: {}),
|
|
392
|
-
...(context?.location === undefined ? {} : { location: context.location }),
|
|
393
|
-
...(context?.original === undefined ? {} : { copy: target }),
|
|
394
|
-
};
|
|
395
|
-
};
|
|
396
|
-
const target = replyTarget(document);
|
|
397
|
-
const cites = [
|
|
398
|
-
...(target === undefined
|
|
399
|
-
? []
|
|
400
|
-
: [cite(rsvp === undefined ? 'In reply to' : RSVP_PHRASES[rsvp.value], target)]),
|
|
401
|
-
...citationsOf(document.extra).map((citation) => cite(CITATION_VERBS[citation.property], citation.url)),
|
|
402
|
-
];
|
|
403
|
-
const shared = options.location?.(document, requestSite());
|
|
404
|
-
return {
|
|
405
|
-
postType,
|
|
406
|
-
...(lang === undefined ? {} : { lang }),
|
|
407
|
-
cites,
|
|
408
|
-
photos: photos.map(({ url, alt }) => ({ url, alt })),
|
|
409
|
-
...(enclosure === undefined ? {} : { enclosure }),
|
|
410
|
-
...(rsvp === undefined ? {} : { rsvp: { value: rsvp.value, label: rsvp.label } }),
|
|
411
|
-
...(event === undefined ? {} : { event }),
|
|
412
|
-
...(review === undefined
|
|
413
|
-
? {}
|
|
414
|
-
: {
|
|
415
|
-
review: {
|
|
416
|
-
item: review.item,
|
|
417
|
-
kindLabel: review.kindLabel,
|
|
418
|
-
...(review.rating === undefined ? {} : { rating: review.rating }),
|
|
419
|
-
best: review.best,
|
|
420
|
-
...reviewWords(review),
|
|
421
|
-
},
|
|
422
|
-
}),
|
|
423
|
-
...(shared === undefined ? {} : { location: locationContext(shared) }),
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
function strangerCommentForm(document) {
|
|
427
|
-
const signedOut = undefined;
|
|
428
|
-
const offersNotifications = false;
|
|
429
|
-
return options.commentForm?.(document, signedOut, offersNotifications);
|
|
430
|
-
}
|
|
431
|
-
function markdownConversationContext(document, url) {
|
|
432
|
-
if (document === undefined)
|
|
433
|
-
return {};
|
|
434
|
-
const said = options.conversation?.(document, requestSite());
|
|
435
|
-
const page = absoluteUrl(url, config.baseUrl);
|
|
436
|
-
const takesComments = strangerCommentForm(document) !== undefined;
|
|
437
|
-
const webmention = webmentionEndpointFor(siteData.read());
|
|
438
|
-
return {
|
|
439
|
-
...(said === undefined || said.counts.total === 0
|
|
440
|
-
? {}
|
|
441
|
-
: { conversation: markdownConversation(said) }),
|
|
442
|
-
...(takesComments ? { commentForm: { url: `${page}#respond` } } : {}),
|
|
443
|
-
...(options.contactForm?.(document) === undefined
|
|
444
|
-
? {}
|
|
445
|
-
: { contactForm: { url: `${page}#contact` } }),
|
|
446
|
-
...(webmention === undefined ? {} : { webmention }),
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* The page whose own URL carries the listing, as the link a front page draws
|
|
451
|
-
* to it, or nothing at all when the site names none.
|
|
452
|
-
*
|
|
453
|
-
* Resolved here rather than by the route because the renderer already holds
|
|
454
|
-
* both halves — the setting and the published pages — and because the link
|
|
455
|
-
* is the front page's alone: everywhere else the posts page is an ordinary
|
|
456
|
-
* item of the site menu.
|
|
457
|
-
*/
|
|
458
|
-
function postsPageContext() {
|
|
459
|
-
const slug = frontPageSlugs(siteData.read()).postsPage;
|
|
460
|
-
if (slug === '')
|
|
461
|
-
return {};
|
|
462
|
-
const found = pages().find((document) => document.slug === slug);
|
|
463
|
-
return found === undefined
|
|
464
|
-
? {}
|
|
465
|
-
: { postsPage: { title: postLabel(found), url: found.permalink } };
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Which template one listing renders through: whatever it named, the posts
|
|
469
|
-
* page's own template when it is one and the theme ships one, and the home
|
|
470
|
-
* layout otherwise.
|
|
471
|
-
*/
|
|
472
|
-
function listingTemplate(listing) {
|
|
473
|
-
if (listing.template !== undefined)
|
|
474
|
-
return listing.template;
|
|
475
|
-
if (listing.document === undefined)
|
|
476
|
-
return TEMPLATES.home;
|
|
477
|
-
return themeTemplate(themes.current().dirs, OPTIONAL_TEMPLATES.postsPage, TEMPLATES.home);
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* One document through one template, with everything a page of the theme is
|
|
481
|
-
* given: its own context, its ActivityStreams id, its conversation, its
|
|
482
|
-
* forms and its webmention endpoint.
|
|
483
|
-
*
|
|
484
|
-
* The template and the URL are arguments because the front page is the same
|
|
485
|
-
* page rendered somewhere else: `renderDocument` and `renderFrontPage` are
|
|
486
|
-
* this with two different answers to "which layout, and at which URL".
|
|
487
|
-
*/
|
|
488
|
-
function documentPage(document, options_) {
|
|
489
|
-
const { template, extra } = options_;
|
|
490
|
-
// The profile behind the document's `author`, resolved here rather than in
|
|
491
|
-
// `documentContext` for the reason the object id is: it needs the site's
|
|
492
|
-
// users, which a document on its own does not carry.
|
|
493
|
-
const writer = authorContext(users(), document.author);
|
|
494
|
-
const context = documentContext(document, config, writer, { lead: true }, citedPage);
|
|
495
|
-
// The URL it is being served at, which is its own permalink everywhere but
|
|
496
|
-
// the front page.
|
|
497
|
-
const url = options_.url ?? context.url;
|
|
498
|
-
// `activityStreams` is the object id the base layout advertises. It is
|
|
499
|
-
// added here rather than in `documentContext` because it needs the
|
|
500
|
-
// site's base URL, which a document on its own does not carry.
|
|
501
|
-
const now = config.now();
|
|
502
|
-
const naturalId = activityStreamsId(document, config.baseUrl, now);
|
|
503
|
-
const objectId = naturalId === undefined
|
|
504
|
-
? undefined
|
|
505
|
-
: currentObjectId(readObjectIds(config.contentDir), naturalId);
|
|
506
|
-
// `conversation` is what was said back. It is on the context only when
|
|
507
|
-
// there is something in it, so a theme can ask `{% if conversation %}`
|
|
508
|
-
// and a post nobody has answered renders no empty section (TASK-49).
|
|
509
|
-
// `commentsFeed` is where it is syndicated, for a served document, and
|
|
510
|
-
// is set here rather than in a layout so that a site which
|
|
511
|
-
// overrides `post.njk` or `page.njk` keeps the link.
|
|
512
|
-
const site = siteData.read();
|
|
513
|
-
const settings = requestSite();
|
|
514
|
-
const said = options.conversation?.(document, settings);
|
|
515
|
-
const feedsIt = isServed(document, now);
|
|
516
|
-
// `commentForm` is on the context only when the post is open, so the
|
|
517
|
-
// theme asks `{% if commentForm %}` rather than working the rules out
|
|
518
|
-
// for itself — and a closed post shows the thread with no form.
|
|
519
|
-
const stamps = [];
|
|
520
|
-
const form = heldStamp(options.commentForm?.(document, options_.viewer, requestInputs.getStore()?.mailConfigured === true), 'comment', stamps);
|
|
521
|
-
// And the contact form, when the page's front matter asked for one
|
|
522
|
-
// (TASK-56). Nothing about where a message would go is on the context:
|
|
523
|
-
// the address is read when a submission arrives, so a theme cannot
|
|
524
|
-
// print it however it is written.
|
|
525
|
-
const contact = heldStamp(options.contactForm?.(document), 'contact', stamps);
|
|
526
|
-
// Where a webmention about this page is sent (TASK-51). On the context
|
|
527
|
-
// only when the site takes them, so a theme asks `{% if webmention %}`
|
|
528
|
-
// and a site that has turned them off advertises nothing.
|
|
529
|
-
const webmention = webmentionEndpointFor(site);
|
|
530
|
-
const pingback = pingbackEndpointFor(site);
|
|
531
|
-
// The posts either side of this one, as the two links a theme draws under
|
|
532
|
-
// an entry (TASK-79). Each is on the context only when there is one, so a
|
|
533
|
-
// theme asks `{% if previous %}` and the ends of the archive draw nothing.
|
|
534
|
-
const either = options.neighbours?.(document) ?? {};
|
|
535
|
-
const cited = citedBy(document);
|
|
536
|
-
// The targets this post links to and the copies they made of it
|
|
537
|
-
// (TASK-155): the links a target verifies sit inside the h-entry, so they
|
|
538
|
-
// are on the post's own page, which is the page a target fetches.
|
|
539
|
-
const syndicated = options.syndication?.(document, settings);
|
|
540
|
-
const shared = options.location?.(document, settings);
|
|
541
|
-
const drawn = render(template, {
|
|
542
|
-
...context,
|
|
543
|
-
// This page's own person, which is the site's author everywhere else:
|
|
544
|
-
// the byline and the identity a theme prints are one object, so what a
|
|
545
|
-
// reader sees and what the structured data says cannot drift.
|
|
546
|
-
...(writer === undefined ? {} : { siteAuthor: writer }),
|
|
547
|
-
...neighbourContext('previous', either.previous, citedPage),
|
|
548
|
-
...neighbourContext('next', either.next, citedPage),
|
|
549
|
-
backlinks: (options.backlinks?.(document) ?? []).map((linking) => backlinkContext(linking, citedPage)),
|
|
550
|
-
url,
|
|
551
|
-
page: { ...context.page, url },
|
|
552
|
-
...capsuleContext(url),
|
|
553
|
-
...(objectId === undefined ? {} : { activityStreams: objectId }),
|
|
554
|
-
...(feedsIt ? { commentsFeed: commentsFeedPath(document.permalink) } : {}),
|
|
555
|
-
// And the whole archive, for a page whose front matter asked for it
|
|
556
|
-
// (TASK-85). On the context only for that page, so a theme asks
|
|
557
|
-
// `{% if archiveMonths %}` exactly as it asks about the contact form.
|
|
558
|
-
...archiveContext(document),
|
|
559
|
-
...(said === undefined || said.counts.total === 0 ? {} : { conversation: said }),
|
|
560
|
-
...(form === undefined ? {} : { commentForm: form }),
|
|
561
|
-
...(contact === undefined ? {} : { contactForm: contact }),
|
|
562
|
-
...(webmention === undefined ? {} : { webmention }),
|
|
563
|
-
...(pingback === undefined ? {} : { pingback }),
|
|
564
|
-
...cited,
|
|
565
|
-
syndicateTo: syndicated?.targets ?? [],
|
|
566
|
-
syndication: syndicationLinks([
|
|
567
|
-
...handSyndicationOf(document.extra),
|
|
568
|
-
...(syndicated?.copies ?? []),
|
|
569
|
-
]),
|
|
570
|
-
...(shared === undefined ? {} : { location: locationContext(shared) }),
|
|
571
|
-
...(visibilityOf(document) === 'unlisted' ? { noindex: true } : {}),
|
|
572
|
-
...extra,
|
|
573
|
-
});
|
|
574
|
-
// Only a stamp the theme printed can go stale in a reader's browser.
|
|
575
|
-
const printed = stamps.filter(([mark]) => drawn.includes(mark));
|
|
576
|
-
return {
|
|
577
|
-
html: printed.reduce((html, [mark, loaded]) => html.replaceAll(mark, loaded), drawn),
|
|
578
|
-
fingerprint: [
|
|
579
|
-
// The mark is random per renderer; a restart must not change every ETag.
|
|
580
|
-
drawn.replaceAll(stampMark, 'geekity-stamp'),
|
|
581
|
-
...printed.map(([, loaded]) => String(Math.floor(Number(loaded) / STAMP_WINDOW_MS))),
|
|
582
|
-
].join('\n'),
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
/** One document's page and its fingerprint, as {@link Renderer.renderPage} says. */
|
|
586
|
-
function renderPage(document, { frontPage = false, extra = {}, viewer }) {
|
|
587
|
-
if (!frontPage) {
|
|
588
|
-
return documentPage(document, {
|
|
589
|
-
template: document.type === 'post' ? TEMPLATES.post : TEMPLATES.page,
|
|
590
|
-
extra,
|
|
591
|
-
viewer,
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
return documentPage(document, {
|
|
595
|
-
// A theme's own front page if it has written one, and the layout every
|
|
596
|
-
// other page uses if it has not.
|
|
597
|
-
template: themeTemplate(themes.current().dirs, OPTIONAL_TEMPLATES.frontPage, TEMPLATES.page),
|
|
598
|
-
// At `/`, which is where it is being read: the canonical link, the
|
|
599
|
-
// menu's current item and anything else a theme takes off `page.url`
|
|
600
|
-
// should say the URL this is served at rather than the one that
|
|
601
|
-
// redirects here.
|
|
602
|
-
url: '/',
|
|
603
|
-
extra: { ...newestPostsContext(document), ...postsPageContext(), ...extra },
|
|
604
|
-
viewer,
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
/** A form with its loaded-at stamp swapped for a mark, noted for putting back. */
|
|
608
|
-
function heldStamp(form, key, stamps) {
|
|
609
|
-
if (form === undefined)
|
|
610
|
-
return undefined;
|
|
611
|
-
const mark = `${stampMark}-${key}`;
|
|
612
|
-
stamps.push([mark, form.loaded]);
|
|
613
|
-
return { ...form, loaded: mark };
|
|
614
|
-
}
|
|
615
|
-
function capsuleContext(url) {
|
|
616
|
-
const { pathname, search } = new URL(absoluteUrl(url, config.baseUrl));
|
|
617
|
-
const capsule = capsuleUrl(config, requestSite(), representationHref(`${pathname}${search}`, 'gemini'));
|
|
618
|
-
return capsule === undefined ? {} : { capsuleUrl: capsule };
|
|
619
|
-
}
|
|
12
|
+
const deps = renderDeps(options);
|
|
13
|
+
const { siteData, themes } = deps;
|
|
14
|
+
const theme = createThemeEnvironment(deps);
|
|
15
|
+
const { render } = theme;
|
|
16
|
+
const markdown = createMarkdownEnvironment(deps);
|
|
17
|
+
const contexts = createPageContexts(deps);
|
|
18
|
+
const { renderPage } = createDocumentPages(deps, render, contexts);
|
|
620
19
|
function statusPage({ template, title }, url, extra = {}) {
|
|
621
20
|
return render(template, { title, url, page: { url }, ...extra });
|
|
622
21
|
}
|
|
623
|
-
function renderMarkdownChrome(chrome, { markdownUrl, frontPage, document, format }) {
|
|
624
|
-
const site = siteData.read();
|
|
625
|
-
const soloAuthor = siteAuthorContext(users(), site.author);
|
|
626
|
-
const context = {
|
|
627
|
-
site,
|
|
628
|
-
menus: navigationMenus({ site, url: chrome.url }),
|
|
629
|
-
navigation: navigationLinks(site),
|
|
630
|
-
...(soloAuthor === undefined ? {} : { soloAuthor }),
|
|
631
|
-
...(frontPage === undefined ? {} : newestPostsContext(frontPage)),
|
|
632
|
-
...markdownArchiveContext(document, format === 'gemini'),
|
|
633
|
-
...markdownLinksContext(document),
|
|
634
|
-
...markdownKindContext(document),
|
|
635
|
-
...markdownConversationContext(document, chrome.url),
|
|
636
|
-
home: HOME_LINK,
|
|
637
|
-
...chrome,
|
|
638
|
-
bio: chrome.bio ?? (chrome.url === '/' ? bioOf(soloAuthor) : undefined),
|
|
639
|
-
staticFrontPage: frontPage !== undefined,
|
|
640
|
-
markdownUrl,
|
|
641
|
-
...(format === 'gemini' ? { geminiUrl: markdownUrl } : {}),
|
|
642
|
-
...(format === 'markdown' && chrome.type !== 'status' ? capsuleContext(chrome.url) : {}),
|
|
643
|
-
};
|
|
644
|
-
return {
|
|
645
|
-
header: renderText(CHROME_TEMPLATES.header, format, context),
|
|
646
|
-
footer: renderText(CHROME_TEMPLATES.footer, format, context),
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
function renderText(templates, format, context) {
|
|
650
|
-
const { dirs } = themes.current();
|
|
651
|
-
useThemeDirs(markdownEnvironment, dirs);
|
|
652
|
-
const written = format === 'gemini' && writesGemtext(dirs, templates) ? 'gemini' : 'markdown';
|
|
653
|
-
return { format: written, text: markdownEnvironment.render(templates[written], context) };
|
|
654
|
-
}
|
|
655
22
|
return {
|
|
656
|
-
environment,
|
|
657
|
-
markdownEnvironment,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
siteColors() {
|
|
669
|
-
const chosen = themes.current();
|
|
670
|
-
const colors = siteColors(siteData.read(), chosen.schemes);
|
|
671
|
-
if (colors === undefined)
|
|
672
|
-
return undefined;
|
|
673
|
-
const stylesheet = findThemeFile(chosen.dirs, 'static/style.css');
|
|
674
|
-
const tokens = stylesheet === undefined
|
|
675
|
-
? { light: new Map(), dark: new Map() }
|
|
676
|
-
: schemeTokens(stylesheet, colors.scheme.name);
|
|
677
|
-
return { ...colors, tokens };
|
|
678
|
-
},
|
|
679
|
-
pageSize() {
|
|
680
|
-
return postsPerPage(siteData.read());
|
|
681
|
-
},
|
|
682
|
-
taxonomyBases() {
|
|
683
|
-
return taxonomyBases(siteData.read());
|
|
684
|
-
},
|
|
685
|
-
termRedirects() {
|
|
686
|
-
return termRedirects(siteData.read());
|
|
687
|
-
},
|
|
688
|
-
frontPageSlugs() {
|
|
689
|
-
return frontPageSlugs(siteData.read());
|
|
690
|
-
},
|
|
23
|
+
environment: theme.environment,
|
|
24
|
+
markdownEnvironment: markdown.environment,
|
|
25
|
+
...createMarkdownChrome(deps, markdown, contexts),
|
|
26
|
+
...createListingPages(deps, render, contexts),
|
|
27
|
+
site: () => siteData.read(),
|
|
28
|
+
themeDirs: () => themes.current().dirs,
|
|
29
|
+
themeColors: () => themes.current().colors,
|
|
30
|
+
siteColors: () => siteColorsWithTokens(deps),
|
|
31
|
+
pageSize: () => postsPerPage(siteData.read()),
|
|
32
|
+
taxonomyBases: () => taxonomyBases(siteData.read()),
|
|
33
|
+
termRedirects: () => termRedirects(siteData.read()),
|
|
34
|
+
frontPageSlugs: () => frontPageSlugs(siteData.read()),
|
|
691
35
|
renderPage,
|
|
692
|
-
renderDocument(document, extra = {}, viewer = undefined) {
|
|
693
|
-
|
|
694
|
-
},
|
|
695
|
-
renderFrontPage(document, extra = {}, viewer = undefined) {
|
|
696
|
-
return renderPage(document, { frontPage: true, extra, viewer }).html;
|
|
697
|
-
},
|
|
698
|
-
renderListing(listing) {
|
|
699
|
-
// One read of the users file for the whole page, however many posts are
|
|
700
|
-
// on it: every byline on a listing resolves against the same list.
|
|
701
|
-
const people = users();
|
|
702
|
-
// The first image on the page is fetched at once: the posts page's own
|
|
703
|
-
// when its body has one, since it is printed above the list, else the
|
|
704
|
-
// first entry's.
|
|
705
|
-
const bodyLeads = listing.document?.html.includes('<img') === true;
|
|
706
|
-
const items = listing.documents.map((document, index) => entryContext(document, people, { lead: !bodyLeads && index === 0 }));
|
|
707
|
-
// The posts page's own front matter and rendered body, under the
|
|
708
|
-
// listing's title, URL and posts: a theme prints `{{ content | safe }}`
|
|
709
|
-
// above the list and a site without a posts page has nothing there. The
|
|
710
|
-
// listing's own keys go on after it, because this page of the listing is
|
|
711
|
-
// what is being served — page two of it is not the page's own URL.
|
|
712
|
-
const document = listing.document === undefined
|
|
713
|
-
? undefined
|
|
714
|
-
: documentContext(listing.document, config, authorContext(people, listing.document.author), { lead: bodyLeads }, citedPage);
|
|
715
|
-
return render(listingTemplate(listing), {
|
|
716
|
-
...document,
|
|
717
|
-
title: listing.title,
|
|
718
|
-
url: listing.url,
|
|
719
|
-
page: { ...document?.page, url: listing.url },
|
|
720
|
-
...capsuleContext(listing.url),
|
|
721
|
-
// `posts` is the friendly name a theme loops over; `pagination.items`
|
|
722
|
-
// is the same array under the name Eleventy gives it.
|
|
723
|
-
posts: items,
|
|
724
|
-
pagination: { ...listing.pagination, items },
|
|
725
|
-
...(listing.tag === undefined ? {} : { tag: listing.tag }),
|
|
726
|
-
...(listing.category === undefined ? {} : { category: listing.category }),
|
|
727
|
-
// On an author archive this is the person the archive is of, and it
|
|
728
|
-
// goes on last so it wins over the posts page's own `author`, which is
|
|
729
|
-
// the page's writer rather than whose archive this is. They are also
|
|
730
|
-
// whose page this is, so the identity a theme prints is theirs rather
|
|
731
|
-
// than the site's.
|
|
732
|
-
...(listing.author === undefined
|
|
733
|
-
? {}
|
|
734
|
-
: { author: listing.author, siteAuthor: listing.author }),
|
|
735
|
-
});
|
|
736
|
-
},
|
|
737
|
-
renderSearch(search) {
|
|
738
|
-
const people = users();
|
|
739
|
-
const items = search.hits.map((hit) => ({
|
|
740
|
-
...documentContext(hit.document, config, authorContext(people, hit.document.author), undefined, citedPage),
|
|
741
|
-
// Escaped here and marked up here, so a theme prints it with `safe`
|
|
742
|
-
// and cannot get the order of the two wrong.
|
|
743
|
-
snippet: snippetHtml(hit.snippet),
|
|
744
|
-
}));
|
|
745
|
-
return render(TEMPLATES.search, {
|
|
746
|
-
title: search.query === '' ? 'Search' : `Search results for “${search.query}”`,
|
|
747
|
-
url: search.url,
|
|
748
|
-
page: { url: search.url },
|
|
749
|
-
...capsuleContext(search.url),
|
|
750
|
-
// The words as the reader typed them, for the form to put back in the
|
|
751
|
-
// box and the heading to repeat. Autoescaped like any other string.
|
|
752
|
-
query: search.query,
|
|
753
|
-
posts: items,
|
|
754
|
-
pagination: { ...search.pagination, items },
|
|
755
|
-
});
|
|
756
|
-
},
|
|
757
|
-
renderComment({ post, comment, ancestors }) {
|
|
758
|
-
const url = commentPageHref(comment.id);
|
|
759
|
-
const on = entryContext(post, users(), { lead: false });
|
|
760
|
-
return render(TEMPLATES.comment, {
|
|
761
|
-
title: `${comment.author.name} on ${on.label}`,
|
|
762
|
-
url,
|
|
763
|
-
page: { url },
|
|
764
|
-
...capsuleContext(url),
|
|
765
|
-
noindex: true,
|
|
766
|
-
comment,
|
|
767
|
-
ancestors,
|
|
768
|
-
post: on,
|
|
769
|
-
threadUrl: `${post.permalink}#${commentAnchor(comment.id)}`,
|
|
770
|
-
});
|
|
771
|
-
},
|
|
36
|
+
renderDocument: (document, extra = {}, viewer = undefined) => renderPage(document, { extra, viewer }).html,
|
|
37
|
+
renderFrontPage: (document, extra = {}, viewer = undefined) => renderPage(document, { frontPage: true, extra, viewer }).html,
|
|
772
38
|
renderNotFound: (url) => statusPage(STATUS_PAGES.notFound, url),
|
|
773
39
|
renderGone: (url) => statusPage(STATUS_PAGES.gone, url),
|
|
774
40
|
renderServerError: (url) => statusPage(STATUS_PAGES.serverError, url),
|
|
775
41
|
renderMaintenance: (url, until) => statusPage(STATUS_PAGES.maintenance, url, untilContext(until)),
|
|
776
|
-
renderStatusMarkdown(page, { url, markdownUrl, until, format }) {
|
|
777
|
-
const templates = STATUS_PAGES[page];
|
|
778
|
-
return renderText(templates, format, {
|
|
779
|
-
site: siteData.read(),
|
|
780
|
-
url,
|
|
781
|
-
title: templates.title,
|
|
782
|
-
markdownUrl,
|
|
783
|
-
...(format === 'gemini' ? { geminiUrl: markdownUrl } : {}),
|
|
784
|
-
...untilContext(until),
|
|
785
|
-
});
|
|
786
|
-
},
|
|
787
42
|
render,
|
|
788
43
|
};
|
|
789
44
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
markdown: 'layouts/500.md.njk',
|
|
806
|
-
gemini: 'layouts/500.gmi.njk',
|
|
807
|
-
title: 'Something went wrong',
|
|
808
|
-
},
|
|
809
|
-
maintenance: {
|
|
810
|
-
template: TEMPLATES.maintenance,
|
|
811
|
-
markdown: 'layouts/503.md.njk',
|
|
812
|
-
gemini: 'layouts/503.gmi.njk',
|
|
813
|
-
title: 'Down for maintenance',
|
|
814
|
-
},
|
|
815
|
-
};
|
|
816
|
-
function writesGemtext(dirs, templates) {
|
|
817
|
-
for (const dir of dirs) {
|
|
818
|
-
if (findThemeFile([dir], templates.gemini) !== undefined)
|
|
819
|
-
return true;
|
|
820
|
-
if (findThemeFile([dir], templates.markdown) !== undefined)
|
|
821
|
-
return false;
|
|
822
|
-
}
|
|
823
|
-
return false;
|
|
824
|
-
}
|
|
825
|
-
function untilContext(until) {
|
|
826
|
-
return until === undefined ? {} : { until: until.toISOString(), untilText: until.toUTCString() };
|
|
827
|
-
}
|
|
828
|
-
/**
|
|
829
|
-
* One neighbour under the name a theme reads it by, or nothing at all when
|
|
830
|
-
* there is no post on that side.
|
|
831
|
-
*
|
|
832
|
-
* The title and the URL and no more: a link is what it says and where it goes,
|
|
833
|
-
* and handing a theme a second document context would be handing it a second
|
|
834
|
-
* post to print by accident.
|
|
835
|
-
*/
|
|
836
|
-
function neighbourContext(key, document, cited) {
|
|
837
|
-
if (document === undefined)
|
|
838
|
-
return {};
|
|
839
|
-
return { [key]: { title: postLabel(document, cited), url: document.permalink } };
|
|
840
|
-
}
|
|
841
|
-
/** Every line after the first indented by `width` spaces, blank lines left blank. */
|
|
842
|
-
function nest(text, width) {
|
|
843
|
-
const indent = ' '.repeat(width);
|
|
844
|
-
return text.replace(/\n(?=[^\n])/g, `\n${indent}`);
|
|
845
|
-
}
|
|
846
|
-
/** Markdown as a blockquote: every line after `> `, a blank line as `>`. */
|
|
847
|
-
function quote(text) {
|
|
848
|
-
return text
|
|
849
|
-
.trim()
|
|
850
|
-
.split('\n')
|
|
851
|
-
.map((line) => (line.trim() === '' ? '>' : `> ${line}`))
|
|
852
|
-
.join('\n');
|
|
853
|
-
}
|
|
854
|
-
/** A filter's input as text: a string, number or boolean as written, anything else empty. */
|
|
855
|
-
function filterText(value) {
|
|
856
|
-
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'
|
|
857
|
-
? String(value)
|
|
858
|
-
: '';
|
|
859
|
-
}
|
|
860
|
-
/**
|
|
861
|
-
* `preferred` when a theme in the search path ships it, and `fallback`
|
|
862
|
-
* otherwise.
|
|
863
|
-
*
|
|
864
|
-
* Asked per render rather than at boot, so adding `front-page.njk` to a theme
|
|
865
|
-
* shows on the next request exactly as editing one does. It costs one `stat`
|
|
866
|
-
* per theme directory, and only on the two pages that have an override point
|
|
867
|
-
* at all.
|
|
868
|
-
*/
|
|
869
|
-
function themeTemplate(themeDirs, preferred, fallback) {
|
|
870
|
-
return findThemeFile(themeDirs, preferred) === undefined ? fallback : preferred;
|
|
871
|
-
}
|
|
872
|
-
function svgElseTouchIconHref(icons) {
|
|
873
|
-
return (icons.find((icon) => icon.type === 'image/svg+xml') ??
|
|
874
|
-
icons.find((icon) => icon.rel === 'apple-touch-icon'))?.href;
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* The path a render is of, for marking the current menu item.
|
|
878
|
-
*
|
|
879
|
-
* Read off `page.url` and then `url`, the two names every caller here already
|
|
880
|
-
* sets, so nothing has to pass the path a third time. A template rendered with
|
|
881
|
-
* neither — a site calling `render` for a fragment of its own — is treated as
|
|
882
|
-
* the home page's, which marks nothing that a page of the site would not.
|
|
883
|
-
*/
|
|
884
|
-
function currentUrl(context) {
|
|
885
|
-
const page = context['page'];
|
|
886
|
-
if (typeof page === 'object' && page !== null) {
|
|
887
|
-
const url = page['url'];
|
|
888
|
-
if (typeof url === 'string')
|
|
889
|
-
return url;
|
|
890
|
-
}
|
|
891
|
-
return typeof context['url'] === 'string' ? context['url'] : '/';
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* A stored reply context as a theme reads it: the published instant as a
|
|
895
|
-
* `Date`, so the `date` filter prints it in the site's zone like any other.
|
|
896
|
-
*/
|
|
897
|
-
function replyContextFor(context) {
|
|
898
|
-
const published = context.published === undefined ? undefined : new Date(context.published);
|
|
899
|
-
const { published: _published, ...rest } = context;
|
|
900
|
-
const dated = published === undefined || Number.isNaN(published.getTime()) ? rest : { ...rest, published };
|
|
901
|
-
return { ...dated, ...eventStartFor(context.start) };
|
|
902
|
-
}
|
|
903
|
-
function eventStartFor(written) {
|
|
904
|
-
const start = readCitedStart(written ?? '');
|
|
905
|
-
if (start === undefined)
|
|
906
|
-
return {};
|
|
907
|
-
return start.kind === 'wall-clock'
|
|
908
|
-
? { startDate: start.asUtc, startZone: 'UTC' }
|
|
909
|
-
: { startDate: start.at };
|
|
910
|
-
}
|
|
911
|
-
function licenseContext(site, context) {
|
|
912
|
-
return { license: resolveLicense(site, context), siteLicense: resolveLicense(site) };
|
|
45
|
+
function renderDeps(options) {
|
|
46
|
+
const { config, replyContext } = options;
|
|
47
|
+
const siteData = createSiteDataSource(config);
|
|
48
|
+
return {
|
|
49
|
+
options,
|
|
50
|
+
config,
|
|
51
|
+
siteData,
|
|
52
|
+
themes: options.themes ??
|
|
53
|
+
createThemeSource({ themesDir: config.themesDir, chosen: () => themeName(siteData.read()) }),
|
|
54
|
+
pages: options.pages ?? (() => []),
|
|
55
|
+
users: options.users ?? (() => []),
|
|
56
|
+
citedPage: replyContext === undefined
|
|
57
|
+
? undefined
|
|
58
|
+
: (url) => replyContext(url, requestSite()),
|
|
59
|
+
};
|
|
913
60
|
}
|
|
914
61
|
//# sourceMappingURL=render.js.map
|