@meith/web 0.16.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/LICENSE.md +165 -0
- package/app/(auth)/layout.tsx +6 -0
- package/app/(auth)/login/page.tsx +106 -0
- package/app/(auth)/login/verify/page.tsx +55 -0
- package/app/(auth)/register/page.tsx +83 -0
- package/app/(auth)/reset/confirm/page.tsx +45 -0
- package/app/(auth)/reset/page.tsx +22 -0
- package/app/(auth)/verify/page.tsx +44 -0
- package/app/(auth)/verify/resend/page.tsx +51 -0
- package/app/(board)/[slug]/feed.xml/route.ts +48 -0
- package/app/(board)/[slug]/new/page.tsx +112 -0
- package/app/(board)/[slug]/page.tsx +403 -0
- package/app/(board)/discover/[view]/page.tsx +115 -0
- package/app/(board)/discover/page.tsx +5 -0
- package/app/(board)/layout.tsx +22 -0
- package/app/(board)/member/[id]/page.tsx +187 -0
- package/app/(board)/member/[id]/reputation/page.tsx +195 -0
- package/app/(board)/member/by-name/[name]/page.tsx +32 -0
- package/app/(board)/messages/[id]/page.tsx +103 -0
- package/app/(board)/messages/compose/page.tsx +60 -0
- package/app/(board)/messages/layout.tsx +5 -0
- package/app/(board)/messages/page.tsx +179 -0
- package/app/(board)/modcp/forums/page.tsx +59 -0
- package/app/(board)/modcp/ip/page.tsx +158 -0
- package/app/(board)/modcp/layout.tsx +5 -0
- package/app/(board)/modcp/log/page.tsx +98 -0
- package/app/(board)/modcp/page.tsx +112 -0
- package/app/(board)/moderation/layout.tsx +5 -0
- package/app/(board)/moderation/page.tsx +111 -0
- package/app/(board)/moderation/reports/page.tsx +193 -0
- package/app/(board)/moderation/warn/page.tsx +158 -0
- package/app/(board)/notifications/layout.tsx +5 -0
- package/app/(board)/notifications/page.tsx +144 -0
- package/app/(board)/notifications/preferences/page.tsx +65 -0
- package/app/(board)/online/page.tsx +119 -0
- package/app/(board)/page.tsx +195 -0
- package/app/(board)/plugins/[key]/[[...path]]/page.tsx +72 -0
- package/app/(board)/privacy/page.tsx +12 -0
- package/app/(board)/report/page.tsx +71 -0
- package/app/(board)/rules/page.tsx +12 -0
- package/app/(board)/search/[token]/page.tsx +130 -0
- package/app/(board)/search/page.tsx +289 -0
- package/app/(board)/stats/page.tsx +202 -0
- package/app/(board)/subscriptions/layout.tsx +5 -0
- package/app/(board)/subscriptions/page.tsx +142 -0
- package/app/(board)/terms/page.tsx +12 -0
- package/app/(board)/thread/[slug]/edit/page.tsx +107 -0
- package/app/(board)/thread/[slug]/feed.xml/route.ts +42 -0
- package/app/(board)/thread/[slug]/page.tsx +707 -0
- package/app/(board)/thread/[slug]/poll/page.tsx +41 -0
- package/app/(board)/thread/[slug]/post/[postId]/history/page.tsx +160 -0
- package/app/(board)/thread/[slug]/reply/page.tsx +136 -0
- package/app/(board)/unsubscribe/page.tsx +73 -0
- package/app/(board)/usercp/avatar/page.tsx +56 -0
- package/app/(board)/usercp/contacts/page.tsx +141 -0
- package/app/(board)/usercp/email/confirm/page.tsx +52 -0
- package/app/(board)/usercp/layout.tsx +23 -0
- package/app/(board)/usercp/options/page.tsx +56 -0
- package/app/(board)/usercp/page.tsx +71 -0
- package/app/(board)/usercp/profile/page.tsx +81 -0
- package/app/(board)/usercp/security/page.tsx +238 -0
- package/app/(board)/usercp/security/verify/page.tsx +92 -0
- package/app/(board)/usercp/signature/page.tsx +67 -0
- package/app/admin/antispam/page.tsx +155 -0
- package/app/admin/api/marketplace/screenshot/route.ts +68 -0
- package/app/admin/api/plugins/[key]/[...path]/route.ts +27 -0
- package/app/admin/api-tokens/page.tsx +129 -0
- package/app/admin/content/announcements/page.tsx +110 -0
- package/app/admin/content/attachments/page.tsx +199 -0
- package/app/admin/content/navigation/page.tsx +123 -0
- package/app/admin/content/page.tsx +170 -0
- package/app/admin/forums/[id]/page.tsx +96 -0
- package/app/admin/forums/[id]/permissions/page.tsx +108 -0
- package/app/admin/forums/page.tsx +45 -0
- package/app/admin/groups/[id]/page.tsx +133 -0
- package/app/admin/groups/memberships/page.tsx +56 -0
- package/app/admin/groups/page.tsx +104 -0
- package/app/admin/groups/promotions/page.tsx +143 -0
- package/app/admin/layout.tsx +86 -0
- package/app/admin/log/page.tsx +116 -0
- package/app/admin/page.tsx +206 -0
- package/app/admin/plugins/[key]/[[...path]]/page.tsx +276 -0
- package/app/admin/plugins/browse/page.tsx +70 -0
- package/app/admin/plugins/page.tsx +165 -0
- package/app/admin/security/page.tsx +124 -0
- package/app/admin/settings/page.tsx +190 -0
- package/app/admin/system/page.tsx +303 -0
- package/app/admin/themes/[key]/page.tsx +110 -0
- package/app/admin/themes/browse/page.tsx +70 -0
- package/app/admin/themes/page.tsx +163 -0
- package/app/admin/users/[id]/merge/page.tsx +136 -0
- package/app/admin/users/[id]/page.tsx +208 -0
- package/app/admin/users/mail/page.tsx +68 -0
- package/app/admin/users/page.tsx +260 -0
- package/app/admin/users/prune/page.tsx +186 -0
- package/app/api/health/route.ts +11 -0
- package/app/api/metrics/route.ts +66 -0
- package/app/api/plugins/[key]/[...path]/route.ts +27 -0
- package/app/api/read/all/route.ts +15 -0
- package/app/api/read/forum/[id]/route.ts +29 -0
- package/app/api/read/thread/[id]/route.ts +40 -0
- package/app/api/ready/route.ts +63 -0
- package/app/api/system/tick/route.ts +77 -0
- package/app/api/v1/[...path]/route.ts +208 -0
- package/app/api/v1/openapi.json/route.ts +12 -0
- package/app/apple-icon.ts +11 -0
- package/app/atom.xml/route.ts +7 -0
- package/app/attachment/[id]/route.ts +10 -0
- package/app/attachment/[id]/thumb/route.ts +10 -0
- package/app/auth/passkey/options/route.ts +145 -0
- package/app/auth/passkey/verify/route.ts +241 -0
- package/app/auth/resume/route.ts +55 -0
- package/app/auth/sso/[provider]/callback/route.ts +173 -0
- package/app/auth/sso/[provider]/go/route.ts +57 -0
- package/app/auth/sso/[provider]/route.ts +105 -0
- package/app/avatar/[id]/route.ts +31 -0
- package/app/brand/icon-192.png/route.ts +7 -0
- package/app/brand/icon-512.png/route.ts +7 -0
- package/app/brand/icon-maskable.png/route.ts +7 -0
- package/app/demo/stripe/[[...path]]/route.ts +27 -0
- package/app/error.tsx +15 -0
- package/app/feed.xml/route.ts +7 -0
- package/app/forumdisplay.php/page.tsx +11 -0
- package/app/group/[id]/badge/[scheme]/route.ts +26 -0
- package/app/icon.ts +13 -0
- package/app/install/page.tsx +221 -0
- package/app/jump/page.tsx +28 -0
- package/app/layout.tsx +124 -0
- package/app/logo/[scheme]/route.ts +24 -0
- package/app/manifest.ts +43 -0
- package/app/member.php/page.tsx +11 -0
- package/app/memberlist.php/page.tsx +11 -0
- package/app/not-found.tsx +14 -0
- package/app/opengraph-image.ts +11 -0
- package/app/redirect/page.tsx +44 -0
- package/app/robots.txt/route.ts +35 -0
- package/app/showthread.php/page.tsx +11 -0
- package/app/sitemap/[page]/route.ts +64 -0
- package/app/sitemap.xml/route.ts +31 -0
- package/app/twitter-image.ts +11 -0
- package/app/viewforum.php/page.tsx +11 -0
- package/app/viewtopic.php/page.tsx +11 -0
- package/bin/forum-web.mjs +241 -0
- package/components.json +21 -0
- package/instrumentation.ts +18 -0
- package/next.config.mjs +182 -0
- package/package.json +99 -0
- package/postcss.config.mjs +7 -0
- package/proxy.ts +160 -0
- package/src/components/account/active-sessions.tsx +87 -0
- package/src/components/account/avatar-form.tsx +119 -0
- package/src/components/account/credential-proof-form.tsx +76 -0
- package/src/components/account/logout-form.tsx +14 -0
- package/src/components/account/notification-forms.tsx +157 -0
- package/src/components/account/passkey-enrol.tsx +81 -0
- package/src/components/account/passkey-proof-button.tsx +47 -0
- package/src/components/account/push-device-form.tsx +193 -0
- package/src/components/account/relation-forms.tsx +69 -0
- package/src/components/account/reputation-forms.tsx +124 -0
- package/src/components/account/security-activity.tsx +46 -0
- package/src/components/account/sign-in-methods.tsx +166 -0
- package/src/components/account/subscription-forms.tsx +151 -0
- package/src/components/account/two-factor-forms.tsx +226 -0
- package/src/components/account/usercp-forms.tsx +387 -0
- package/src/components/account/usercp-nav.tsx +14 -0
- package/src/components/account/usercp-shell.tsx +34 -0
- package/src/components/admin/admin-forms.tsx +92 -0
- package/src/components/admin/admin-nav.tsx +52 -0
- package/src/components/admin/admin-undo.tsx +32 -0
- package/src/components/admin/api-token-forms.tsx +89 -0
- package/src/components/admin/badge-forms.tsx +97 -0
- package/src/components/admin/branding-forms.tsx +102 -0
- package/src/components/admin/content-forms.tsx +712 -0
- package/src/components/admin/form-bits.tsx +11 -0
- package/src/components/admin/forum-forms.tsx +524 -0
- package/src/components/admin/forum-tree.tsx +454 -0
- package/src/components/admin/group-forms.tsx +646 -0
- package/src/components/admin/mail-test-card.tsx +90 -0
- package/src/components/admin/marketplace-forms.tsx +30 -0
- package/src/components/admin/marketplace-listing.tsx +123 -0
- package/src/components/admin/navigation-forms.tsx +229 -0
- package/src/components/admin/navigation-tree.tsx +442 -0
- package/src/components/admin/oklch-picker.tsx +180 -0
- package/src/components/admin/plugin-forms.tsx +225 -0
- package/src/components/admin/settings-form.tsx +148 -0
- package/src/components/admin/system-forms.tsx +169 -0
- package/src/components/admin/theme-changes.tsx +354 -0
- package/src/components/admin/theme-forms.tsx +636 -0
- package/src/components/admin/theme-palette.tsx +119 -0
- package/src/components/admin/theme-preview.tsx +461 -0
- package/src/components/admin/user-bulk-toolbar.tsx +99 -0
- package/src/components/admin/user-forms.tsx +488 -0
- package/src/components/auth/auth-page.tsx +45 -0
- package/src/components/auth/form-controls.tsx +117 -0
- package/src/components/auth/login-form.tsx +47 -0
- package/src/components/auth/passkey-client.ts +171 -0
- package/src/components/auth/passkey-second-factor.tsx +69 -0
- package/src/components/auth/passkey-sign-in.tsx +61 -0
- package/src/components/auth/register-form.tsx +136 -0
- package/src/components/auth/resend-verification-form.tsx +34 -0
- package/src/components/auth/reset-confirm-form.tsx +43 -0
- package/src/components/auth/reset-request-form.tsx +35 -0
- package/src/components/auth/second-factor-form.tsx +51 -0
- package/src/components/auth/sso-buttons.tsx +47 -0
- package/src/components/board/live-region.tsx +74 -0
- package/src/components/board/search-off-notice.tsx +18 -0
- package/src/components/board/section-page.tsx +114 -0
- package/src/components/content/attachment-field.tsx +51 -0
- package/src/components/content/composer-field.ts +31 -0
- package/src/components/content/composer-ids.ts +6 -0
- package/src/components/content/composer-intents.tsx +27 -0
- package/src/components/content/composer-recovery.tsx +215 -0
- package/src/components/content/edit-post-form.tsx +121 -0
- package/src/components/content/markdown-editor.tsx +590 -0
- package/src/components/content/markdown-syntax.ts +53 -0
- package/src/components/content/mention-token.ts +23 -0
- package/src/components/content/multiquote-button.tsx +32 -0
- package/src/components/content/multiquote-selection.tsx +105 -0
- package/src/components/content/multiquote.ts +125 -0
- package/src/components/content/new-thread-form.tsx +169 -0
- package/src/components/content/poll-edit-form.tsx +96 -0
- package/src/components/content/poll.tsx +89 -0
- package/src/components/content/quote-in-place.tsx +51 -0
- package/src/components/content/reply-form.tsx +113 -0
- package/src/components/content/thanks-button.tsx +65 -0
- package/src/components/content/thread-rating.tsx +143 -0
- package/src/components/install/install-form.tsx +497 -0
- package/src/components/legal/legal-document.tsx +22 -0
- package/src/components/messages/message-forms.tsx +152 -0
- package/src/components/moderation/inline-moderation-form.tsx +158 -0
- package/src/components/moderation/modcp-nav.tsx +15 -0
- package/src/components/moderation/modcp-shell.tsx +41 -0
- package/src/components/moderation/queue-form.tsx +96 -0
- package/src/components/moderation/report-forms.tsx +120 -0
- package/src/components/moderation/signature-lock-form.tsx +83 -0
- package/src/components/moderation/thread-surgery-form.tsx +96 -0
- package/src/components/moderation/thread-tools-form.tsx +137 -0
- package/src/components/moderation/warning-forms.tsx +125 -0
- package/src/components/profile/custom-field.tsx +79 -0
- package/src/components/shell/appearance-icons.tsx +35 -0
- package/src/components/shell/board-notice.tsx +21 -0
- package/src/components/shell/copy-record.ts +20 -0
- package/src/components/shell/copy.tsx +17 -0
- package/src/components/shell/crash-notice.tsx +86 -0
- package/src/components/shell/demo-banner.tsx +49 -0
- package/src/components/shell/group-name-style.tsx +6 -0
- package/src/components/shell/measure.ts +1 -0
- package/src/components/shell/notification-menu.tsx +361 -0
- package/src/components/shell/offline-notice.tsx +29 -0
- package/src/components/shell/onboarding-banner.tsx +39 -0
- package/src/components/shell/page-shell.tsx +167 -0
- package/src/components/shell/panel-list.tsx +95 -0
- package/src/components/shell/panel-nav.tsx +40 -0
- package/src/components/shell/panel-overview.tsx +81 -0
- package/src/components/shell/panel-page.tsx +96 -0
- package/src/components/shell/panel-pagination.tsx +28 -0
- package/src/components/shell/panel-shell.tsx +31 -0
- package/src/components/shell/theme-runtime-style.tsx +6 -0
- package/src/components/shell/theme-switcher.tsx +97 -0
- package/src/components/shell/timezone-probe.tsx +45 -0
- package/src/components/shell/view-tabs.tsx +60 -0
- package/src/config.ts +13 -0
- package/src/server/absent-services.ts +29 -0
- package/src/server/admin-actions.ts +171 -0
- package/src/server/admin-settings-actions.ts +83 -0
- package/src/server/admin-undo-actions.ts +70 -0
- package/src/server/admin-undo.ts +75 -0
- package/src/server/admin.ts +112 -0
- package/src/server/announcements.ts +82 -0
- package/src/server/antispam.ts +310 -0
- package/src/server/api/content.ts +486 -0
- package/src/server/api/http.ts +119 -0
- package/src/server/api/members.ts +109 -0
- package/src/server/api/messages.ts +113 -0
- package/src/server/api/registry.ts +30 -0
- package/src/server/api/search.ts +98 -0
- package/src/server/api/subscriptions.ts +106 -0
- package/src/server/api-auth.ts +66 -0
- package/src/server/api-token-actions.ts +85 -0
- package/src/server/api-tokens-admin.ts +95 -0
- package/src/server/appearance-actions.ts +39 -0
- package/src/server/attachment-download.ts +43 -0
- package/src/server/attachment-embed.ts +63 -0
- package/src/server/attachment-upload-actions.ts +92 -0
- package/src/server/attachments.ts +257 -0
- package/src/server/auth-actions.ts +479 -0
- package/src/server/auth-config.ts +61 -0
- package/src/server/auth-events.ts +92 -0
- package/src/server/auth-form-state.ts +14 -0
- package/src/server/auth-mail.ts +104 -0
- package/src/server/avatars.ts +83 -0
- package/src/server/board-latest-actions.ts +7 -0
- package/src/server/board-latest.tsx +103 -0
- package/src/server/board-offline.ts +23 -0
- package/src/server/board-url.ts +14 -0
- package/src/server/brand-assets.ts +151 -0
- package/src/server/brand-mark.tsx +110 -0
- package/src/server/branding-actions.ts +53 -0
- package/src/server/branding.ts +101 -0
- package/src/server/cache-targets.ts +13 -0
- package/src/server/code-highlighting.ts +33 -0
- package/src/server/container.ts +402 -0
- package/src/server/content-actions.ts +459 -0
- package/src/server/content-admin-actions.ts +492 -0
- package/src/server/content-admin.ts +95 -0
- package/src/server/content-security-policy.ts +35 -0
- package/src/server/context.ts +32 -0
- package/src/server/cookies.ts +139 -0
- package/src/server/credential-proof-actions.ts +42 -0
- package/src/server/credential-proof.ts +35 -0
- package/src/server/current-location.ts +19 -0
- package/src/server/demo-stripe.ts +104 -0
- package/src/server/demo-uploads.ts +28 -0
- package/src/server/demo.ts +80 -0
- package/src/server/discovery.ts +104 -0
- package/src/server/embeds.ts +113 -0
- package/src/server/error-notice.tsx +41 -0
- package/src/server/federation-actions.ts +113 -0
- package/src/server/federation.ts +138 -0
- package/src/server/feed-builder.ts +72 -0
- package/src/server/feed-routes.ts +122 -0
- package/src/server/fixture-actor-source.ts +62 -0
- package/src/server/fixture-forum-repo.ts +59 -0
- package/src/server/fixture-member-profile-repo.ts +30 -0
- package/src/server/fixture-post-repo.ts +108 -0
- package/src/server/fixture-thread-repo.ts +98 -0
- package/src/server/form-state-reporter.ts +34 -0
- package/src/server/form-values.ts +23 -0
- package/src/server/forum-admin-actions.ts +353 -0
- package/src/server/forum-admin.ts +98 -0
- package/src/server/group-admin-actions.ts +341 -0
- package/src/server/group-admin.ts +98 -0
- package/src/server/group-badge-actions.ts +61 -0
- package/src/server/group-badge.ts +62 -0
- package/src/server/group-identity.ts +104 -0
- package/src/server/i18n-catalogs.ts +42 -0
- package/src/server/i18n.ts +69 -0
- package/src/server/image-upload.ts +109 -0
- package/src/server/inline-moderation-actions.ts +129 -0
- package/src/server/install-actions.ts +124 -0
- package/src/server/install.ts +281 -0
- package/src/server/legacy-redirect.ts +83 -0
- package/src/server/legal.ts +43 -0
- package/src/server/location-header.ts +37 -0
- package/src/server/mail-brand.ts +43 -0
- package/src/server/mail-health.ts +41 -0
- package/src/server/mail-send.ts +44 -0
- package/src/server/mail-test-actions.ts +67 -0
- package/src/server/mail-test.ts +56 -0
- package/src/server/markdown-pipeline.ts +31 -0
- package/src/server/marketplace-actions.ts +47 -0
- package/src/server/marketplace-admin.ts +260 -0
- package/src/server/mention-actions.ts +21 -0
- package/src/server/mention-search.ts +35 -0
- package/src/server/message-actions.ts +110 -0
- package/src/server/messages.ts +141 -0
- package/src/server/modcp.ts +125 -0
- package/src/server/moderation-actions.ts +165 -0
- package/src/server/navigation-admin-actions.ts +217 -0
- package/src/server/navigation.ts +112 -0
- package/src/server/nonce.ts +13 -0
- package/src/server/notification-actions.ts +84 -0
- package/src/server/notification-audience.ts +10 -0
- package/src/server/notification-menu-actions.ts +82 -0
- package/src/server/notification-menu.ts +96 -0
- package/src/server/notifications.ts +93 -0
- package/src/server/onboarding-actions.ts +27 -0
- package/src/server/onboarding.ts +89 -0
- package/src/server/page-metadata.ts +14 -0
- package/src/server/passkey-challenge.ts +42 -0
- package/src/server/plugin-admin-actions.ts +232 -0
- package/src/server/plugin-admin.ts +276 -0
- package/src/server/plugin-host.ts +143 -0
- package/src/server/plugin-pages.ts +192 -0
- package/src/server/plugin-panel.ts +49 -0
- package/src/server/plugin-routes.ts +298 -0
- package/src/server/plugin-view.tsx +58 -0
- package/src/server/poll-actions.ts +104 -0
- package/src/server/poll-scope.ts +52 -0
- package/src/server/post-notifications.ts +71 -0
- package/src/server/post-scope.ts +86 -0
- package/src/server/presence.ts +177 -0
- package/src/server/profile-fields.ts +112 -0
- package/src/server/push-actions.ts +113 -0
- package/src/server/push.ts +40 -0
- package/src/server/redirect-back.ts +15 -0
- package/src/server/registration.ts +7 -0
- package/src/server/relation-actions.ts +89 -0
- package/src/server/relations.ts +45 -0
- package/src/server/reply-core.ts +173 -0
- package/src/server/report-actions.ts +165 -0
- package/src/server/report-scope.ts +21 -0
- package/src/server/reputation-actions.ts +146 -0
- package/src/server/reputation-target.ts +49 -0
- package/src/server/reputation.ts +70 -0
- package/src/server/request-fingerprint.ts +65 -0
- package/src/server/safe-path.ts +16 -0
- package/src/server/same-origin.ts +45 -0
- package/src/server/search-page.ts +313 -0
- package/src/server/search.ts +45 -0
- package/src/server/secret-auth.ts +20 -0
- package/src/server/see-other.ts +11 -0
- package/src/server/seed-board.ts +417 -0
- package/src/server/session-actions.ts +78 -0
- package/src/server/session-cookies.ts +124 -0
- package/src/server/session-key.ts +17 -0
- package/src/server/settings.ts +47 -0
- package/src/server/signatures.ts +62 -0
- package/src/server/sso-handshake.ts +79 -0
- package/src/server/stats.ts +63 -0
- package/src/server/subscription-actions.ts +161 -0
- package/src/server/surgery-actions.ts +180 -0
- package/src/server/syndication.ts +77 -0
- package/src/server/system-admin-actions.ts +134 -0
- package/src/server/system-admin.ts +90 -0
- package/src/server/test-container.ts +114 -0
- package/src/server/theme-admin-actions.ts +242 -0
- package/src/server/theme-admin.ts +203 -0
- package/src/server/theme-runtime.ts +89 -0
- package/src/server/theme-style.ts +279 -0
- package/src/server/theme.ts +52 -0
- package/src/server/thread-core.ts +207 -0
- package/src/server/thread-rating-actions.ts +55 -0
- package/src/server/thread-tool-actions.ts +154 -0
- package/src/server/two-factor-actions.ts +178 -0
- package/src/server/two-factor.ts +86 -0
- package/src/server/upgrade-notice.ts +41 -0
- package/src/server/user-admin-actions.ts +572 -0
- package/src/server/user-admin.ts +165 -0
- package/src/server/usercp-actions.ts +263 -0
- package/src/server/usercp-mail.ts +120 -0
- package/src/server/viewer-preferences.ts +64 -0
- package/src/server/warning-actions.ts +122 -0
- package/src/styles/globals.css +969 -0
- package/src/theme/contract.fixture.ts +793 -0
- package/src/view/account-copy.ts +351 -0
- package/src/view/admin-content-copy.ts +66 -0
- package/src/view/admin-copy.ts +106 -0
- package/src/view/admin-forum-tree-copy.ts +40 -0
- package/src/view/admin-group-copy.ts +80 -0
- package/src/view/admin-log.ts +58 -0
- package/src/view/admin-nav.ts +164 -0
- package/src/view/admin-navigation-copy.ts +58 -0
- package/src/view/admin-panel-copy.ts +194 -0
- package/src/view/admin-settings.ts +173 -0
- package/src/view/admin-theme-copy.ts +229 -0
- package/src/view/admin-user-copy.ts +96 -0
- package/src/view/attachments.ts +51 -0
- package/src/view/auth-copy.ts +147 -0
- package/src/view/board-index.ts +167 -0
- package/src/view/board-latest.ts +101 -0
- package/src/view/breadcrumb.ts +50 -0
- package/src/view/contacts.ts +85 -0
- package/src/view/content-copy.ts +118 -0
- package/src/view/contrast.ts +286 -0
- package/src/view/copy.ts +101 -0
- package/src/view/count.ts +8 -0
- package/src/view/discovery-view.ts +74 -0
- package/src/view/editor-toolbar.ts +84 -0
- package/src/view/error-notice.ts +52 -0
- package/src/view/feed.ts +130 -0
- package/src/view/forum-cursor.ts +54 -0
- package/src/view/forum-display.ts +152 -0
- package/src/view/forum-jump.ts +60 -0
- package/src/view/forum-notice.ts +24 -0
- package/src/view/inline-moderation.ts +87 -0
- package/src/view/install-copy.ts +95 -0
- package/src/view/legal.ts +58 -0
- package/src/view/locale.ts +40 -0
- package/src/view/marketplace-panel.ts +51 -0
- package/src/view/member-identity.ts +23 -0
- package/src/view/member-profile.ts +65 -0
- package/src/view/messages.ts +222 -0
- package/src/view/metadata.ts +75 -0
- package/src/view/modcp-nav.ts +76 -0
- package/src/view/moderation-copy.ts +84 -0
- package/src/view/moderation-queue.ts +67 -0
- package/src/view/navigation-arrange.ts +188 -0
- package/src/view/navigation.ts +173 -0
- package/src/view/notification-menu.ts +202 -0
- package/src/view/notifications.ts +84 -0
- package/src/view/onboarding.ts +26 -0
- package/src/view/pager.ts +191 -0
- package/src/view/panel-nav.ts +203 -0
- package/src/view/plugin-panel.ts +42 -0
- package/src/view/post-form.ts +61 -0
- package/src/view/post-link.ts +29 -0
- package/src/view/presence.ts +99 -0
- package/src/view/promotion-rules.ts +52 -0
- package/src/view/redirect-notice.ts +21 -0
- package/src/view/reputation.ts +107 -0
- package/src/view/search-controls.ts +103 -0
- package/src/view/search-results.ts +291 -0
- package/src/view/security-activity.ts +73 -0
- package/src/view/setting-groups.ts +43 -0
- package/src/view/shell.ts +164 -0
- package/src/view/slug-id.ts +12 -0
- package/src/view/sso-hand-off.ts +44 -0
- package/src/view/sso-notices.ts +48 -0
- package/src/view/subscriptions.ts +76 -0
- package/src/view/theme-draft.ts +167 -0
- package/src/view/theme-preference.ts +30 -0
- package/src/view/theme-tokens.ts +333 -0
- package/src/view/thread-view.ts +280 -0
- package/src/view/time.ts +31 -0
- package/src/view/timezone.ts +35 -0
- package/src/view/two-factor.ts +6 -0
- package/src/view/usercp-nav.ts +103 -0
- package/src/view/usercp.ts +196 -0
- package/src/view/warnings.ts +128 -0
- package/src/view/word-filter.ts +5 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import { notFound, redirect } from 'next/navigation'
|
|
3
|
+
|
|
4
|
+
import { currentRequestId } from '@meith/core/logger'
|
|
5
|
+
import { acceptsThreads, canHoldThreads } from '@meith/forums'
|
|
6
|
+
import { requireSlot, slotCopy } from '@meith/theme-kit'
|
|
7
|
+
|
|
8
|
+
import { FollowForm } from '@/components/account/subscription-forms'
|
|
9
|
+
import { MultiQuoteButton } from '@/components/content/multiquote-button'
|
|
10
|
+
import { MultiQuoteSelection } from '@/components/content/multiquote-selection'
|
|
11
|
+
import { PollForm } from '@/components/content/poll'
|
|
12
|
+
import { QuoteInPlace } from '@/components/content/quote-in-place'
|
|
13
|
+
import { ReplyForm } from '@/components/content/reply-form'
|
|
14
|
+
import { ThanksButton } from '@/components/content/thanks-button'
|
|
15
|
+
import { ThreadRatingForm } from '@/components/content/thread-rating'
|
|
16
|
+
import { InlineModerationForm } from '@/components/moderation/inline-moderation-form'
|
|
17
|
+
import { ThreadSurgeryForm } from '@/components/moderation/thread-surgery-form'
|
|
18
|
+
import { ThreadToolsForm } from '@/components/moderation/thread-tools-form'
|
|
19
|
+
import { BoardNotice } from '@/components/shell/board-notice'
|
|
20
|
+
import { BOARD_MEASURE } from '@/components/shell/measure'
|
|
21
|
+
import { attachmentLimits, attachmentsForPosts, canAttach } from '@/server/attachments'
|
|
22
|
+
import { avatarsFor } from '@/server/avatars'
|
|
23
|
+
import { getContainer } from '@/server/container'
|
|
24
|
+
import { activeVocabulary, activeWordFilter } from '@/server/content-admin'
|
|
25
|
+
import { getActor } from '@/server/context'
|
|
26
|
+
import { identitiesFor } from '@/server/group-identity'
|
|
27
|
+
import { getTranslator } from '@/server/i18n'
|
|
28
|
+
import { moderatorTargetFor } from '@/server/modcp'
|
|
29
|
+
import { cspNonce } from '@/server/nonce'
|
|
30
|
+
import { pageMetadata } from '@/server/page-metadata'
|
|
31
|
+
import { filterView, pluginRegion, viewerRef } from '@/server/plugin-view'
|
|
32
|
+
import { resolvePollScope } from '@/server/poll-scope'
|
|
33
|
+
import { postbitProfileFields } from '@/server/profile-fields'
|
|
34
|
+
import { viewerIgnoredIds } from '@/server/relations'
|
|
35
|
+
import { reputationSettings, thanksForPosts } from '@/server/reputation'
|
|
36
|
+
import { getSettings } from '@/server/settings'
|
|
37
|
+
import { signaturesFor } from '@/server/signatures'
|
|
38
|
+
import { currentTheme } from '@/server/theme'
|
|
39
|
+
import { getViewerPreferences } from '@/server/viewer-preferences'
|
|
40
|
+
import { followFormCopy } from '@/view/account-copy'
|
|
41
|
+
import { attachmentsByPost } from '@/view/attachments'
|
|
42
|
+
import { buildBreadcrumb } from '@/view/breadcrumb'
|
|
43
|
+
import { replyFormCopy, threadRatingCopy } from '@/view/content-copy'
|
|
44
|
+
import {
|
|
45
|
+
anyInlineTool,
|
|
46
|
+
INLINE_FORM_ID,
|
|
47
|
+
inlineOutcomeNotice,
|
|
48
|
+
selectionFor,
|
|
49
|
+
} from '@/view/inline-moderation'
|
|
50
|
+
import { cardDescription, jsonLdScript, pageLinks, threadJsonLd } from '@/view/metadata'
|
|
51
|
+
import { moderationFormsCopy } from '@/view/moderation-copy'
|
|
52
|
+
import { buildOffsetPager, offsetOf } from '@/view/pager'
|
|
53
|
+
import { locatedHref } from '@/view/post-link'
|
|
54
|
+
import { leadingId } from '@/view/slug-id'
|
|
55
|
+
import { buildSubscriptionsView } from '@/view/subscriptions'
|
|
56
|
+
import { buildThreadView, revealedFrom, threadToolsHeading } from '@/view/thread-view'
|
|
57
|
+
|
|
58
|
+
export async function generateMetadata({
|
|
59
|
+
params,
|
|
60
|
+
searchParams,
|
|
61
|
+
}: {
|
|
62
|
+
params: Promise<{ slug: string }>
|
|
63
|
+
searchParams: Promise<{ page?: string }>
|
|
64
|
+
}): Promise<Metadata> {
|
|
65
|
+
const [{ slug }, query] = await Promise.all([params, searchParams])
|
|
66
|
+
const t = await getTranslator()
|
|
67
|
+
const id = leadingId(slug)
|
|
68
|
+
if (id === null) return { title: t.t('threadPage.defaultTitle') }
|
|
69
|
+
|
|
70
|
+
const actor = await getActor()
|
|
71
|
+
const { forums, threads, authorizer } = getContainer()
|
|
72
|
+
|
|
73
|
+
const located = await threads.locate(id)
|
|
74
|
+
if (located === null) return { title: t.t('threadPage.defaultTitle') }
|
|
75
|
+
|
|
76
|
+
const forum = await forums.findById(located.forumId)
|
|
77
|
+
if (!forum || !canHoldThreads(forum.type)) return { title: t.t('threadPage.defaultTitle') }
|
|
78
|
+
|
|
79
|
+
const matrix = await authorizer.forumMatrix(actor, forum.id)
|
|
80
|
+
const target = await authorizer.moderatorTargetIn(actor, forum.id, matrix)
|
|
81
|
+
if (
|
|
82
|
+
!authorizer.can(actor, 'thread.view', {
|
|
83
|
+
...target,
|
|
84
|
+
threadAuthorId: located.authorUserId,
|
|
85
|
+
})
|
|
86
|
+
) {
|
|
87
|
+
return { title: t.t('threadPage.defaultTitle') }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const thread = await threads.findById(
|
|
91
|
+
id,
|
|
92
|
+
authorizer.contentScope(actor, target),
|
|
93
|
+
authorizer.authorFilter(actor, target),
|
|
94
|
+
)
|
|
95
|
+
if (!thread) return { title: t.t('threadPage.defaultTitle') }
|
|
96
|
+
|
|
97
|
+
const page = Number(query.page ?? '1')
|
|
98
|
+
const links = pageLinks({
|
|
99
|
+
path: `/thread/${thread.id}-${thread.slug}`,
|
|
100
|
+
page: Number.isSafeInteger(page) && page > 0 ? page : 1,
|
|
101
|
+
hasNext: false,
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const meta = await pageMetadata('/thread/[slug]', {
|
|
105
|
+
title: thread.title,
|
|
106
|
+
description: t.t('threadPage.discussion', { forum: forum.title }),
|
|
107
|
+
canonical: links.canonical,
|
|
108
|
+
imageUrl: null,
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
title: meta.title,
|
|
113
|
+
...(meta.description === null ? {} : { description: meta.description }),
|
|
114
|
+
alternates: {
|
|
115
|
+
canonical: meta.canonical,
|
|
116
|
+
types: {
|
|
117
|
+
'application/rss+xml': `/thread/${thread.id}-${thread.slug}/feed.xml`,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
openGraph: {
|
|
121
|
+
type: 'article',
|
|
122
|
+
title: meta.title,
|
|
123
|
+
...(meta.description === null ? {} : { description: meta.description }),
|
|
124
|
+
url: meta.canonical,
|
|
125
|
+
siteName: forum.title,
|
|
126
|
+
...(meta.imageUrl === null ? {} : { images: [meta.imageUrl] }),
|
|
127
|
+
},
|
|
128
|
+
twitter: {
|
|
129
|
+
card: 'summary',
|
|
130
|
+
title: meta.title,
|
|
131
|
+
...(meta.description === null ? {} : { description: meta.description }),
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const TOOL_NOTICE_KEYS: Readonly<Record<string, string>> = {
|
|
137
|
+
copy: 'threadPage.notice.copied',
|
|
138
|
+
lock: 'threadPage.notice.locked',
|
|
139
|
+
merge: 'threadPage.notice.merged',
|
|
140
|
+
move: 'threadPage.notice.moved',
|
|
141
|
+
restore: 'threadPage.notice.restored',
|
|
142
|
+
split: 'threadPage.notice.split',
|
|
143
|
+
stick: 'threadPage.notice.pinned',
|
|
144
|
+
unlock: 'threadPage.notice.unlocked',
|
|
145
|
+
unstick: 'threadPage.notice.unpinned',
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function afterId(value: string | undefined): number | null | undefined {
|
|
149
|
+
if (value === undefined) return undefined
|
|
150
|
+
if (!/^[1-9]\d*$/.test(value)) return null
|
|
151
|
+
const id = Number(value)
|
|
152
|
+
return Number.isSafeInteger(id) ? id : null
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function requestedPostId(value: string | undefined): number | null {
|
|
156
|
+
if (value === undefined || !/^[1-9]\d*$/.test(value)) return null
|
|
157
|
+
const id = Number(value)
|
|
158
|
+
return Number.isSafeInteger(id) ? id : null
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export default async function ThreadPage({
|
|
162
|
+
params,
|
|
163
|
+
searchParams,
|
|
164
|
+
}: {
|
|
165
|
+
params: Promise<{ slug: string }>
|
|
166
|
+
searchParams: Promise<{
|
|
167
|
+
after?: string
|
|
168
|
+
page?: string
|
|
169
|
+
replied?: string
|
|
170
|
+
posted?: string
|
|
171
|
+
post?: string
|
|
172
|
+
removed?: string
|
|
173
|
+
unchanged?: string
|
|
174
|
+
tool?: string
|
|
175
|
+
did?: string
|
|
176
|
+
n?: string
|
|
177
|
+
refused?: string
|
|
178
|
+
gone?: string
|
|
179
|
+
skipped?: string
|
|
180
|
+
reveal?: string | string[]
|
|
181
|
+
}>
|
|
182
|
+
}) {
|
|
183
|
+
const [{ slug }, query] = await Promise.all([params, searchParams])
|
|
184
|
+
const id = leadingId(slug)
|
|
185
|
+
const after = afterId(query.after)
|
|
186
|
+
const page = query.page === undefined ? 1 : Number(query.page)
|
|
187
|
+
if (id === null || after === null || !Number.isSafeInteger(page) || page < 1) notFound()
|
|
188
|
+
|
|
189
|
+
const actor = await getActor()
|
|
190
|
+
const {
|
|
191
|
+
forums,
|
|
192
|
+
posts,
|
|
193
|
+
threads,
|
|
194
|
+
authorizer,
|
|
195
|
+
threadViews,
|
|
196
|
+
threadWrites,
|
|
197
|
+
postWrites,
|
|
198
|
+
threadTools,
|
|
199
|
+
threadSurgery,
|
|
200
|
+
inlineModeration,
|
|
201
|
+
polls,
|
|
202
|
+
drafts,
|
|
203
|
+
} = getContainer()
|
|
204
|
+
const located = await threads.locate(id)
|
|
205
|
+
if (located === null) notFound()
|
|
206
|
+
|
|
207
|
+
const forum = await forums.findById(located.forumId)
|
|
208
|
+
if (!forum || !canHoldThreads(forum.type)) notFound()
|
|
209
|
+
const matrix = await authorizer.forumMatrix(actor, forum.id)
|
|
210
|
+
|
|
211
|
+
const appointment = await moderatorTargetFor(actor, forum.id, matrix)
|
|
212
|
+
if (
|
|
213
|
+
!authorizer.can(actor, 'thread.view', {
|
|
214
|
+
...appointment,
|
|
215
|
+
threadAuthorId: located.authorUserId,
|
|
216
|
+
})
|
|
217
|
+
)
|
|
218
|
+
notFound()
|
|
219
|
+
|
|
220
|
+
const scope = authorizer.contentScope(actor, appointment)
|
|
221
|
+
const thread = await threads.findById(id, scope, authorizer.authorFilter(actor, appointment))
|
|
222
|
+
if (!thread) notFound()
|
|
223
|
+
|
|
224
|
+
const preferences = await getViewerPreferences()
|
|
225
|
+
|
|
226
|
+
const requested = requestedPostId(query.post)
|
|
227
|
+
if (requested !== null) {
|
|
228
|
+
const location = await posts.locate(thread.id, requested, {
|
|
229
|
+
scope,
|
|
230
|
+
pageSize: preferences.postsPerPage,
|
|
231
|
+
})
|
|
232
|
+
if (location !== null) {
|
|
233
|
+
redirect(locatedHref(`/thread/${thread.id}-${thread.slug}`, query, location))
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (threadViews && after === undefined) {
|
|
238
|
+
await threadViews.record(thread.id).catch(() => undefined)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const postPage = await posts.listThread(thread.id, {
|
|
242
|
+
...(after === undefined
|
|
243
|
+
? { offset: offsetOf(page, preferences.postsPerPage) }
|
|
244
|
+
: { afterId: after }),
|
|
245
|
+
limit: preferences.postsPerPage,
|
|
246
|
+
scope,
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
const pager = buildOffsetPager({
|
|
250
|
+
path: `/thread/${thread.id}-${thread.slug}`,
|
|
251
|
+
params: query,
|
|
252
|
+
page,
|
|
253
|
+
pageSize: preferences.postsPerPage,
|
|
254
|
+
total: thread.replyCount + 1,
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
const nextHref = pager.nextHref
|
|
258
|
+
const canReply =
|
|
259
|
+
threadWrites !== null &&
|
|
260
|
+
authorizer.can(actor, 'reply.post', { forumId: forum.id, forum: matrix }) &&
|
|
261
|
+
(!thread.isLocked ||
|
|
262
|
+
authorizer.can(actor, 'content.viewUnapproved', {
|
|
263
|
+
forumId: forum.id,
|
|
264
|
+
forum: matrix,
|
|
265
|
+
}))
|
|
266
|
+
|
|
267
|
+
const own = { ...appointment, ownerId: actor.userId }
|
|
268
|
+
const others = { ...appointment, ownerId: -1 }
|
|
269
|
+
const writable = postWrites !== null
|
|
270
|
+
const reputation = await reputationSettings()
|
|
271
|
+
const capabilities = {
|
|
272
|
+
viewerUserId: actor.userId,
|
|
273
|
+
editOwn: writable && authorizer.can(actor, 'post.editOwn', own),
|
|
274
|
+
editOthers: writable && authorizer.can(actor, 'post.editOthers', others),
|
|
275
|
+
softDelete: writable && authorizer.can(actor, 'post.softDelete', own),
|
|
276
|
+
restore: writable && authorizer.can(actor, 'post.restore', own),
|
|
277
|
+
editWindowMinutes: Number(matrix.editTimeLimitMinutes ?? 0),
|
|
278
|
+
bypassesWindow:
|
|
279
|
+
authorizer.can(actor, 'post.editOthers', others) ||
|
|
280
|
+
authorizer.can(actor, 'content.viewUnapproved', own),
|
|
281
|
+
canReport: postWrites !== null && authorizer.can(actor, 'content.report'),
|
|
282
|
+
canWarn: getContainer().warnings !== null && authorizer.can(actor, 'user.warn'),
|
|
283
|
+
canRate:
|
|
284
|
+
getContainer().reputation !== null &&
|
|
285
|
+
authorizer.can(actor, 'reputation.give') &&
|
|
286
|
+
reputation.enabled,
|
|
287
|
+
ratingNeedsForm: reputation.commentRequired || reputation.allowNegative,
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const thanksOffered =
|
|
291
|
+
capabilities.canRate === true && !reputation.commentRequired && actor.userId !== null
|
|
292
|
+
const thanks = thanksOffered
|
|
293
|
+
? await thanksForPosts(postPage.rows.map((row) => row.id))
|
|
294
|
+
: new Map()
|
|
295
|
+
|
|
296
|
+
const movableInto =
|
|
297
|
+
threadTools === null ? [] : await authorizer.moderatedForumIds(actor, 'canMoveThreads')
|
|
298
|
+
const toolTarget = { ...appointment, threadAuthorId: located.authorUserId }
|
|
299
|
+
const toolRights = {
|
|
300
|
+
lock: threadTools !== null && authorizer.can(actor, 'thread.lock', toolTarget),
|
|
301
|
+
stick: threadTools !== null && authorizer.can(actor, 'thread.stick', toolTarget),
|
|
302
|
+
move: threadTools !== null && authorizer.can(actor, 'thread.move', toolTarget),
|
|
303
|
+
delete: threadTools !== null && authorizer.can(actor, 'thread.delete', toolTarget),
|
|
304
|
+
}
|
|
305
|
+
const surgeryRights = {
|
|
306
|
+
merge: threadSurgery !== null && authorizer.can(actor, 'thread.merge', toolTarget),
|
|
307
|
+
split: threadSurgery !== null && authorizer.can(actor, 'thread.split', toolTarget),
|
|
308
|
+
}
|
|
309
|
+
const splitPoints = !surgeryRights.split
|
|
310
|
+
? []
|
|
311
|
+
: postPage.rows
|
|
312
|
+
.filter((row) => !row.isFirstPost && row.visibility === 'visible')
|
|
313
|
+
.map((row) => ({
|
|
314
|
+
id: row.id,
|
|
315
|
+
number: row.number,
|
|
316
|
+
author: row.authorUsername,
|
|
317
|
+
}))
|
|
318
|
+
const moveTargets = !toolRights.move
|
|
319
|
+
? []
|
|
320
|
+
: (await forums.listListing())
|
|
321
|
+
.filter((row) => acceptsThreads(row) && row.id !== forum.id && movableInto.includes(row.id))
|
|
322
|
+
.map((row) => ({ id: row.id, title: row.title }))
|
|
323
|
+
|
|
324
|
+
const inlineRights = {
|
|
325
|
+
approve: inlineModeration !== null && authorizer.can(actor, 'content.approve', toolTarget),
|
|
326
|
+
lock: false,
|
|
327
|
+
stick: false,
|
|
328
|
+
move: false,
|
|
329
|
+
delete: inlineModeration !== null && authorizer.can(actor, 'post.softDelete', toolTarget),
|
|
330
|
+
restore: inlineModeration !== null && authorizer.can(actor, 'post.restore', toolTarget),
|
|
331
|
+
}
|
|
332
|
+
const inlineOffered = anyInlineTool(inlineRights) || surgeryRights.split
|
|
333
|
+
|
|
334
|
+
const authorIds = [
|
|
335
|
+
...new Set(
|
|
336
|
+
postPage.rows.map((row) => row.authorUserId).filter((id): id is number => id !== null),
|
|
337
|
+
),
|
|
338
|
+
]
|
|
339
|
+
const authorFields = new Map(
|
|
340
|
+
await Promise.all(authorIds.map(async (id) => [id, await postbitProfileFields(id)] as const)),
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
const ignoredIds = await viewerIgnoredIds()
|
|
344
|
+
|
|
345
|
+
const signatures = await signaturesFor(authorIds)
|
|
346
|
+
|
|
347
|
+
const avatars = await avatarsFor(authorIds)
|
|
348
|
+
|
|
349
|
+
const identities = await identitiesFor(authorIds)
|
|
350
|
+
|
|
351
|
+
const attachments = attachmentsByPost(
|
|
352
|
+
await attachmentsForPosts(postPage.rows.map((row) => row.id)),
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
const wordFilter = await activeWordFilter()
|
|
356
|
+
|
|
357
|
+
const view = buildThreadView({
|
|
358
|
+
thread,
|
|
359
|
+
wordFilter,
|
|
360
|
+
vocabulary: await activeVocabulary(),
|
|
361
|
+
capabilities,
|
|
362
|
+
replyHref: canReply ? `/thread/${thread.id}-${thread.slug}/reply` : null,
|
|
363
|
+
forum,
|
|
364
|
+
page: postPage,
|
|
365
|
+
pageNumber: pager.page,
|
|
366
|
+
nextHref,
|
|
367
|
+
pagination: pager,
|
|
368
|
+
markReadAction:
|
|
369
|
+
actor.userId === null || postPage.rows.at(-1) === undefined
|
|
370
|
+
? null
|
|
371
|
+
: `/api/read/thread/${thread.id}?post=${postPage.rows.at(-1)!.id}`,
|
|
372
|
+
now: new Date(),
|
|
373
|
+
t: await getTranslator(),
|
|
374
|
+
authorFields,
|
|
375
|
+
signatures,
|
|
376
|
+
attachments,
|
|
377
|
+
avatars,
|
|
378
|
+
identities,
|
|
379
|
+
ignoredIds,
|
|
380
|
+
revealedPostIds: revealedFrom(query.reveal),
|
|
381
|
+
currentHref:
|
|
382
|
+
`/thread/${thread.id}-${thread.slug}` +
|
|
383
|
+
(after === undefined ? `?page=${page}` : `?after=${after}&page=${page}`),
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
const { subscriptions } = getContainer()
|
|
387
|
+
const followMode =
|
|
388
|
+
subscriptions === null || actor.userId === null
|
|
389
|
+
? null
|
|
390
|
+
: await subscriptions.modeFor(actor.userId, 'thread', thread.id)
|
|
391
|
+
const followOffered = subscriptions !== null && actor.userId !== null
|
|
392
|
+
const followModes = buildSubscriptionsView({
|
|
393
|
+
rows: [],
|
|
394
|
+
now: new Date(),
|
|
395
|
+
}).modes
|
|
396
|
+
|
|
397
|
+
const theme = await currentTheme()
|
|
398
|
+
const ThreadView = requireSlot(theme, 'ThreadView')
|
|
399
|
+
const Navigation = requireSlot(theme, 'Navigation')
|
|
400
|
+
const PostBit = requireSlot(theme, 'PostBit')
|
|
401
|
+
const PostActions = requireSlot(theme, 'PostActions')
|
|
402
|
+
const Pagination = requireSlot(theme, 'Pagination')
|
|
403
|
+
const QuickReply = requireSlot(theme, 'QuickReply')
|
|
404
|
+
const translator = await getTranslator()
|
|
405
|
+
const toolNotice = query.tool === undefined ? undefined : TOOL_NOTICE_KEYS[query.tool]
|
|
406
|
+
|
|
407
|
+
const notice =
|
|
408
|
+
query.replied === 'race'
|
|
409
|
+
? translator.t('threadPage.notice.race')
|
|
410
|
+
: query.posted === 'moderated'
|
|
411
|
+
? translator.t('threadPage.notice.moderated')
|
|
412
|
+
: query.tool !== undefined
|
|
413
|
+
? toolNotice === undefined
|
|
414
|
+
? null
|
|
415
|
+
: translator.t(toolNotice)
|
|
416
|
+
: query.removed === 'post'
|
|
417
|
+
? translator.t('threadPage.notice.deleted')
|
|
418
|
+
: query.unchanged === 'post'
|
|
419
|
+
? translator.t('threadPage.notice.unchanged')
|
|
420
|
+
: inlineOutcomeNotice(query)
|
|
421
|
+
|
|
422
|
+
const opening = postPage.rows.find((row) => row.isFirstPost) ?? null
|
|
423
|
+
const jsonLd =
|
|
424
|
+
opening === null
|
|
425
|
+
? null
|
|
426
|
+
: threadJsonLd({
|
|
427
|
+
title: thread.title,
|
|
428
|
+
url: `/thread/${thread.id}-${thread.slug}`,
|
|
429
|
+
author: thread.authorUsername,
|
|
430
|
+
published: opening.createdAt,
|
|
431
|
+
modified: thread.lastPostAt,
|
|
432
|
+
replyCount: thread.replyCount,
|
|
433
|
+
forumTitle: forum.title,
|
|
434
|
+
description: cardDescription(
|
|
435
|
+
opening.message,
|
|
436
|
+
translator.t('threadPage.discussion', { forum: forum.title }),
|
|
437
|
+
wordFilter,
|
|
438
|
+
),
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
const pluginContext = {
|
|
442
|
+
...viewerRef(actor),
|
|
443
|
+
threadId: thread.id,
|
|
444
|
+
forumId: forum.id,
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const postModels = await Promise.all(
|
|
448
|
+
view.posts.map(async (post) => {
|
|
449
|
+
const actions = await filterView(
|
|
450
|
+
'view.post-actions',
|
|
451
|
+
{ actions: post.actions, postId: post.id },
|
|
452
|
+
pluginContext,
|
|
453
|
+
)
|
|
454
|
+
const bodyHtml =
|
|
455
|
+
post.bodyHtml === ''
|
|
456
|
+
? post.bodyHtml
|
|
457
|
+
: await filterView('post.body.html', post.bodyHtml, {
|
|
458
|
+
...viewerRef(actor),
|
|
459
|
+
postId: post.id,
|
|
460
|
+
threadId: thread.id,
|
|
461
|
+
forumId: forum.id,
|
|
462
|
+
})
|
|
463
|
+
return filterView(
|
|
464
|
+
'view.post-bit',
|
|
465
|
+
{
|
|
466
|
+
post: { ...post, bodyHtml },
|
|
467
|
+
select: selectionFor(
|
|
468
|
+
'post',
|
|
469
|
+
post.id,
|
|
470
|
+
translator.t('threadPage.postNumber', { number: post.number }),
|
|
471
|
+
inlineOffered,
|
|
472
|
+
),
|
|
473
|
+
regions: {
|
|
474
|
+
actions: (
|
|
475
|
+
<PostActions {...actions} copy={slotCopy(theme, 'PostActions', translator)}>
|
|
476
|
+
{thanksOffered &&
|
|
477
|
+
post.author.userId !== null &&
|
|
478
|
+
post.author.userId !== actor.userId &&
|
|
479
|
+
post.ignored === null &&
|
|
480
|
+
post.visibility === 'visible' ? (
|
|
481
|
+
<ThanksButton
|
|
482
|
+
postId={post.id}
|
|
483
|
+
authorUserId={post.author.userId}
|
|
484
|
+
returnTo={`/thread/${thread.id}-${thread.slug}`}
|
|
485
|
+
thanked={thanks.get(post.id)?.thanked ?? false}
|
|
486
|
+
count={thanks.get(post.id)?.count ?? 0}
|
|
487
|
+
/>
|
|
488
|
+
) : null}
|
|
489
|
+
{post.actions.quoteHref === null ? null : <MultiQuoteButton postId={post.id} />}
|
|
490
|
+
</PostActions>
|
|
491
|
+
),
|
|
492
|
+
pluginBadges: await pluginRegion('postbit.badges', {
|
|
493
|
+
viewer: viewerRef(actor),
|
|
494
|
+
subjectId: post.id,
|
|
495
|
+
authorId: post.author.userId,
|
|
496
|
+
}),
|
|
497
|
+
pluginFooter: await pluginRegion('postbit.footer', {
|
|
498
|
+
viewer: viewerRef(actor),
|
|
499
|
+
subjectId: post.id,
|
|
500
|
+
authorId: post.author.userId,
|
|
501
|
+
}),
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
pluginContext,
|
|
505
|
+
)
|
|
506
|
+
}),
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
const pagination = await filterView('view.pagination', view.pagination, viewerRef(actor))
|
|
510
|
+
const poll = polls === null ? null : await polls.find(thread.id, actor.userId)
|
|
511
|
+
const canVotePoll =
|
|
512
|
+
polls !== null &&
|
|
513
|
+
actor.userId !== null &&
|
|
514
|
+
authorizer.can(actor, 'poll.vote', { forumId: forum.id, forum: matrix })
|
|
515
|
+
const pollScope = poll === null ? null : await resolvePollScope(actor, thread.id)
|
|
516
|
+
const ratingsEnabled = (await getSettings()).get('posting.thread_ratings_enabled')
|
|
517
|
+
const rating = polls === null ? null : await polls.findRating(thread.id, actor.userId)
|
|
518
|
+
const canRateThread =
|
|
519
|
+
ratingsEnabled &&
|
|
520
|
+
polls !== null &&
|
|
521
|
+
actor.userId !== null &&
|
|
522
|
+
authorizer.can(actor, 'thread.rate', { forumId: forum.id, forum: matrix })
|
|
523
|
+
const replyRules =
|
|
524
|
+
threadWrites === null || !canReply ? null : await threadWrites.postingRules(forum.id)
|
|
525
|
+
const replyTarget = {
|
|
526
|
+
forumId: forum.id,
|
|
527
|
+
forum: matrix,
|
|
528
|
+
allowsAttachments: replyRules?.allowAttachments === true,
|
|
529
|
+
}
|
|
530
|
+
const quickReplyForm = !canReply ? null : (
|
|
531
|
+
<>
|
|
532
|
+
<QuoteInPlace threadId={thread.id} />
|
|
533
|
+
<MultiQuoteSelection threadId={thread.id} />
|
|
534
|
+
<ReplyForm
|
|
535
|
+
copy={replyFormCopy(await getTranslator())}
|
|
536
|
+
threadId={thread.id}
|
|
537
|
+
seenLastPostId={thread.lastPost?.postId ?? null}
|
|
538
|
+
prefill=""
|
|
539
|
+
canSubscribe={authorizer.can(actor, 'forum.subscribe', replyTarget)}
|
|
540
|
+
attachmentLimits={canAttach(actor, replyTarget) ? attachmentLimits(replyTarget) : null}
|
|
541
|
+
draft={
|
|
542
|
+
actor.userId === null || drafts === null
|
|
543
|
+
? null
|
|
544
|
+
: await drafts.find(actor.userId, forum.id, thread.id)
|
|
545
|
+
}
|
|
546
|
+
collapsible
|
|
547
|
+
/>
|
|
548
|
+
</>
|
|
549
|
+
)
|
|
550
|
+
const quickReplyModel =
|
|
551
|
+
quickReplyForm === null
|
|
552
|
+
? null
|
|
553
|
+
: await filterView(
|
|
554
|
+
'view.quick-reply',
|
|
555
|
+
{
|
|
556
|
+
threadId: thread.id,
|
|
557
|
+
placeholder: translator.t('composer.reply.quick'),
|
|
558
|
+
submitLabel: translator.t('composer.reply.submit'),
|
|
559
|
+
fullReplyHref: `/thread/${thread.id}-${thread.slug}/reply`,
|
|
560
|
+
children: quickReplyForm,
|
|
561
|
+
},
|
|
562
|
+
{ ...viewerRef(actor), threadId: thread.id, forumId: forum.id },
|
|
563
|
+
)
|
|
564
|
+
const quickReply =
|
|
565
|
+
quickReplyModel === null ? null : (
|
|
566
|
+
<QuickReply {...quickReplyModel} copy={slotCopy(theme, 'QuickReply', translator)} />
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
const anyTool =
|
|
570
|
+
toolRights.lock ||
|
|
571
|
+
toolRights.stick ||
|
|
572
|
+
toolRights.move ||
|
|
573
|
+
toolRights.delete ||
|
|
574
|
+
surgeryRights.merge ||
|
|
575
|
+
surgeryRights.split
|
|
576
|
+
const tools =
|
|
577
|
+
!anyTool && poll === null ? undefined : (
|
|
578
|
+
<>
|
|
579
|
+
{anyTool && (
|
|
580
|
+
<ThreadToolsForm
|
|
581
|
+
copy={moderationFormsCopy(await getTranslator())}
|
|
582
|
+
threadId={thread.id}
|
|
583
|
+
isLocked={thread.isLocked}
|
|
584
|
+
isSticky={thread.isSticky}
|
|
585
|
+
rights={toolRights}
|
|
586
|
+
moveTargets={moveTargets}
|
|
587
|
+
heading={threadToolsHeading(appointment.isForumModerator, await getTranslator())}
|
|
588
|
+
>
|
|
589
|
+
<ThreadSurgeryForm
|
|
590
|
+
copy={moderationFormsCopy(await getTranslator())}
|
|
591
|
+
threadId={thread.id}
|
|
592
|
+
rights={surgeryRights}
|
|
593
|
+
splitPoints={splitPoints}
|
|
594
|
+
/>
|
|
595
|
+
</ThreadToolsForm>
|
|
596
|
+
)}
|
|
597
|
+
{poll !== null && (
|
|
598
|
+
<PollForm
|
|
599
|
+
poll={poll}
|
|
600
|
+
threadId={thread.id}
|
|
601
|
+
canVote={canVotePoll}
|
|
602
|
+
editHref={pollScope?.mayEdit === true ? `/thread/${thread.id}/poll` : null}
|
|
603
|
+
/>
|
|
604
|
+
)}
|
|
605
|
+
</>
|
|
606
|
+
)
|
|
607
|
+
|
|
608
|
+
const showRating = rating !== null && ratingsEnabled
|
|
609
|
+
const afterContent =
|
|
610
|
+
!showRating && !followOffered ? undefined : (
|
|
611
|
+
<>
|
|
612
|
+
{showRating && (
|
|
613
|
+
<ThreadRatingForm
|
|
614
|
+
threadId={thread.id}
|
|
615
|
+
rating={rating}
|
|
616
|
+
canRate={canRateThread}
|
|
617
|
+
copy={threadRatingCopy(rating, await getTranslator())}
|
|
618
|
+
/>
|
|
619
|
+
)}
|
|
620
|
+
{followOffered && (
|
|
621
|
+
<FollowForm
|
|
622
|
+
target="thread"
|
|
623
|
+
targetId={thread.id}
|
|
624
|
+
mode={followMode}
|
|
625
|
+
modes={followModes}
|
|
626
|
+
back={`/thread/${thread.id}-${thread.slug}`}
|
|
627
|
+
label={(await getTranslator()).t('accountForm.follow.thread')}
|
|
628
|
+
copy={followFormCopy(await getTranslator())}
|
|
629
|
+
/>
|
|
630
|
+
)}
|
|
631
|
+
</>
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
const threadViewModel = await filterView(
|
|
635
|
+
'view.thread-view',
|
|
636
|
+
{
|
|
637
|
+
...view.view,
|
|
638
|
+
regions: {
|
|
639
|
+
...(tools === undefined ? {} : { tools }),
|
|
640
|
+
posts: postModels.map((model) => (
|
|
641
|
+
<PostBit key={model.post.id} {...model} copy={slotCopy(theme, 'PostBit', translator)} />
|
|
642
|
+
)),
|
|
643
|
+
pagination: <Pagination {...pagination} copy={slotCopy(theme, 'Pagination', translator)} />,
|
|
644
|
+
...(afterContent === undefined ? {} : { afterContent }),
|
|
645
|
+
quickReply,
|
|
646
|
+
},
|
|
647
|
+
},
|
|
648
|
+
pluginContext,
|
|
649
|
+
)
|
|
650
|
+
|
|
651
|
+
const [allForums, visibleIds] = await Promise.all([
|
|
652
|
+
forums.listAll(),
|
|
653
|
+
authorizer.visibleForumIds(actor),
|
|
654
|
+
])
|
|
655
|
+
const trail = buildBreadcrumb({
|
|
656
|
+
forums: allForums,
|
|
657
|
+
forumId: forum.id,
|
|
658
|
+
visibleForumIds: new Set(visibleIds),
|
|
659
|
+
leaf: thread.title,
|
|
660
|
+
homeLabel: (await getSettings()).get('board.name'),
|
|
661
|
+
})
|
|
662
|
+
|
|
663
|
+
const navigation = await filterView(
|
|
664
|
+
'view.navigation',
|
|
665
|
+
{ items: trail },
|
|
666
|
+
{
|
|
667
|
+
...viewerRef(actor),
|
|
668
|
+
requestId: currentRequestId() ?? null,
|
|
669
|
+
},
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
return (
|
|
673
|
+
<>
|
|
674
|
+
<Navigation {...navigation} copy={slotCopy(theme, 'Navigation', translator)} />
|
|
675
|
+
<main id="board-content" tabIndex={-1} className="flex-1">
|
|
676
|
+
{jsonLd !== null && (
|
|
677
|
+
<script
|
|
678
|
+
type="application/ld+json"
|
|
679
|
+
nonce={await cspNonce()}
|
|
680
|
+
dangerouslySetInnerHTML={{ __html: jsonLdScript(jsonLd) }}
|
|
681
|
+
/>
|
|
682
|
+
)}
|
|
683
|
+
{notice !== null && (
|
|
684
|
+
<div className={`${BOARD_MEASURE} pt-6`}>
|
|
685
|
+
<BoardNotice
|
|
686
|
+
kind="info"
|
|
687
|
+
message={notice}
|
|
688
|
+
dismissHref={`/thread/${thread.id}-${thread.slug}`}
|
|
689
|
+
/>
|
|
690
|
+
</div>
|
|
691
|
+
)}
|
|
692
|
+
<ThreadView {...threadViewModel} copy={slotCopy(theme, 'ThreadView', translator)} />
|
|
693
|
+
{inlineOffered && (
|
|
694
|
+
<InlineModerationForm
|
|
695
|
+
copy={moderationFormsCopy(await getTranslator())}
|
|
696
|
+
formId={INLINE_FORM_ID}
|
|
697
|
+
scope="posts"
|
|
698
|
+
rights={inlineRights}
|
|
699
|
+
moveTargets={[]}
|
|
700
|
+
returnTo={`/thread/${thread.id}-${thread.slug}`}
|
|
701
|
+
splitFrom={surgeryRights.split ? thread.id : null}
|
|
702
|
+
/>
|
|
703
|
+
)}
|
|
704
|
+
</main>
|
|
705
|
+
</>
|
|
706
|
+
)
|
|
707
|
+
}
|