@geekity/cms 0.3.0 → 0.4.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/README.md +2091 -214
- package/admin/components/fields.njk +165 -0
- package/admin/layouts/base.njk +1 -1
- package/admin/layouts/settings-page.njk +26 -0
- package/admin/layouts/shell.njk +17 -3
- package/admin/pages/account/forgot.njk +47 -0
- package/admin/pages/account/login.njk +26 -0
- package/admin/pages/account/reset.njk +38 -0
- package/admin/pages/account/setup.njk +28 -0
- package/admin/pages/appearance/themes.njk +69 -0
- package/admin/pages/comments/all.njk +133 -0
- package/admin/{layouts/dashboard.njk → pages/dashboard/home.njk} +8 -15
- package/admin/{layouts/document-conflict.njk → pages/documents/conflict.njk} +1 -0
- package/admin/pages/documents/editor.njk +196 -0
- package/admin/{layouts/document-list.njk → pages/documents/list.njk} +19 -2
- package/admin/pages/documents/taxonomy.njk +95 -0
- package/admin/pages/federation/followers.njk +238 -0
- package/admin/pages/media/library.njk +160 -0
- package/admin/pages/messages/all.njk +110 -0
- package/admin/{layouts → pages}/placeholder.njk +5 -1
- package/admin/pages/settings/discussion.njk +99 -0
- package/admin/pages/settings/email.njk +203 -0
- package/admin/pages/settings/federation.njk +75 -0
- package/admin/pages/settings/general.njk +29 -0
- package/admin/pages/settings/permalinks.njk +50 -0
- package/admin/pages/settings/reading.njk +72 -0
- package/admin/pages/users/edit.njk +239 -0
- package/admin/pages/users/list.njk +48 -0
- package/admin/pages/users/new.njk +41 -0
- package/admin/static/admin.css +498 -3
- package/admin/static/copy.js +52 -0
- package/admin/static/editor.js +16 -16
- package/admin/static/slug.js +61 -0
- package/dist/admin/accounts.d.ts +413 -0
- package/dist/admin/accounts.d.ts.map +1 -0
- package/dist/admin/accounts.js +680 -0
- package/dist/admin/accounts.js.map +1 -0
- package/dist/admin/appearance.d.ts +80 -0
- package/dist/admin/appearance.d.ts.map +1 -0
- package/dist/admin/appearance.js +136 -0
- package/dist/admin/appearance.js.map +1 -0
- package/dist/admin/comments.d.ts +90 -0
- package/dist/admin/comments.d.ts.map +1 -0
- package/dist/admin/comments.js +244 -0
- package/dist/admin/comments.js.map +1 -0
- package/dist/admin/credentials.d.ts +26 -2
- package/dist/admin/credentials.d.ts.map +1 -1
- package/dist/admin/credentials.js +35 -2
- package/dist/admin/credentials.js.map +1 -1
- package/dist/admin/documents.d.ts +127 -10
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +360 -41
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/federation.d.ts +151 -50
- package/dist/admin/federation.d.ts.map +1 -1
- package/dist/admin/federation.js +225 -93
- package/dist/admin/federation.js.map +1 -1
- package/dist/admin/formatting.d.ts +20 -0
- package/dist/admin/formatting.d.ts.map +1 -0
- package/dist/admin/formatting.js +72 -0
- package/dist/admin/formatting.js.map +1 -0
- package/dist/admin/headers.d.ts +65 -0
- package/dist/admin/headers.d.ts.map +1 -0
- package/dist/admin/headers.js +104 -0
- package/dist/admin/headers.js.map +1 -0
- package/dist/admin/index.d.ts +38 -12
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +25 -7
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/media.d.ts +168 -0
- package/dist/admin/media.d.ts.map +1 -0
- package/dist/admin/media.js +295 -0
- package/dist/admin/media.js.map +1 -0
- package/dist/admin/menu.d.ts +79 -0
- package/dist/admin/menu.d.ts.map +1 -0
- package/dist/admin/menu.js +126 -0
- package/dist/admin/menu.js.map +1 -0
- package/dist/admin/messages.d.ts +80 -0
- package/dist/admin/messages.d.ts.map +1 -0
- package/dist/admin/messages.js +152 -0
- package/dist/admin/messages.js.map +1 -0
- package/dist/admin/preview.d.ts.map +1 -1
- package/dist/admin/preview.js +31 -7
- package/dist/admin/preview.js.map +1 -1
- package/dist/admin/recovery.d.ts +92 -0
- package/dist/admin/recovery.d.ts.map +1 -0
- package/dist/admin/recovery.js +229 -0
- package/dist/admin/recovery.js.map +1 -0
- package/dist/admin/routes.d.ts +0 -20
- package/dist/admin/routes.d.ts.map +1 -1
- package/dist/admin/routes.js +155 -105
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/settings-discussion.d.ts +37 -0
- package/dist/admin/settings-discussion.d.ts.map +1 -0
- package/dist/admin/settings-discussion.js +117 -0
- package/dist/admin/settings-discussion.js.map +1 -0
- package/dist/admin/settings-email.d.ts +54 -0
- package/dist/admin/settings-email.d.ts.map +1 -0
- package/dist/admin/settings-email.js +189 -0
- package/dist/admin/settings-email.js.map +1 -0
- package/dist/admin/settings-federation.d.ts +39 -0
- package/dist/admin/settings-federation.d.ts.map +1 -0
- package/dist/admin/settings-federation.js +103 -0
- package/dist/admin/settings-federation.js.map +1 -0
- package/dist/admin/settings-general.d.ts +12 -0
- package/dist/admin/settings-general.d.ts.map +1 -0
- package/dist/admin/settings-general.js +48 -0
- package/dist/admin/settings-general.js.map +1 -0
- package/dist/admin/settings-page.d.ts +102 -0
- package/dist/admin/settings-page.d.ts.map +1 -0
- package/dist/admin/settings-page.js +126 -0
- package/dist/admin/settings-page.js.map +1 -0
- package/dist/admin/settings-pages.d.ts +19 -0
- package/dist/admin/settings-pages.d.ts.map +1 -0
- package/dist/admin/settings-pages.js +33 -0
- package/dist/admin/settings-pages.js.map +1 -0
- package/dist/admin/settings-permalinks.d.ts +16 -0
- package/dist/admin/settings-permalinks.d.ts.map +1 -0
- package/dist/admin/settings-permalinks.js +32 -0
- package/dist/admin/settings-permalinks.js.map +1 -0
- package/dist/admin/settings-reading.d.ts +33 -0
- package/dist/admin/settings-reading.d.ts.map +1 -0
- package/dist/admin/settings-reading.js +48 -0
- package/dist/admin/settings-reading.js.map +1 -0
- package/dist/admin/settings.d.ts +325 -96
- package/dist/admin/settings.d.ts.map +1 -1
- package/dist/admin/settings.js +650 -308
- package/dist/admin/settings.js.map +1 -1
- package/dist/admin/store.d.ts +606 -152
- package/dist/admin/store.d.ts.map +1 -1
- package/dist/admin/store.js +863 -268
- package/dist/admin/store.js.map +1 -1
- package/dist/admin/taxonomy.d.ts +114 -0
- package/dist/admin/taxonomy.d.ts.map +1 -0
- package/dist/admin/taxonomy.js +289 -0
- package/dist/admin/taxonomy.js.map +1 -0
- package/dist/admin/templates.d.ts +44 -14
- package/dist/admin/templates.d.ts.map +1 -1
- package/dist/admin/templates.js +44 -14
- package/dist/admin/templates.js.map +1 -1
- package/dist/admin/throttle.d.ts +84 -0
- package/dist/admin/throttle.d.ts.map +1 -0
- package/dist/admin/throttle.js +143 -0
- package/dist/admin/throttle.js.map +1 -0
- package/dist/admin/uploads.d.ts +28 -2
- package/dist/admin/uploads.d.ts.map +1 -1
- package/dist/admin/uploads.js +43 -4
- package/dist/admin/uploads.js.map +1 -1
- package/dist/admin/users.d.ts +100 -13
- package/dist/admin/users.d.ts.map +1 -1
- package/dist/admin/users.js +412 -39
- package/dist/admin/users.js.map +1 -1
- package/dist/cache.d.ts +141 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +207 -0
- package/dist/cache.js.map +1 -0
- package/dist/cli.d.ts +14 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +424 -21
- package/dist/cli.js.map +1 -1
- package/dist/comments/akismet.d.ts +130 -0
- package/dist/comments/akismet.d.ts.map +1 -0
- package/dist/comments/akismet.js +274 -0
- package/dist/comments/akismet.js.map +1 -0
- package/dist/comments/conversation.d.ts +29 -0
- package/dist/comments/conversation.d.ts.map +1 -0
- package/dist/comments/conversation.js +60 -0
- package/dist/comments/conversation.js.map +1 -0
- package/dist/comments/form.d.ts +75 -0
- package/dist/comments/form.d.ts.map +1 -0
- package/dist/comments/form.js +64 -0
- package/dist/comments/form.js.map +1 -0
- package/dist/comments/index.d.ts +15 -0
- package/dist/comments/index.d.ts.map +1 -0
- package/dist/comments/index.js +9 -0
- package/dist/comments/index.js.map +1 -0
- package/dist/comments/markdown.d.ts +8 -0
- package/dist/comments/markdown.d.ts.map +1 -0
- package/dist/comments/markdown.js +85 -0
- package/dist/comments/markdown.js.map +1 -0
- package/dist/comments/moderate.d.ts +71 -0
- package/dist/comments/moderate.d.ts.map +1 -0
- package/dist/comments/moderate.js +88 -0
- package/dist/comments/moderate.js.map +1 -0
- package/dist/comments/policy.d.ts +57 -0
- package/dist/comments/policy.d.ts.map +1 -0
- package/dist/comments/policy.js +80 -0
- package/dist/comments/policy.js.map +1 -0
- package/dist/comments/records.d.ts +266 -0
- package/dist/comments/records.d.ts.map +1 -0
- package/dist/comments/records.js +487 -0
- package/dist/comments/records.js.map +1 -0
- package/dist/comments/routes.d.ts +58 -0
- package/dist/comments/routes.d.ts.map +1 -0
- package/dist/comments/routes.js +177 -0
- package/dist/comments/routes.js.map +1 -0
- package/dist/comments/submission.d.ts +263 -0
- package/dist/comments/submission.d.ts.map +1 -0
- package/dist/comments/submission.js +241 -0
- package/dist/comments/submission.js.map +1 -0
- package/dist/config.d.ts +190 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +118 -6
- package/dist/config.js.map +1 -1
- package/dist/contact/delivery.d.ts +60 -0
- package/dist/contact/delivery.d.ts.map +1 -0
- package/dist/contact/delivery.js +87 -0
- package/dist/contact/delivery.js.map +1 -0
- package/dist/contact/form.d.ts +130 -0
- package/dist/contact/form.d.ts.map +1 -0
- package/dist/contact/form.js +163 -0
- package/dist/contact/form.js.map +1 -0
- package/dist/contact/index.d.ts +17 -0
- package/dist/contact/index.d.ts.map +1 -0
- package/dist/contact/index.js +13 -0
- package/dist/contact/index.js.map +1 -0
- package/dist/contact/records.d.ts +124 -0
- package/dist/contact/records.d.ts.map +1 -0
- package/dist/contact/records.js +218 -0
- package/dist/contact/records.js.map +1 -0
- package/dist/contact/routes.d.ts +17 -0
- package/dist/contact/routes.d.ts.map +1 -0
- package/dist/contact/routes.js +127 -0
- package/dist/contact/routes.js.map +1 -0
- package/dist/contact/submission.d.ts +103 -0
- package/dist/contact/submission.d.ts.map +1 -0
- package/dist/contact/submission.js +166 -0
- package/dist/contact/submission.js.map +1 -0
- package/dist/content/document.d.ts +7 -2
- package/dist/content/document.d.ts.map +1 -1
- package/dist/content/document.js +1 -0
- package/dist/content/document.js.map +1 -1
- package/dist/content/index.d.ts +7 -2
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +4 -1
- package/dist/content/index.js.map +1 -1
- package/dist/content/markdown.d.ts.map +1 -1
- package/dist/content/markdown.js +24 -2
- package/dist/content/markdown.js.map +1 -1
- package/dist/content/parser.d.ts.map +1 -1
- package/dist/content/parser.js +11 -4
- package/dist/content/parser.js.map +1 -1
- package/dist/content/save.d.ts +5 -0
- package/dist/content/save.d.ts.map +1 -1
- package/dist/content/save.js +44 -1
- package/dist/content/save.js.map +1 -1
- package/dist/content/schedule.d.ts +125 -0
- package/dist/content/schedule.d.ts.map +1 -0
- package/dist/content/schedule.js +207 -0
- package/dist/content/schedule.js.map +1 -0
- package/dist/content/search.d.ts +64 -0
- package/dist/content/search.d.ts.map +1 -0
- package/dist/content/search.js +136 -0
- package/dist/content/search.js.map +1 -0
- package/dist/content/store.d.ts +202 -7
- package/dist/content/store.d.ts.map +1 -1
- package/dist/content/store.js +374 -67
- package/dist/content/store.js.map +1 -1
- package/dist/content/sync.d.ts +7 -1
- package/dist/content/sync.d.ts.map +1 -1
- package/dist/content/sync.js +18 -10
- package/dist/content/sync.js.map +1 -1
- package/dist/content/time.d.ts +56 -0
- package/dist/content/time.d.ts.map +1 -0
- package/dist/content/time.js +141 -0
- package/dist/content/time.js.map +1 -0
- package/dist/content/writer.d.ts.map +1 -1
- package/dist/content/writer.js +3 -0
- package/dist/content/writer.js.map +1 -1
- package/dist/env.d.ts +58 -4
- package/dist/env.d.ts.map +1 -1
- package/dist/federation/actor.d.ts +95 -41
- package/dist/federation/actor.d.ts.map +1 -1
- package/dist/federation/actor.js +180 -53
- package/dist/federation/actor.js.map +1 -1
- package/dist/federation/article.d.ts +44 -17
- package/dist/federation/article.d.ts.map +1 -1
- package/dist/federation/article.js +98 -46
- package/dist/federation/article.js.map +1 -1
- package/dist/federation/delivery.d.ts +63 -15
- package/dist/federation/delivery.d.ts.map +1 -1
- package/dist/federation/delivery.js +154 -80
- package/dist/federation/delivery.js.map +1 -1
- package/dist/federation/federation.d.ts +22 -17
- package/dist/federation/federation.d.ts.map +1 -1
- package/dist/federation/federation.js +98 -77
- package/dist/federation/federation.js.map +1 -1
- package/dist/federation/followers.d.ts +3 -2
- package/dist/federation/followers.d.ts.map +1 -1
- package/dist/federation/followers.js +6 -5
- package/dist/federation/followers.js.map +1 -1
- package/dist/federation/import-wordpress.d.ts +128 -0
- package/dist/federation/import-wordpress.d.ts.map +1 -0
- package/dist/federation/import-wordpress.js +426 -0
- package/dist/federation/import-wordpress.js.map +1 -0
- package/dist/federation/inbox.d.ts +36 -13
- package/dist/federation/inbox.d.ts.map +1 -1
- package/dist/federation/inbox.js +120 -49
- package/dist/federation/inbox.js.map +1 -1
- package/dist/federation/index.d.ts +22 -10
- package/dist/federation/index.d.ts.map +1 -1
- package/dist/federation/index.js +13 -8
- package/dist/federation/index.js.map +1 -1
- package/dist/federation/keys.d.ts +98 -20
- package/dist/federation/keys.d.ts.map +1 -1
- package/dist/federation/keys.js +269 -39
- package/dist/federation/keys.js.map +1 -1
- package/dist/federation/mount.d.ts +42 -10
- package/dist/federation/mount.d.ts.map +1 -1
- package/dist/federation/mount.js +266 -26
- package/dist/federation/mount.js.map +1 -1
- package/dist/federation/paths.d.ts +23 -35
- package/dist/federation/paths.d.ts.map +1 -1
- package/dist/federation/paths.js +26 -39
- package/dist/federation/paths.js.map +1 -1
- package/dist/federation/records.d.ts +223 -0
- package/dist/federation/records.d.ts.map +1 -0
- package/dist/federation/records.js +506 -0
- package/dist/federation/records.js.map +1 -0
- package/dist/federation/relays.d.ts +114 -0
- package/dist/federation/relays.d.ts.map +1 -0
- package/dist/federation/relays.js +290 -0
- package/dist/federation/relays.js.map +1 -0
- package/dist/federation/replies.d.ts +80 -0
- package/dist/federation/replies.d.ts.map +1 -0
- package/dist/federation/replies.js +166 -0
- package/dist/federation/replies.js.map +1 -0
- package/dist/federation/wordpress.d.ts +131 -0
- package/dist/federation/wordpress.d.ts.map +1 -0
- package/dist/federation/wordpress.js +341 -0
- package/dist/federation/wordpress.js.map +1 -0
- package/dist/files/atomic.d.ts +103 -0
- package/dist/files/atomic.d.ts.map +1 -0
- package/dist/files/atomic.js +150 -0
- package/dist/files/atomic.js.map +1 -0
- package/dist/files/index.d.ts +3 -0
- package/dist/files/index.d.ts.map +1 -0
- package/dist/files/index.js +2 -0
- package/dist/files/index.js.map +1 -0
- package/dist/forms/protection.d.ts +85 -0
- package/dist/forms/protection.d.ts.map +1 -0
- package/dist/forms/protection.js +116 -0
- package/dist/forms/protection.js.map +1 -0
- package/dist/images/icons.d.ts +59 -0
- package/dist/images/icons.d.ts.map +1 -0
- package/dist/images/icons.js +131 -0
- package/dist/images/icons.js.map +1 -0
- package/dist/images/index.d.ts +7 -0
- package/dist/images/index.d.ts.map +1 -0
- package/dist/images/index.js +4 -0
- package/dist/images/index.js.map +1 -0
- package/dist/images/markup.d.ts +47 -0
- package/dist/images/markup.d.ts.map +1 -0
- package/dist/images/markup.js +175 -0
- package/dist/images/markup.js.map +1 -0
- package/dist/images/paths.d.ts +34 -0
- package/dist/images/paths.d.ts.map +1 -0
- package/dist/images/paths.js +41 -0
- package/dist/images/paths.js.map +1 -0
- package/dist/images/variants.d.ts +104 -0
- package/dist/images/variants.d.ts.map +1 -0
- package/dist/images/variants.js +320 -0
- package/dist/images/variants.js.map +1 -0
- package/dist/index.d.ts +123 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +327 -25
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +18 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +34 -3
- package/dist/init.js.map +1 -1
- package/dist/mail/brevo.d.ts +35 -0
- package/dist/mail/brevo.d.ts.map +1 -0
- package/dist/mail/brevo.js +85 -0
- package/dist/mail/brevo.js.map +1 -0
- package/dist/mail/credentials.d.ts +62 -0
- package/dist/mail/credentials.d.ts.map +1 -0
- package/dist/mail/credentials.js +86 -0
- package/dist/mail/credentials.js.map +1 -0
- package/dist/mail/index.d.ts +15 -0
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +8 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/memory.d.ts +35 -0
- package/dist/mail/memory.d.ts.map +1 -0
- package/dist/mail/memory.js +29 -0
- package/dist/mail/memory.js.map +1 -0
- package/dist/mail/provider.d.ts +80 -0
- package/dist/mail/provider.d.ts.map +1 -0
- package/dist/mail/provider.js +23 -0
- package/dist/mail/provider.js.map +1 -0
- package/dist/mail/service.d.ts +156 -0
- package/dist/mail/service.d.ts.map +1 -0
- package/dist/mail/service.js +265 -0
- package/dist/mail/service.js.map +1 -0
- package/dist/mail/smtp.d.ts +39 -0
- package/dist/mail/smtp.d.ts.map +1 -0
- package/dist/mail/smtp.js +58 -0
- package/dist/mail/smtp.js.map +1 -0
- package/dist/mail/templates.d.ts +91 -0
- package/dist/mail/templates.d.ts.map +1 -0
- package/dist/mail/templates.js +69 -0
- package/dist/mail/templates.js.map +1 -0
- package/dist/notifications/comments.d.ts +66 -0
- package/dist/notifications/comments.d.ts.map +1 -0
- package/dist/notifications/comments.js +151 -0
- package/dist/notifications/comments.js.map +1 -0
- package/dist/notifications/digest.d.ts +135 -0
- package/dist/notifications/digest.d.ts.map +1 -0
- package/dist/notifications/digest.js +287 -0
- package/dist/notifications/digest.js.map +1 -0
- package/dist/notifications/index.d.ts +13 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +8 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/links.d.ts +60 -0
- package/dist/notifications/links.d.ts.map +1 -0
- package/dist/notifications/links.js +63 -0
- package/dist/notifications/links.js.map +1 -0
- package/dist/notifications/optouts.d.ts +48 -0
- package/dist/notifications/optouts.d.ts.map +1 -0
- package/dist/notifications/optouts.js +93 -0
- package/dist/notifications/optouts.js.map +1 -0
- package/dist/notifications/preferences.d.ts +158 -0
- package/dist/notifications/preferences.d.ts.map +1 -0
- package/dist/notifications/preferences.js +195 -0
- package/dist/notifications/preferences.js.map +1 -0
- package/dist/notifications/routes.d.ts +28 -0
- package/dist/notifications/routes.d.ts.map +1 -0
- package/dist/notifications/routes.js +184 -0
- package/dist/notifications/routes.js.map +1 -0
- package/dist/notifications/tokens.d.ts +60 -0
- package/dist/notifications/tokens.d.ts.map +1 -0
- package/dist/notifications/tokens.js +125 -0
- package/dist/notifications/tokens.js.map +1 -0
- package/dist/notify.d.ts +84 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +149 -0
- package/dist/notify.js.map +1 -0
- package/dist/web/archive.d.ts +49 -0
- package/dist/web/archive.d.ts.map +1 -0
- package/dist/web/archive.js +59 -0
- package/dist/web/archive.js.map +1 -0
- package/dist/web/assets.d.ts +6 -5
- package/dist/web/assets.d.ts.map +1 -1
- package/dist/web/assets.js +5 -7
- package/dist/web/assets.js.map +1 -1
- package/dist/web/authors.d.ts +143 -0
- package/dist/web/authors.d.ts.map +1 -0
- package/dist/web/authors.js +178 -0
- package/dist/web/authors.js.map +1 -0
- package/dist/web/comments.d.ts +60 -0
- package/dist/web/comments.d.ts.map +1 -0
- package/dist/web/comments.js +207 -0
- package/dist/web/comments.js.map +1 -0
- package/dist/web/context.d.ts +162 -28
- package/dist/web/context.d.ts.map +1 -1
- package/dist/web/context.js +123 -26
- package/dist/web/context.js.map +1 -1
- package/dist/web/conversation.d.ts +209 -0
- package/dist/web/conversation.d.ts.map +1 -0
- package/dist/web/conversation.js +557 -0
- package/dist/web/conversation.js.map +1 -0
- package/dist/web/documents.d.ts +36 -6
- package/dist/web/documents.d.ts.map +1 -1
- package/dist/web/documents.js +52 -10
- package/dist/web/documents.js.map +1 -1
- package/dist/web/feed-atom.d.ts +22 -0
- package/dist/web/feed-atom.d.ts.map +1 -0
- package/dist/web/feed-atom.js +83 -0
- package/dist/web/feed-atom.js.map +1 -0
- package/dist/web/feed-item.d.ts +145 -0
- package/dist/web/feed-item.d.ts.map +1 -0
- package/dist/web/feed-item.js +120 -0
- package/dist/web/feed-item.js.map +1 -0
- package/dist/web/feed-json.d.ts +79 -0
- package/dist/web/feed-json.d.ts.map +1 -0
- package/dist/web/feed-json.js +53 -0
- package/dist/web/feed-json.js.map +1 -0
- package/dist/web/feed-rss.d.ts +26 -0
- package/dist/web/feed-rss.d.ts.map +1 -0
- package/dist/web/feed-rss.js +203 -0
- package/dist/web/feed-rss.js.map +1 -0
- package/dist/web/feed-source.d.ts +244 -0
- package/dist/web/feed-source.d.ts.map +1 -0
- package/dist/web/feed-source.js +201 -0
- package/dist/web/feed-source.js.map +1 -0
- package/dist/web/feed-xml.d.ts +63 -0
- package/dist/web/feed-xml.d.ts.map +1 -0
- package/dist/web/feed-xml.js +116 -0
- package/dist/web/feed-xml.js.map +1 -0
- package/dist/web/feeds.d.ts +31 -96
- package/dist/web/feeds.d.ts.map +1 -1
- package/dist/web/feeds.js +94 -198
- package/dist/web/feeds.js.map +1 -1
- package/dist/web/health.d.ts +31 -0
- package/dist/web/health.d.ts.map +1 -0
- package/dist/web/health.js +44 -0
- package/dist/web/health.js.map +1 -0
- package/dist/web/index.d.ts +30 -10
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +18 -7
- package/dist/web/index.js.map +1 -1
- package/dist/web/navigation.d.ts +73 -0
- package/dist/web/navigation.d.ts.map +1 -0
- package/dist/web/navigation.js +110 -0
- package/dist/web/navigation.js.map +1 -0
- package/dist/web/negotiate.d.ts +9 -0
- package/dist/web/negotiate.d.ts.map +1 -1
- package/dist/web/negotiate.js +6 -1
- package/dist/web/negotiate.js.map +1 -1
- package/dist/web/recent.d.ts +43 -0
- package/dist/web/recent.d.ts.map +1 -0
- package/dist/web/recent.js +37 -0
- package/dist/web/recent.js.map +1 -0
- package/dist/web/render.d.ts +197 -9
- package/dist/web/render.d.ts.map +1 -1
- package/dist/web/render.js +334 -17
- package/dist/web/render.js.map +1 -1
- package/dist/web/routes.d.ts +25 -8
- package/dist/web/routes.d.ts.map +1 -1
- package/dist/web/routes.js +845 -93
- package/dist/web/routes.js.map +1 -1
- package/dist/web/sanitize.d.ts +19 -0
- package/dist/web/sanitize.d.ts.map +1 -0
- package/dist/web/sanitize.js +272 -0
- package/dist/web/sanitize.js.map +1 -0
- package/dist/web/search.d.ts +79 -0
- package/dist/web/search.d.ts.map +1 -0
- package/dist/web/search.js +94 -0
- package/dist/web/search.js.map +1 -0
- package/dist/web/sitemap.d.ts +120 -0
- package/dist/web/sitemap.d.ts.map +1 -0
- package/dist/web/sitemap.js +199 -0
- package/dist/web/sitemap.js.map +1 -0
- package/dist/web/taxonomy.d.ts +152 -0
- package/dist/web/taxonomy.d.ts.map +1 -0
- package/dist/web/taxonomy.js +237 -0
- package/dist/web/taxonomy.js.map +1 -0
- package/dist/web/templates.d.ts +54 -16
- package/dist/web/templates.d.ts.map +1 -1
- package/dist/web/templates.js +109 -28
- package/dist/web/templates.js.map +1 -1
- package/dist/web/themes.d.ts +205 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +277 -0
- package/dist/web/themes.js.map +1 -0
- package/dist/webmention/discovery.d.ts +51 -0
- package/dist/webmention/discovery.d.ts.map +1 -0
- package/dist/webmention/discovery.js +176 -0
- package/dist/webmention/discovery.js.map +1 -0
- package/dist/webmention/html.d.ts +71 -0
- package/dist/webmention/html.d.ts.map +1 -0
- package/dist/webmention/html.js +285 -0
- package/dist/webmention/html.js.map +1 -0
- package/dist/webmention/index.d.ts +12 -0
- package/dist/webmention/index.d.ts.map +1 -0
- package/dist/webmention/index.js +8 -0
- package/dist/webmention/index.js.map +1 -0
- package/dist/webmention/links.d.ts +18 -0
- package/dist/webmention/links.d.ts.map +1 -0
- package/dist/webmention/links.js +64 -0
- package/dist/webmention/links.js.map +1 -0
- package/dist/webmention/microformats.d.ts +93 -0
- package/dist/webmention/microformats.d.ts.map +1 -0
- package/dist/webmention/microformats.js +376 -0
- package/dist/webmention/microformats.js.map +1 -0
- package/dist/webmention/receive.d.ts +141 -0
- package/dist/webmention/receive.d.ts.map +1 -0
- package/dist/webmention/receive.js +264 -0
- package/dist/webmention/receive.js.map +1 -0
- package/dist/webmention/routes.d.ts +37 -0
- package/dist/webmention/routes.d.ts.map +1 -0
- package/dist/webmention/routes.js +75 -0
- package/dist/webmention/routes.js.map +1 -0
- package/dist/webmention/service.d.ts +94 -0
- package/dist/webmention/service.d.ts.map +1 -0
- package/dist/webmention/service.js +207 -0
- package/dist/webmention/service.js.map +1 -0
- package/package.json +11 -6
- package/templates/site/content/_data/site.json +1 -0
- package/templates/site/content/posts/2026-01-01-hello-world.md +5 -3
- package/templates/site/geekity.config.ts +11 -1
- package/templates/site/tsconfig.json +1 -1
- package/themes/default/README.md +1096 -50
- package/themes/default/layouts/404.njk +2 -3
- package/themes/default/layouts/author.njk +37 -0
- package/themes/default/layouts/base.njk +172 -31
- package/themes/default/layouts/category.njk +27 -0
- package/themes/default/layouts/front-page.njk +57 -0
- package/themes/default/layouts/home.njk +17 -1
- package/themes/default/layouts/page.njk +57 -5
- package/themes/default/layouts/post.njk +78 -19
- package/themes/default/layouts/search.njk +57 -0
- package/themes/default/layouts/tag.njk +3 -6
- package/themes/default/mail/comment-digest.html.njk +37 -0
- package/themes/default/mail/comment-digest.subject.njk +3 -0
- package/themes/default/mail/comment-digest.txt.njk +40 -0
- package/themes/default/mail/comment-pending.html.njk +27 -0
- package/themes/default/mail/comment-pending.subject.njk +2 -0
- package/themes/default/mail/comment-pending.txt.njk +24 -0
- package/themes/default/mail/comment-reply.html.njk +21 -0
- package/themes/default/mail/comment-reply.subject.njk +2 -0
- package/themes/default/mail/comment-reply.txt.njk +22 -0
- package/themes/default/mail/contact-message.html.njk +24 -0
- package/themes/default/mail/contact-message.subject.njk +5 -0
- package/themes/default/mail/contact-message.txt.njk +20 -0
- package/themes/default/mail/password-changed.html.njk +18 -0
- package/themes/default/mail/password-changed.subject.njk +2 -0
- package/themes/default/mail/password-changed.txt.njk +17 -0
- package/themes/default/mail/password-reset.html.njk +22 -0
- package/themes/default/mail/password-reset.subject.njk +2 -0
- package/themes/default/mail/password-reset.txt.njk +18 -0
- package/themes/default/mail/test.html.njk +14 -0
- package/themes/default/mail/test.subject.njk +2 -0
- package/themes/default/mail/test.txt.njk +12 -0
- package/themes/default/partials/archive.njk +27 -0
- package/themes/default/partials/bio.njk +77 -0
- package/themes/default/partials/comment-form.njk +109 -0
- package/themes/default/partials/contact-form.njk +88 -0
- package/themes/default/partials/conversation.njk +139 -0
- package/themes/default/partials/feeds.njk +26 -0
- package/themes/default/partials/jsonld.njk +120 -0
- package/themes/default/partials/pagination.njk +12 -6
- package/themes/default/partials/post-list.njk +51 -18
- package/themes/default/partials/search-form.njk +17 -0
- package/themes/default/partials/tags.njk +26 -5
- package/themes/default/static/highlight.js +4 -0
- package/themes/default/static/style.css +1119 -194
- package/themes/default/theme.json +5 -0
- package/admin/layouts/document-editor.njk +0 -167
- package/admin/layouts/federation.njk +0 -145
- package/admin/layouts/login.njk +0 -23
- package/admin/layouts/settings.njk +0 -116
- package/admin/layouts/setup.njk +0 -27
- package/admin/layouts/users.njk +0 -91
- /package/admin/{layouts/_flash.njk → components/flash.njk} +0 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { createPrivateKey, createPublicKey } from 'node:crypto';
|
|
2
|
+
import { exportJwk } from '@fedify/fedify';
|
|
3
|
+
import { setUserWordPressActor } from '../admin/accounts.js';
|
|
4
|
+
import { readFileIfPresentSync } from '../files/atomic.js';
|
|
5
|
+
import { actorKeyFile, loadActorKeyPairs, writeActorKeyFile } from './keys.js';
|
|
6
|
+
import { addFollower, readFollowers } from './records.js';
|
|
7
|
+
import { actorHandle, uriOf } from './replies.js';
|
|
8
|
+
/**
|
|
9
|
+
* Bringing one person across from the WordPress ActivityPub plugin
|
|
10
|
+
* (decision-14, TASK-71).
|
|
11
|
+
*
|
|
12
|
+
* Three things a site leaving the plugin cannot regenerate, and this is where
|
|
13
|
+
* they arrive: the RSA key pair its followers have cached, the actor id its
|
|
14
|
+
* followers key the account by, and the followers themselves. Everything else
|
|
15
|
+
* about the move — the posts, their ids, the compatibility paths — comes in
|
|
16
|
+
* with the content or is a setting.
|
|
17
|
+
*
|
|
18
|
+
* Nothing here is a screen, on purpose. A stored actor id is identity for the
|
|
19
|
+
* life of the account (doc-4), and identity is not something a form should be
|
|
20
|
+
* able to retype.
|
|
21
|
+
*/
|
|
22
|
+
/** The algorithm the plugin signs with, and the only one it has a key for. */
|
|
23
|
+
const RSA = 'RSASSA-PKCS1-v1_5';
|
|
24
|
+
/**
|
|
25
|
+
* Thrown when the user already has a key pair and this run was not told to
|
|
26
|
+
* replace it.
|
|
27
|
+
*
|
|
28
|
+
* Its own class because the answer is a flag rather than a correction, and
|
|
29
|
+
* because losing a private key is the one mistake this CMS cannot help with:
|
|
30
|
+
* every follower's server has cached the public half, and a new key means none
|
|
31
|
+
* of them can verify this person again.
|
|
32
|
+
*/
|
|
33
|
+
export class ExistingKeyPairError extends Error {
|
|
34
|
+
name = 'ExistingKeyPairError';
|
|
35
|
+
/** The file that is already there. */
|
|
36
|
+
file;
|
|
37
|
+
constructor(username, file) {
|
|
38
|
+
super(`${username} already has a different key pair, in ${file}. Importing over it would ` +
|
|
39
|
+
'change their identity: every follower has cached the public half of the key that is ' +
|
|
40
|
+
'there, and none of them could verify this person again. Pass --force only if you are ' +
|
|
41
|
+
'sure the pair being imported is the one the followers hold.');
|
|
42
|
+
this.file = file;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Thrown when the PEM is not an RSA private key at all. */
|
|
46
|
+
export class UnusableKeyPemError extends Error {
|
|
47
|
+
name = 'UnusableKeyPemError';
|
|
48
|
+
constructor(message, options) {
|
|
49
|
+
super(message, options);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Bring one WordPress actor's key pair across, and say what changed.
|
|
54
|
+
*
|
|
55
|
+
* Run twice with the same inputs it changes nothing and says so, which is what
|
|
56
|
+
* makes it safe to run again after a follower's server was down.
|
|
57
|
+
*/
|
|
58
|
+
export async function importWordPressActor(options) {
|
|
59
|
+
const { dataDir, username } = options;
|
|
60
|
+
// Everything that can be refused is decided before anything is written, so a
|
|
61
|
+
// run that is going to stop stops with the disk as it was.
|
|
62
|
+
const planned = await planKeyImport(options);
|
|
63
|
+
const identity = (await setUserWordPressActor({
|
|
64
|
+
dataDir,
|
|
65
|
+
username,
|
|
66
|
+
actorId: options.actorId,
|
|
67
|
+
wordpressActorId: options.wordpressActorId,
|
|
68
|
+
}))
|
|
69
|
+
? 'set'
|
|
70
|
+
: 'unchanged';
|
|
71
|
+
const keys = [applyKeyImport(dataDir, username, planned)];
|
|
72
|
+
// The Ed25519 pair is minted here rather than left to the first request,
|
|
73
|
+
// because this is also what proves the file just written imports: Fedify
|
|
74
|
+
// swallows what a key pairs dispatcher throws, so an unusable key found at
|
|
75
|
+
// request time would be found by nobody.
|
|
76
|
+
const ed25519File = actorKeyFile(dataDir, username, 'Ed25519');
|
|
77
|
+
const hadEd25519 = readFileIfPresentSync(ed25519File) !== undefined;
|
|
78
|
+
await loadActorKeyPairs(dataDir, username);
|
|
79
|
+
keys.push({
|
|
80
|
+
file: ed25519File,
|
|
81
|
+
algorithm: 'Ed25519',
|
|
82
|
+
state: hadEd25519 ? 'unchanged' : 'generated',
|
|
83
|
+
});
|
|
84
|
+
const followers = await importFollowers(options);
|
|
85
|
+
return {
|
|
86
|
+
username,
|
|
87
|
+
actorId: options.actorId,
|
|
88
|
+
wordpressActorId: options.wordpressActorId,
|
|
89
|
+
identity,
|
|
90
|
+
keys,
|
|
91
|
+
followers,
|
|
92
|
+
changed: identity === 'set' ||
|
|
93
|
+
keys.some((key) => key.state !== 'unchanged') ||
|
|
94
|
+
followers.added.length > 0 ||
|
|
95
|
+
followers.refreshed.length > 0,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Bring the followers across: read the collection, work out who each item is,
|
|
100
|
+
* and put them in the user's `followers.json` and the index.
|
|
101
|
+
*
|
|
102
|
+
* The plugin's collection carries nothing but a `first` page, and the page's
|
|
103
|
+
* `orderedItems` are bare actor URLs, so almost every follower here costs one
|
|
104
|
+
* fetch. That is the one step of the import that is really a network
|
|
105
|
+
* operation, which is why it can be pointed at a file instead: an owner who
|
|
106
|
+
* saved the collection before the DNS moved has everything they need offline.
|
|
107
|
+
*
|
|
108
|
+
* {@link addFollower} is what writes, so a follower already in the file keeps
|
|
109
|
+
* the place and the follow time it has — running this again after an instance
|
|
110
|
+
* came back adds the missing people and moves nobody.
|
|
111
|
+
*/
|
|
112
|
+
async function importFollowers(options) {
|
|
113
|
+
const empty = {
|
|
114
|
+
source: undefined,
|
|
115
|
+
added: [],
|
|
116
|
+
unchanged: [],
|
|
117
|
+
refreshed: [],
|
|
118
|
+
failed: [],
|
|
119
|
+
};
|
|
120
|
+
if (options.followers === false)
|
|
121
|
+
return empty;
|
|
122
|
+
const { admin, contentDir, username } = options;
|
|
123
|
+
const source = options.followers ?? followersCollectionUrl(options);
|
|
124
|
+
const added = [];
|
|
125
|
+
const unchanged = [];
|
|
126
|
+
const refreshed = [];
|
|
127
|
+
const failed = [];
|
|
128
|
+
for (const item of await collectionItems(source)) {
|
|
129
|
+
const actor = uriOf(item) ?? String(item);
|
|
130
|
+
try {
|
|
131
|
+
const document = isRecord(item) && uriOf(item['inbox']) !== null ? item : await fetchAs(actor);
|
|
132
|
+
const follower = followerFrom(document);
|
|
133
|
+
const held = readFollowers(contentDir, username).find((entry) => entry.actorId === follower.actorId);
|
|
134
|
+
await addFollower({ admin, contentDir }, username, follower);
|
|
135
|
+
if (held === undefined)
|
|
136
|
+
added.push(follower.actorId);
|
|
137
|
+
else if (sameFollower(held, follower))
|
|
138
|
+
unchanged.push(follower.actorId);
|
|
139
|
+
else
|
|
140
|
+
refreshed.push(follower.actorId);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
failed.push({ actor, reason: messageOf(error) });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { source, added, unchanged, refreshed, failed };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The plugin's public followers collection for this actor.
|
|
150
|
+
*
|
|
151
|
+
* Built from the stored actor id's own origin rather than from anything the
|
|
152
|
+
* command was told separately: the id is the one URL an owner is certain to
|
|
153
|
+
* have right, and it is the site the followers are still pointed at.
|
|
154
|
+
*/
|
|
155
|
+
function followersCollectionUrl(options) {
|
|
156
|
+
const number = String(options.wordpressActorId);
|
|
157
|
+
return new URL(`/wp-json/activitypub/1.0/actors/${number}/followers`, options.actorId).href;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Everything a followers collection names, in the order it names them.
|
|
161
|
+
*
|
|
162
|
+
* A collection with no items of its own is followed through `first`, and a
|
|
163
|
+
* page through `next`, until there is nowhere left to go; either may be a URL
|
|
164
|
+
* to fetch or a page already embedded in the document. URLs already visited
|
|
165
|
+
* are not visited again, because a server whose `next` points back at itself
|
|
166
|
+
* would otherwise be an endless import.
|
|
167
|
+
*/
|
|
168
|
+
async function collectionItems(source) {
|
|
169
|
+
const items = [];
|
|
170
|
+
const seen = new Set();
|
|
171
|
+
let document = isUrl(source) ? await fetchAs(source) : readJsonFile(source);
|
|
172
|
+
if (isUrl(source))
|
|
173
|
+
seen.add(source);
|
|
174
|
+
while (isRecord(document)) {
|
|
175
|
+
const listed = document['orderedItems'] ?? document['items'];
|
|
176
|
+
const here = Array.isArray(listed) ? listed : undefined;
|
|
177
|
+
if (here !== undefined)
|
|
178
|
+
items.push(...here);
|
|
179
|
+
// `next` on a page; `first` only when this document listed nothing itself,
|
|
180
|
+
// which is the plugin's outer collection.
|
|
181
|
+
const onward = document['next'] ?? (here === undefined ? document['first'] : undefined);
|
|
182
|
+
if (onward === undefined || onward === null)
|
|
183
|
+
break;
|
|
184
|
+
if (isRecord(onward)) {
|
|
185
|
+
document = onward;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const url = uriOf(onward);
|
|
189
|
+
if (url === null || seen.has(url))
|
|
190
|
+
break;
|
|
191
|
+
seen.add(url);
|
|
192
|
+
document = await fetchAs(url);
|
|
193
|
+
}
|
|
194
|
+
return items;
|
|
195
|
+
}
|
|
196
|
+
/** A saved collection, as the JSON it holds. */
|
|
197
|
+
function readJsonFile(file) {
|
|
198
|
+
const source = readFileIfPresentSync(file);
|
|
199
|
+
if (source === undefined) {
|
|
200
|
+
throw new Error(`There is no followers collection at ${file}.`);
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
return JSON.parse(source);
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
throw new Error(`${file} could not be read as JSON: ${messageOf(error)}`, { cause: error });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** Whether a `--followers` value is a URL to fetch rather than a file to read. */
|
|
210
|
+
function isUrl(source) {
|
|
211
|
+
try {
|
|
212
|
+
const url = new URL(source);
|
|
213
|
+
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/** What a peer should ask a fediverse server for. */
|
|
220
|
+
const ACTIVITY_STREAMS_ACCEPT = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
|
221
|
+
/** One ActivityStreams document, or a thrown error naming the URL and the status. */
|
|
222
|
+
async function fetchAs(url) {
|
|
223
|
+
let response;
|
|
224
|
+
try {
|
|
225
|
+
response = await fetch(url, { headers: { accept: ACTIVITY_STREAMS_ACCEPT } });
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
throw new Error(`${url} could not be fetched: ${messageOf(error)}`, { cause: error });
|
|
229
|
+
}
|
|
230
|
+
if (!response.ok) {
|
|
231
|
+
throw new Error(`${url} answered ${String(response.status)} ${response.statusText}`.trim());
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
return await response.json();
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
throw new Error(`${url} did not answer with JSON: ${messageOf(error)}`, { cause: error });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* One actor document as the follower it stands for.
|
|
242
|
+
*
|
|
243
|
+
* Read straight out of the JSON rather than through Fedify's vocabulary,
|
|
244
|
+
* because this is the one place in the CMS that has a plain document and no
|
|
245
|
+
* federation context to dereference with. The six fields are the ones
|
|
246
|
+
* `followers.json` holds (doc-4): two to deliver with, four to show.
|
|
247
|
+
*/
|
|
248
|
+
function followerFrom(document) {
|
|
249
|
+
if (!isRecord(document))
|
|
250
|
+
throw new Error('that is not an actor document');
|
|
251
|
+
const actorId = uriOf(document['id']);
|
|
252
|
+
const inboxId = uriOf(document['inbox']);
|
|
253
|
+
if (actorId === null)
|
|
254
|
+
throw new Error('that actor document has no id');
|
|
255
|
+
if (inboxId === null)
|
|
256
|
+
throw new Error(`${actorId} publishes no inbox to deliver to`);
|
|
257
|
+
const endpoints = document['endpoints'];
|
|
258
|
+
const icon = document['icon'];
|
|
259
|
+
return {
|
|
260
|
+
actorId,
|
|
261
|
+
inboxId,
|
|
262
|
+
sharedInboxId: isRecord(endpoints) ? uriOf(endpoints['sharedInbox']) : null,
|
|
263
|
+
handle: handleOf(document, actorId),
|
|
264
|
+
name: textOf(document['name']) ?? null,
|
|
265
|
+
iconUrl: uriOf(isRecord(icon) ? icon['url'] : icon),
|
|
266
|
+
url: uriOf(document['url']),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* `@name@host` for an actor, from its `preferredUsername` where it has one.
|
|
271
|
+
*
|
|
272
|
+
* Falling back to {@link actorHandle}, which guesses from the URL, for the
|
|
273
|
+
* server that publishes no `preferredUsername` at all.
|
|
274
|
+
*/
|
|
275
|
+
function handleOf(document, actorId) {
|
|
276
|
+
const preferred = textOf(document['preferredUsername']);
|
|
277
|
+
if (preferred === undefined || preferred === '')
|
|
278
|
+
return actorHandle(actorId) ?? null;
|
|
279
|
+
try {
|
|
280
|
+
return `@${preferred.replace(/^@/, '')}@${new URL(actorId).host}`;
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/** Whether a stored follower already says everything this one does. */
|
|
287
|
+
function sameFollower(held, incoming) {
|
|
288
|
+
return (held.inboxId === incoming.inboxId &&
|
|
289
|
+
held.sharedInboxId === incoming.sharedInboxId &&
|
|
290
|
+
held.handle === incoming.handle &&
|
|
291
|
+
held.name === incoming.name &&
|
|
292
|
+
held.iconUrl === incoming.iconUrl &&
|
|
293
|
+
held.url === incoming.url);
|
|
294
|
+
}
|
|
295
|
+
/** A JSON-LD string value, which may be wrapped in a language map. */
|
|
296
|
+
function textOf(value) {
|
|
297
|
+
if (Array.isArray(value)) {
|
|
298
|
+
for (const item of value) {
|
|
299
|
+
const found = textOf(item);
|
|
300
|
+
if (found !== undefined)
|
|
301
|
+
return found;
|
|
302
|
+
}
|
|
303
|
+
return undefined;
|
|
304
|
+
}
|
|
305
|
+
if (isRecord(value))
|
|
306
|
+
return textOf(value['@value']);
|
|
307
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
308
|
+
}
|
|
309
|
+
function isRecord(value) {
|
|
310
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Work out what the exported PEM means for
|
|
314
|
+
* `data/keys/{username}.rsassa-pkcs1-v1_5.jwk`, without touching it.
|
|
315
|
+
*
|
|
316
|
+
* A file already holding this very key is left alone and reported unchanged —
|
|
317
|
+
* that is what makes the whole command idempotent — and one holding a
|
|
318
|
+
* different key is refused unless the run was told to replace it.
|
|
319
|
+
*/
|
|
320
|
+
async function planKeyImport(options) {
|
|
321
|
+
const { dataDir, username } = options;
|
|
322
|
+
const privateKey = privateKeyFrom(options.privateKeyPem);
|
|
323
|
+
assertPairMatches(privateKey, options.publicKeyPem);
|
|
324
|
+
const jwk = `${JSON.stringify(await privateJwkOf(privateKey), undefined, 2)}\n`;
|
|
325
|
+
const file = actorKeyFile(dataDir, username, RSA);
|
|
326
|
+
const held = readFileIfPresentSync(file);
|
|
327
|
+
if (held === undefined)
|
|
328
|
+
return { file, algorithm: RSA, state: 'imported', jwk };
|
|
329
|
+
if (sameKeyFile(held, jwk))
|
|
330
|
+
return { file, algorithm: RSA, state: 'unchanged', jwk: undefined };
|
|
331
|
+
if (options.force !== true)
|
|
332
|
+
throw new ExistingKeyPairError(username, file);
|
|
333
|
+
return { file, algorithm: RSA, state: 'replaced', jwk };
|
|
334
|
+
}
|
|
335
|
+
/** Carry out what {@link planKeyImport} decided. */
|
|
336
|
+
function applyKeyImport(dataDir, username, planned) {
|
|
337
|
+
const { jwk, ...key } = planned;
|
|
338
|
+
if (jwk !== undefined)
|
|
339
|
+
writeActorKeyFile(dataDir, username, key.algorithm, jwk);
|
|
340
|
+
return key;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* The PEM as a key object, whichever of the two encodings the export used.
|
|
344
|
+
*
|
|
345
|
+
* PHP writes `-----BEGIN PRIVATE KEY-----` (PKCS#8) on OpenSSL 3 and
|
|
346
|
+
* `-----BEGIN RSA PRIVATE KEY-----` (PKCS#1) on older builds, and an owner
|
|
347
|
+
* copying one out of `wp option get` has no reason to know which they have.
|
|
348
|
+
* `createPrivateKey` reads both.
|
|
349
|
+
*/
|
|
350
|
+
function privateKeyFrom(pem) {
|
|
351
|
+
const text = pem.trim();
|
|
352
|
+
if (text === '') {
|
|
353
|
+
throw new UnusableKeyPemError('The private key is empty. Check what the export wrote.');
|
|
354
|
+
}
|
|
355
|
+
let key;
|
|
356
|
+
try {
|
|
357
|
+
key = createPrivateKey({ key: text, format: 'pem' });
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
throw new UnusableKeyPemError(`That is not a PEM private key: ${messageOf(error)}. It should begin with ` +
|
|
361
|
+
'"-----BEGIN PRIVATE KEY-----" or "-----BEGIN RSA PRIVATE KEY-----".', { cause: error });
|
|
362
|
+
}
|
|
363
|
+
if (key.asymmetricKeyType !== 'rsa') {
|
|
364
|
+
throw new UnusableKeyPemError(`That is a ${String(key.asymmetricKeyType)} key, and the WordPress ActivityPub plugin ` +
|
|
365
|
+
'signs with RSA. Check that the right key was exported.');
|
|
366
|
+
}
|
|
367
|
+
return key;
|
|
368
|
+
}
|
|
369
|
+
/** Refuse an export whose two halves are not halves of one pair. */
|
|
370
|
+
function assertPairMatches(privateKey, publicKeyPem) {
|
|
371
|
+
const text = (publicKeyPem ?? '').trim();
|
|
372
|
+
if (text === '')
|
|
373
|
+
return;
|
|
374
|
+
let given;
|
|
375
|
+
try {
|
|
376
|
+
given = createPublicKey({ key: text, format: 'pem' });
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
throw new UnusableKeyPemError(`That is not a PEM public key: ${messageOf(error)}.`, {
|
|
380
|
+
cause: error,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
const derived = createPublicKey(privateKey);
|
|
384
|
+
if (!given
|
|
385
|
+
.export({ type: 'spki', format: 'der' })
|
|
386
|
+
.equals(derived.export({ type: 'spki', format: 'der' }))) {
|
|
387
|
+
throw new UnusableKeyPemError('The public and private keys are not two halves of one pair. Export both again from the ' +
|
|
388
|
+
'same WordPress user, or leave the public key off — it is derived from the private one.');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* The private JWK the key file holds, produced the way a generated one is.
|
|
393
|
+
*
|
|
394
|
+
* The PEM goes to DER through node:crypto, into WebCrypto, and out through
|
|
395
|
+
* Fedify's `exportJwk` — the same call `loadActorKeyPairs` makes when it mints
|
|
396
|
+
* a pair. Going the long way round rather than asking node:crypto for the JWK
|
|
397
|
+
* directly is what guarantees an imported file and a generated one carry the
|
|
398
|
+
* same members in the same shape, `alg: "RS256"` included, which is what the
|
|
399
|
+
* loader's boot check insists on.
|
|
400
|
+
*/
|
|
401
|
+
async function privateJwkOf(privateKey) {
|
|
402
|
+
const pkcs8 = privateKey.export({ type: 'pkcs8', format: 'der' });
|
|
403
|
+
const key = await crypto.subtle.importKey('pkcs8', pkcs8, { name: RSA, hash: 'SHA-256' }, true, [
|
|
404
|
+
'sign',
|
|
405
|
+
]);
|
|
406
|
+
return await exportJwk(key);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Whether a key file already holds the key being imported.
|
|
410
|
+
*
|
|
411
|
+
* Compared as the parsed JWK rather than as bytes, so a file somebody
|
|
412
|
+
* reindented is still the same key.
|
|
413
|
+
*/
|
|
414
|
+
function sameKeyFile(held, incoming) {
|
|
415
|
+
try {
|
|
416
|
+
return (JSON.stringify(JSON.parse(held)) ===
|
|
417
|
+
JSON.stringify(JSON.parse(incoming)));
|
|
418
|
+
}
|
|
419
|
+
catch {
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function messageOf(error) {
|
|
424
|
+
return error instanceof Error ? error.message : String(error);
|
|
425
|
+
}
|
|
426
|
+
//# sourceMappingURL=import-wordpress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-wordpress.js","sourceRoot":"","sources":["../../src/federation/import-wordpress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE/E,OAAO,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,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import type { InboxContext } from '@fedify/fedify';
|
|
2
|
-
import { Follow } from '@fedify/vocab';
|
|
3
|
-
import type { Activity, Actor, Announce, Create, Delete, Like, Undo } from '@fedify/vocab';
|
|
2
|
+
import { Accept, Follow } from '@fedify/vocab';
|
|
3
|
+
import type { Activity, Actor, Announce, Create, Delete, Like, Reject, Undo } from '@fedify/vocab';
|
|
4
4
|
import type { NewFollower } from '../admin/store.ts';
|
|
5
5
|
import type { FederationContextData } from './federation.ts';
|
|
6
6
|
/** What an inbox handler is handed: a Fedify context over the CMS's stores. */
|
|
7
7
|
export type SiteInboxContext = InboxContext<FederationContextData>;
|
|
8
8
|
/**
|
|
9
|
-
* Handle a `Follow`: store the follower and reply
|
|
9
|
+
* Handle a `Follow`: store the follower under the user it named, and reply
|
|
10
|
+
* `Accept` as that user.
|
|
10
11
|
*
|
|
11
|
-
* A `Follow` of anything but
|
|
12
|
-
* a peer that asked to follow a post has not done anything wrong, it
|
|
13
|
-
* merely addressed something that does not accept followers. The reply
|
|
14
|
-
* to the follower's own inbox rather than through the followers
|
|
15
|
-
* because at this moment the follow is not yet a fact for anybody
|
|
12
|
+
* A `Follow` of anything but one of this site's users is ignored rather than
|
|
13
|
+
* refused — a peer that asked to follow a post has not done anything wrong, it
|
|
14
|
+
* has merely addressed something that does not accept followers. The reply
|
|
15
|
+
* goes to the follower's own inbox rather than through the followers
|
|
16
|
+
* collection, because at this moment the follow is not yet a fact for anybody
|
|
17
|
+
* but us.
|
|
16
18
|
*
|
|
17
19
|
* Following twice is a no-op beyond refreshing the stored profile: the store
|
|
18
|
-
* is keyed by actor
|
|
19
|
-
* or repeated `Follow` cannot turn one follower into two.
|
|
20
|
+
* is keyed by the pair (user, actor) and keeps the original follow time, so a
|
|
21
|
+
* redelivered or repeated `Follow` cannot turn one follower into two. One
|
|
22
|
+
* actor may follow two of this site's users, and that is two rows.
|
|
20
23
|
*/
|
|
21
24
|
export declare function handleFollow(context: SiteInboxContext, follow: Follow): Promise<void>;
|
|
22
25
|
/**
|
|
@@ -37,6 +40,20 @@ export declare function handleUndo(context: SiteInboxContext, undo: Undo): Promi
|
|
|
37
40
|
* object to remove.
|
|
38
41
|
*/
|
|
39
42
|
export declare function handleDelete(context: SiteInboxContext, activity: Delete): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Handle an `Accept`: a relay agreeing to the subscription the site asked for.
|
|
45
|
+
*
|
|
46
|
+
* The site follows nothing but relays (doc-4 keeps its `following` collection
|
|
47
|
+
* empty), so an `Accept` addressed to it is an answer to one of the `Follow`
|
|
48
|
+
* activities TASK-40 sends — or a stray, which {@link acceptRelay} recognises
|
|
49
|
+
* as one and leaves alone.
|
|
50
|
+
*/
|
|
51
|
+
export declare function handleAccept(context: SiteInboxContext, accept: Accept): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Handle a `Reject`: a relay refusing the subscription, with whatever it said
|
|
54
|
+
* about why, which the federation screen shows beside the relay.
|
|
55
|
+
*/
|
|
56
|
+
export declare function handleReject(context: SiteInboxContext, reject: Reject): Promise<void>;
|
|
40
57
|
/**
|
|
41
58
|
* Handle a `Like`, an `Announce` or a `Create`: record it and do nothing else.
|
|
42
59
|
*
|
|
@@ -47,15 +64,21 @@ export declare function handleDelete(context: SiteInboxContext, activity: Delete
|
|
|
47
64
|
*/
|
|
48
65
|
export declare function handleLoggedActivity(context: SiteInboxContext, activity: Like | Announce | Create): Promise<void>;
|
|
49
66
|
/**
|
|
50
|
-
* Write one inbound activity to the log
|
|
67
|
+
* Write one inbound activity to the log, attributed to the user it was
|
|
68
|
+
* addressed to.
|
|
51
69
|
*
|
|
52
70
|
* Every handled activity goes through here, the follow traffic included, so
|
|
53
71
|
* the log is a complete record of what the inbox was told rather than of what
|
|
54
72
|
* the inbox ignored. An activity with no actor is dropped: Fedify has already
|
|
55
73
|
* refused anything whose signature does not match its actor, so an activity
|
|
56
74
|
* without one is malformed rather than anonymous.
|
|
75
|
+
*
|
|
76
|
+
* The recipient defaults to the inbox the delivery arrived at —
|
|
77
|
+
* `context.recipient` is the username for a personal inbox and `null` for the
|
|
78
|
+
* shared one — and a caller that has worked out the addressee for itself, as
|
|
79
|
+
* `handleFollow` has, names it instead (decision-14).
|
|
57
80
|
*/
|
|
58
|
-
export declare function logActivity(context: SiteInboxContext, activity: Activity): Promise<void>;
|
|
81
|
+
export declare function logActivity(context: SiteInboxContext, activity: Activity, recipient?: string | undefined): Promise<void>;
|
|
59
82
|
/**
|
|
60
83
|
* A remote actor as the follower row that describes it, or `undefined` when
|
|
61
84
|
* it is not deliverable.
|
|
@@ -64,5 +87,5 @@ export declare function logActivity(context: SiteInboxContext, activity: Activit
|
|
|
64
87
|
* the site could never deliver to is a row that would only ever fail, and
|
|
65
88
|
* both are the minimum ActivityPub asks of an actor.
|
|
66
89
|
*/
|
|
67
|
-
export declare function followerFrom(context: SiteInboxContext, actor: Actor): Promise<NewFollower | undefined>;
|
|
90
|
+
export declare function followerFrom(context: SiteInboxContext, actor: Actor): Promise<Omit<NewFollower, 'username'> | undefined>;
|
|
68
91
|
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/federation/inbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/federation/inbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,QAAQ,EACR,KAAK,EACL,QAAQ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