@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,229 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
|
|
3
|
+
import { copyFor, patternCopy, splitAround } from './copy'
|
|
4
|
+
import { untranslated } from './time'
|
|
5
|
+
|
|
6
|
+
function splitTwice(
|
|
7
|
+
t: Translator,
|
|
8
|
+
key: string,
|
|
9
|
+
first: string,
|
|
10
|
+
second: string,
|
|
11
|
+
): readonly [string, string, string] {
|
|
12
|
+
const rendered = t.t(key, { [first]: '\u0000', [second]: '\u0000' })
|
|
13
|
+
const [lead = '', mid = '', tail = ''] = rendered.split('\u0000')
|
|
14
|
+
return [lead, mid, tail]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function oklchPickerCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
18
|
+
return {
|
|
19
|
+
...copyFor(
|
|
20
|
+
[
|
|
21
|
+
'adminTheme.oklch.adjustColour',
|
|
22
|
+
'adminTheme.oklch.hideSliders',
|
|
23
|
+
'adminTheme.oklch.lightness',
|
|
24
|
+
'adminTheme.oklch.chroma',
|
|
25
|
+
'adminTheme.oklch.hue',
|
|
26
|
+
'adminTheme.oklch.gamut',
|
|
27
|
+
'adminTheme.oklch.clear',
|
|
28
|
+
],
|
|
29
|
+
t,
|
|
30
|
+
),
|
|
31
|
+
...patternCopy(['adminTheme.oklch.adjust', 'adminTheme.oklch.hideSlidersFor'], t),
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function themeStateCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
36
|
+
return {
|
|
37
|
+
...copyFor(
|
|
38
|
+
[
|
|
39
|
+
'adminTheme.state.makeDefault',
|
|
40
|
+
'adminTheme.state.turnOn',
|
|
41
|
+
'adminTheme.state.turnOff',
|
|
42
|
+
'adminTheme.state.customise',
|
|
43
|
+
],
|
|
44
|
+
t,
|
|
45
|
+
),
|
|
46
|
+
...patternCopy(
|
|
47
|
+
[
|
|
48
|
+
'adminTheme.state.makeDefaultFor',
|
|
49
|
+
'adminTheme.state.turnOnFor',
|
|
50
|
+
'adminTheme.state.turnOffFor',
|
|
51
|
+
'adminTheme.state.customiseFor',
|
|
52
|
+
],
|
|
53
|
+
t,
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function themeAdminCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
59
|
+
const [presetsBlurbLead, presetsBlurbTail] = splitAround(t, 'adminTheme.presets.blurb', 'name')
|
|
60
|
+
const [cssHintLead, cssHintMid, cssHintTail] = splitTwice(
|
|
61
|
+
t,
|
|
62
|
+
'adminTheme.css.hint',
|
|
63
|
+
'import',
|
|
64
|
+
'url',
|
|
65
|
+
)
|
|
66
|
+
const [cssHintScopedLead, cssHintScopedMid, cssHintScopedTail] = splitTwice(
|
|
67
|
+
t,
|
|
68
|
+
'adminTheme.css.hintScoped',
|
|
69
|
+
'root',
|
|
70
|
+
'body',
|
|
71
|
+
)
|
|
72
|
+
const [cssUnsavedLead, cssUnsavedTail] = splitAround(t, 'adminTheme.changes.cssUnsaved', 'name')
|
|
73
|
+
const [legibilityBlurbLead, legibilityBlurbMid, legibilityBlurbTail] = splitTwice(
|
|
74
|
+
t,
|
|
75
|
+
'adminTheme.legibility.blurb',
|
|
76
|
+
'colorMix',
|
|
77
|
+
'var',
|
|
78
|
+
)
|
|
79
|
+
const [clickNoteLead, clickNoteTail] = splitAround(t, 'adminTheme.preview.clickNote', 'strong')
|
|
80
|
+
const [lastPostAdminLead, lastPostAdminTail] = splitAround(
|
|
81
|
+
t,
|
|
82
|
+
'adminTheme.sample.lastPostAdmin',
|
|
83
|
+
'name',
|
|
84
|
+
)
|
|
85
|
+
const [lastPostModLead, lastPostModTail] = splitAround(t, 'adminTheme.sample.lastPostMod', 'name')
|
|
86
|
+
const [breadcrumbLead, breadcrumbTail] = splitAround(t, 'adminTheme.sample.breadcrumb', 'title')
|
|
87
|
+
const [ownPostLead, ownPostTail] = splitAround(t, 'adminTheme.sample.ownPost', 'link')
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
...oklchPickerCopy(t),
|
|
91
|
+
...copyFor(
|
|
92
|
+
[
|
|
93
|
+
'adminTheme.scheme.both',
|
|
94
|
+
'adminTheme.scheme.light',
|
|
95
|
+
'adminTheme.scheme.dark',
|
|
96
|
+
'adminTheme.token.unsaved',
|
|
97
|
+
'adminTheme.token.overridden',
|
|
98
|
+
'adminTheme.token.usingOwn',
|
|
99
|
+
'adminTheme.useThemesValue',
|
|
100
|
+
'adminTheme.close',
|
|
101
|
+
'adminTheme.editor.saved',
|
|
102
|
+
'adminTheme.presets.title',
|
|
103
|
+
'adminTheme.find.label',
|
|
104
|
+
'adminTheme.find.placeholder',
|
|
105
|
+
'adminTheme.find.nothingOverridden',
|
|
106
|
+
'adminTheme.css.label',
|
|
107
|
+
'adminTheme.css.hintDefault',
|
|
108
|
+
'adminTheme.save',
|
|
109
|
+
'adminTheme.previewWithoutSaving',
|
|
110
|
+
'adminTheme.nothingToSave',
|
|
111
|
+
'adminTheme.validated.title',
|
|
112
|
+
'adminTheme.validated.blurb',
|
|
113
|
+
'adminTheme.reset.done',
|
|
114
|
+
'adminTheme.reset.submit',
|
|
115
|
+
'adminTheme.import.done',
|
|
116
|
+
'adminTheme.import.label',
|
|
117
|
+
'adminTheme.import.hint',
|
|
118
|
+
'adminTheme.import.submit',
|
|
119
|
+
'adminTheme.changes.title',
|
|
120
|
+
'adminTheme.changes.discardAll',
|
|
121
|
+
'adminTheme.changes.live',
|
|
122
|
+
'adminTheme.changes.unsavedCleared',
|
|
123
|
+
'adminTheme.changes.nothingOverridden',
|
|
124
|
+
'adminTheme.changes.ofWhich',
|
|
125
|
+
'adminTheme.changes.stillPainting',
|
|
126
|
+
'adminTheme.changes.allSaved',
|
|
127
|
+
'adminTheme.changes.undoToTheme',
|
|
128
|
+
'adminTheme.changes.undoToSaved',
|
|
129
|
+
'adminTheme.legibility.title',
|
|
130
|
+
'adminTheme.legibility.notMeasurable',
|
|
131
|
+
'adminTheme.legibility.allPass',
|
|
132
|
+
'adminTheme.legibility.on',
|
|
133
|
+
'adminTheme.legibility.alreadyLike',
|
|
134
|
+
'adminTheme.palette.changed',
|
|
135
|
+
'adminTheme.palette.unsaved',
|
|
136
|
+
'adminTheme.preview.title',
|
|
137
|
+
'adminTheme.preview.blurb',
|
|
138
|
+
'adminTheme.preview.clickNoteStrong',
|
|
139
|
+
'adminTheme.preview.sceneGroup',
|
|
140
|
+
'adminTheme.preview.scene.forums.title',
|
|
141
|
+
'adminTheme.preview.scene.forums.blurb',
|
|
142
|
+
'adminTheme.preview.scene.thread.title',
|
|
143
|
+
'adminTheme.preview.scene.thread.blurb',
|
|
144
|
+
'adminTheme.preview.scene.controls.title',
|
|
145
|
+
'adminTheme.preview.scene.controls.blurb',
|
|
146
|
+
'adminTheme.sample.boardName',
|
|
147
|
+
'adminTheme.sample.signedInAs',
|
|
148
|
+
'adminTheme.sample.category',
|
|
149
|
+
'adminTheme.sample.announcements',
|
|
150
|
+
'adminTheme.sample.introductions',
|
|
151
|
+
'adminTheme.sample.archive',
|
|
152
|
+
'adminTheme.sample.closedToNewPosts',
|
|
153
|
+
'adminTheme.sample.pinnedThread',
|
|
154
|
+
'adminTheme.sample.lockedThread',
|
|
155
|
+
'adminTheme.sample.movedThread',
|
|
156
|
+
'adminTheme.sample.threadTitle',
|
|
157
|
+
'adminTheme.sample.pinned',
|
|
158
|
+
'adminTheme.sample.awaitingApproval',
|
|
159
|
+
'adminTheme.sample.supermodMeta',
|
|
160
|
+
'adminTheme.sample.permalinkNote',
|
|
161
|
+
'adminTheme.sample.adminMeta',
|
|
162
|
+
'adminTheme.sample.ordinaryLink',
|
|
163
|
+
'adminTheme.sample.bannedMeta',
|
|
164
|
+
'adminTheme.sample.heldPost',
|
|
165
|
+
'adminTheme.sample.postReply',
|
|
166
|
+
'adminTheme.sample.hovered',
|
|
167
|
+
'adminTheme.sample.previewButton',
|
|
168
|
+
'adminTheme.sample.delete',
|
|
169
|
+
'adminTheme.sample.threadTitleLabel',
|
|
170
|
+
'adminTheme.sample.fieldNote',
|
|
171
|
+
'adminTheme.sample.hoveredRow',
|
|
172
|
+
'adminTheme.sample.moderationQueue',
|
|
173
|
+
'adminTheme.sample.queueWaiting',
|
|
174
|
+
'adminTheme.sample.queueApproved',
|
|
175
|
+
'adminTheme.sample.queueRejected',
|
|
176
|
+
'adminTheme.sample.queueDeleted',
|
|
177
|
+
],
|
|
178
|
+
t,
|
|
179
|
+
),
|
|
180
|
+
...patternCopy(
|
|
181
|
+
[
|
|
182
|
+
'adminTheme.contrast.failIntro',
|
|
183
|
+
'adminTheme.contrast.okIntro',
|
|
184
|
+
'adminTheme.contrast.needs',
|
|
185
|
+
'adminTheme.token.describes',
|
|
186
|
+
'adminTheme.token.themesOwn',
|
|
187
|
+
'adminTheme.token.replaces',
|
|
188
|
+
'adminTheme.find.changedOnly',
|
|
189
|
+
'adminTheme.find.shownCount',
|
|
190
|
+
'adminTheme.group.changedCount',
|
|
191
|
+
'adminTheme.group.tokenCount',
|
|
192
|
+
'adminTheme.saveChanges',
|
|
193
|
+
'adminTheme.unsavedChanges',
|
|
194
|
+
'adminTheme.changes.valueCount',
|
|
195
|
+
'adminTheme.changes.overriddenAcross',
|
|
196
|
+
'adminTheme.changes.notSavedYet',
|
|
197
|
+
'adminTheme.legibility.ratioNeeds',
|
|
198
|
+
'adminTheme.legibility.passCount',
|
|
199
|
+
'adminTheme.legibility.unknownCount',
|
|
200
|
+
'adminTheme.legibility.everyPairIn',
|
|
201
|
+
'adminTheme.sample.threadCount',
|
|
202
|
+
],
|
|
203
|
+
t,
|
|
204
|
+
),
|
|
205
|
+
'adminTheme.presets.blurbLead': presetsBlurbLead,
|
|
206
|
+
'adminTheme.presets.blurbTail': presetsBlurbTail,
|
|
207
|
+
'adminTheme.css.hintLead': cssHintLead,
|
|
208
|
+
'adminTheme.css.hintMid': cssHintMid,
|
|
209
|
+
'adminTheme.css.hintTail': cssHintTail,
|
|
210
|
+
'adminTheme.css.hintScopedLead': cssHintScopedLead,
|
|
211
|
+
'adminTheme.css.hintScopedMid': cssHintScopedMid,
|
|
212
|
+
'adminTheme.css.hintScopedTail': cssHintScopedTail,
|
|
213
|
+
'adminTheme.changes.cssUnsavedLead': cssUnsavedLead,
|
|
214
|
+
'adminTheme.changes.cssUnsavedTail': cssUnsavedTail,
|
|
215
|
+
'adminTheme.legibility.blurbLead': legibilityBlurbLead,
|
|
216
|
+
'adminTheme.legibility.blurbMid': legibilityBlurbMid,
|
|
217
|
+
'adminTheme.legibility.blurbTail': legibilityBlurbTail,
|
|
218
|
+
'adminTheme.preview.clickNoteLead': clickNoteLead,
|
|
219
|
+
'adminTheme.preview.clickNoteTail': clickNoteTail,
|
|
220
|
+
'adminTheme.sample.lastPostAdminLead': lastPostAdminLead,
|
|
221
|
+
'adminTheme.sample.lastPostAdminTail': lastPostAdminTail,
|
|
222
|
+
'adminTheme.sample.lastPostModLead': lastPostModLead,
|
|
223
|
+
'adminTheme.sample.lastPostModTail': lastPostModTail,
|
|
224
|
+
'adminTheme.sample.breadcrumbLead': breadcrumbLead,
|
|
225
|
+
'adminTheme.sample.breadcrumbTail': breadcrumbTail,
|
|
226
|
+
'adminTheme.sample.ownPostLead': ownPostLead,
|
|
227
|
+
'adminTheme.sample.ownPostTail': ownPostTail,
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
|
|
3
|
+
import { adminSharedCopy } from './admin-copy'
|
|
4
|
+
import { copyFor, patternCopy } from './copy'
|
|
5
|
+
import { untranslated } from './time'
|
|
6
|
+
|
|
7
|
+
export function userAdminCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
8
|
+
return {
|
|
9
|
+
...adminSharedCopy(t),
|
|
10
|
+
...copyFor(
|
|
11
|
+
[
|
|
12
|
+
'adminUser.username',
|
|
13
|
+
'adminUser.email',
|
|
14
|
+
'adminUser.emailHint',
|
|
15
|
+
'adminUser.primaryGroup',
|
|
16
|
+
'adminUser.primaryGroupHint',
|
|
17
|
+
'adminUser.displayGroup',
|
|
18
|
+
'adminUser.sameAsPrimary',
|
|
19
|
+
'adminUser.displayGroupHint',
|
|
20
|
+
'adminUser.saveAccount',
|
|
21
|
+
'adminUser.accountState',
|
|
22
|
+
'adminUser.state.active',
|
|
23
|
+
'adminUser.state.awaitingActivation',
|
|
24
|
+
'adminUser.accountStateHint',
|
|
25
|
+
'adminUser.saveState',
|
|
26
|
+
'adminUser.banned',
|
|
27
|
+
'adminUser.banLength',
|
|
28
|
+
'adminUser.banLengthHint',
|
|
29
|
+
'adminUser.staffNote',
|
|
30
|
+
'adminUser.staffNoteHint',
|
|
31
|
+
'adminUser.publicReason',
|
|
32
|
+
'adminUser.publicReasonHint',
|
|
33
|
+
'adminUser.banMember',
|
|
34
|
+
'adminUser.secondFactor',
|
|
35
|
+
'adminUser.secondFactorHeld',
|
|
36
|
+
'adminUser.secondFactorNotHeld',
|
|
37
|
+
'adminUser.secondFactorCleared',
|
|
38
|
+
'adminUser.secondFactorNote',
|
|
39
|
+
'adminUser.clearSecondFactor',
|
|
40
|
+
'adminUser.banPasswordNote',
|
|
41
|
+
'adminUser.additionalGroupsSr',
|
|
42
|
+
'adminUser.saveGroups',
|
|
43
|
+
'adminUser.moveNextBatch',
|
|
44
|
+
'adminUser.lifted',
|
|
45
|
+
'adminUser.liftBan',
|
|
46
|
+
'adminUser.prunePasswordNote',
|
|
47
|
+
'adminUser.sendTo',
|
|
48
|
+
'adminUser.sendToHint',
|
|
49
|
+
'adminUser.subject',
|
|
50
|
+
'adminUser.message',
|
|
51
|
+
'adminUser.messageHint',
|
|
52
|
+
'adminUser.queueMessage',
|
|
53
|
+
'adminUser.mailPasswordNote',
|
|
54
|
+
'adminUser.queueNextBatch',
|
|
55
|
+
],
|
|
56
|
+
t,
|
|
57
|
+
),
|
|
58
|
+
...patternCopy(
|
|
59
|
+
[
|
|
60
|
+
'adminUser.primaryGroupRow',
|
|
61
|
+
'adminUser.merged',
|
|
62
|
+
'adminUser.mergeMore',
|
|
63
|
+
'adminUser.mergeInto',
|
|
64
|
+
'adminUser.mergeNote',
|
|
65
|
+
'adminUser.pruneFinished',
|
|
66
|
+
'adminUser.pruneMore',
|
|
67
|
+
'adminUser.mailQueuedAll',
|
|
68
|
+
'adminUser.mailQueuedMore',
|
|
69
|
+
],
|
|
70
|
+
t,
|
|
71
|
+
),
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function userPruneCopy(
|
|
76
|
+
total: number,
|
|
77
|
+
t: Translator = untranslated(),
|
|
78
|
+
): Readonly<Record<string, string>> {
|
|
79
|
+
return {
|
|
80
|
+
...userAdminCopy(t),
|
|
81
|
+
'adminUser.pruneClose':
|
|
82
|
+
total > 500
|
|
83
|
+
? t.t('adminUser.pruneCloseFirst500')
|
|
84
|
+
: t.t('adminUser.pruneCloseCount', { count: total }),
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function userMassMailCopy(
|
|
89
|
+
audience: number,
|
|
90
|
+
t: Translator = untranslated(),
|
|
91
|
+
): Readonly<Record<string, string>> {
|
|
92
|
+
return {
|
|
93
|
+
...userAdminCopy(t),
|
|
94
|
+
'adminUser.everyMember': t.t('adminUser.everyMember', { audience }),
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type AttachmentRecord, attachmentType } from '@meith/attachments/types'
|
|
2
|
+
import type { PostAttachmentModel } from '@meith/theme-kit'
|
|
3
|
+
|
|
4
|
+
export function formatBytes(bytes: number): string {
|
|
5
|
+
if (bytes >= 1024 * 1024) return `${Math.round((bytes / (1024 * 1024)) * 10) / 10} MB`
|
|
6
|
+
if (bytes >= 1024) return `${Math.round(bytes / 1024)} KB`
|
|
7
|
+
return `${bytes} bytes`
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function attachmentHref(id: number): string {
|
|
11
|
+
return `/attachment/${id}`
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function thumbnailHref(id: number): string {
|
|
15
|
+
return `/attachment/${id}/thumb`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function attachmentModel(record: AttachmentRecord): PostAttachmentModel | null {
|
|
19
|
+
if (record.status !== 'ready' || record.storageKey === null) return null
|
|
20
|
+
|
|
21
|
+
const type = attachmentType(record.contentType)
|
|
22
|
+
if (type === undefined) return null
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
id: record.id,
|
|
26
|
+
filename: record.filename,
|
|
27
|
+
size: formatBytes(record.sizeBytes),
|
|
28
|
+
isImage: type.inline,
|
|
29
|
+
href: attachmentHref(record.id),
|
|
30
|
+
thumbnailHref: type.inline && record.thumbnailKey !== null ? thumbnailHref(record.id) : null,
|
|
31
|
+
width: record.width,
|
|
32
|
+
height: record.height,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function attachmentsByPost(
|
|
37
|
+
records: readonly AttachmentRecord[],
|
|
38
|
+
): ReadonlyMap<number, readonly PostAttachmentModel[]> {
|
|
39
|
+
const byPost = new Map<number, PostAttachmentModel[]>()
|
|
40
|
+
|
|
41
|
+
for (const record of records) {
|
|
42
|
+
if (record.postId === null) continue
|
|
43
|
+
const model = attachmentModel(record)
|
|
44
|
+
if (model === null) continue
|
|
45
|
+
const list = byPost.get(record.postId)
|
|
46
|
+
if (list === undefined) byPost.set(record.postId, [model])
|
|
47
|
+
else list.push(model)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return byPost
|
|
51
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
|
|
3
|
+
import { copyFor, splitAround } from './copy'
|
|
4
|
+
import { untranslated } from './time'
|
|
5
|
+
|
|
6
|
+
export function loginFormCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
7
|
+
return copyFor(
|
|
8
|
+
[
|
|
9
|
+
'authForm.login.identifier',
|
|
10
|
+
'authForm.login.password',
|
|
11
|
+
'authForm.login.remember',
|
|
12
|
+
'authForm.login.submit',
|
|
13
|
+
],
|
|
14
|
+
t,
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface RegistrationLimits {
|
|
19
|
+
readonly minPasswordLength: number
|
|
20
|
+
readonly usernameMin: number
|
|
21
|
+
readonly usernameMax: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function registerFormCopy(
|
|
25
|
+
limits: RegistrationLimits,
|
|
26
|
+
t: Translator = untranslated(),
|
|
27
|
+
): Readonly<Record<string, string>> {
|
|
28
|
+
const [termsLead, termsTail] = splitAround(t, 'authForm.register.terms', 'policy')
|
|
29
|
+
return {
|
|
30
|
+
...copyFor(
|
|
31
|
+
[
|
|
32
|
+
'authForm.register.username',
|
|
33
|
+
'authForm.email',
|
|
34
|
+
'authForm.register.password',
|
|
35
|
+
'authForm.register.honeypot',
|
|
36
|
+
'authForm.register.challengeHint',
|
|
37
|
+
'authForm.register.submit',
|
|
38
|
+
],
|
|
39
|
+
t,
|
|
40
|
+
),
|
|
41
|
+
'authForm.register.usernameHint': t.t('authForm.register.usernameHint', {
|
|
42
|
+
min: limits.usernameMin,
|
|
43
|
+
max: limits.usernameMax,
|
|
44
|
+
}),
|
|
45
|
+
'authForm.passwordHint': t.t('authForm.passwordHint', { min: limits.minPasswordLength }),
|
|
46
|
+
'authForm.register.termsLead': termsLead,
|
|
47
|
+
'authForm.register.termsTail': termsTail,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function resetRequestFormCopy(
|
|
52
|
+
t: Translator = untranslated(),
|
|
53
|
+
): Readonly<Record<string, string>> {
|
|
54
|
+
return copyFor(['authForm.reset.continue', 'authForm.email', 'authForm.reset.submit'], t)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function resetConfirmFormCopy(
|
|
58
|
+
minLength: number,
|
|
59
|
+
t: Translator = untranslated(),
|
|
60
|
+
): Readonly<Record<string, string>> {
|
|
61
|
+
return {
|
|
62
|
+
...copyFor(
|
|
63
|
+
[
|
|
64
|
+
'authForm.resetConfirm.password',
|
|
65
|
+
'authForm.resetConfirm.confirm',
|
|
66
|
+
'authForm.resetConfirm.submit',
|
|
67
|
+
],
|
|
68
|
+
t,
|
|
69
|
+
),
|
|
70
|
+
'authForm.passwordHint': t.t('authForm.passwordHint', { min: minLength }),
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function resendVerificationFormCopy(
|
|
75
|
+
t: Translator = untranslated(),
|
|
76
|
+
): Readonly<Record<string, string>> {
|
|
77
|
+
return copyFor(['authForm.email', 'authForm.resend.submit'], t)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function secondFactorFormCopy(
|
|
81
|
+
t: Translator = untranslated(),
|
|
82
|
+
): Readonly<Record<string, string>> {
|
|
83
|
+
return copyFor(
|
|
84
|
+
[
|
|
85
|
+
'authForm.secondFactor.code',
|
|
86
|
+
'authForm.secondFactor.recoveryHint',
|
|
87
|
+
'authForm.secondFactor.recoveryHintExhausted',
|
|
88
|
+
'authForm.secondFactor.submit',
|
|
89
|
+
'authForm.secondFactor.cancel',
|
|
90
|
+
],
|
|
91
|
+
t,
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function passkeyCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
96
|
+
return copyFor(
|
|
97
|
+
[
|
|
98
|
+
'authForm.or',
|
|
99
|
+
'authForm.passkey.waiting',
|
|
100
|
+
'authForm.passkey.signIn',
|
|
101
|
+
'authForm.passkey.confirm',
|
|
102
|
+
'authForm.passkey.cancelled',
|
|
103
|
+
'authForm.passkey.failed',
|
|
104
|
+
'authForm.passkey.noneCreated',
|
|
105
|
+
'authForm.passkey.noneOffered',
|
|
106
|
+
],
|
|
107
|
+
t,
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function passkeyEnrolCopy(
|
|
112
|
+
limit: number,
|
|
113
|
+
t: Translator = untranslated(),
|
|
114
|
+
): Readonly<Record<string, string>> {
|
|
115
|
+
return {
|
|
116
|
+
...passkeyCopy(t),
|
|
117
|
+
...copyFor(
|
|
118
|
+
[
|
|
119
|
+
'accountForm.passkey.unsupported',
|
|
120
|
+
'accountForm.passkey.label',
|
|
121
|
+
'accountForm.passkey.placeholder',
|
|
122
|
+
'accountForm.passkey.submit',
|
|
123
|
+
],
|
|
124
|
+
t,
|
|
125
|
+
),
|
|
126
|
+
'accountForm.passkey.hint': t.t('accountForm.passkey.hint', { limit }),
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface SsoButtonModel {
|
|
131
|
+
readonly id: string
|
|
132
|
+
readonly cta: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function ssoButtonModels(
|
|
136
|
+
providers: ReadonlyArray<{ readonly id: string; readonly label: string }>,
|
|
137
|
+
t: Translator = untranslated(),
|
|
138
|
+
): readonly SsoButtonModel[] {
|
|
139
|
+
return providers.map((provider) => ({
|
|
140
|
+
id: provider.id,
|
|
141
|
+
cta: t.t('authForm.sso.continue', { provider: provider.label }),
|
|
142
|
+
}))
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function ssoButtonsCopy(t: Translator = untranslated()): Readonly<Record<string, string>> {
|
|
146
|
+
return copyFor(['authForm.sso.lede', 'authForm.or'], t)
|
|
147
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { buildTree, type ForumListingRow, type ForumNode, keepVisibleSubtrees } from '@meith/forums'
|
|
2
|
+
import type { Translator } from '@meith/i18n'
|
|
3
|
+
import type {
|
|
4
|
+
BoardIndexModel,
|
|
5
|
+
CategoryBlockModel,
|
|
6
|
+
ForumRowModel,
|
|
7
|
+
LastPostModel,
|
|
8
|
+
LinkModel,
|
|
9
|
+
} from '@meith/theme-kit'
|
|
10
|
+
|
|
11
|
+
import { count } from './count'
|
|
12
|
+
import { type MemberIdentity, nameClassOf } from './member-identity'
|
|
13
|
+
import { memberHref } from './member-profile'
|
|
14
|
+
import { postLink } from './post-link'
|
|
15
|
+
import { formatTime } from './time'
|
|
16
|
+
|
|
17
|
+
export interface BoardIndexInput {
|
|
18
|
+
readonly rows: readonly ForumListingRow[]
|
|
19
|
+
readonly visibleForumIds: ReadonlySet<number>
|
|
20
|
+
readonly ownThreadsOnlyForumIds?: ReadonlySet<number>
|
|
21
|
+
readonly unreadForumIds?: ReadonlySet<number>
|
|
22
|
+
readonly markAllReadAction?: string | null
|
|
23
|
+
readonly now: Date
|
|
24
|
+
readonly t?: Translator
|
|
25
|
+
readonly identities?: ReadonlyMap<number, MemberIdentity>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function forumHref(row: { id: number; slug: string }): string {
|
|
29
|
+
return `/${row.id}-${row.slug}`
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function hrefFor(row: ForumListingRow): string {
|
|
33
|
+
if (row.type === 'link' && row.linkUrl !== null) return row.linkUrl
|
|
34
|
+
return forumHref(row)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function threadHref(threadId: number, postId: number): string {
|
|
38
|
+
return postLink(`/thread/${threadId}`, postId)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function toLastPost(
|
|
42
|
+
row: ForumListingRow,
|
|
43
|
+
now: Date,
|
|
44
|
+
t: Translator | undefined,
|
|
45
|
+
identities: ReadonlyMap<number, MemberIdentity> | undefined,
|
|
46
|
+
): LastPostModel | null {
|
|
47
|
+
const last = row.lastPost
|
|
48
|
+
if (last === null) return null
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
threadTitle: last.threadTitle,
|
|
52
|
+
href: threadHref(last.threadId, last.postId),
|
|
53
|
+
author: {
|
|
54
|
+
userId: last.userId,
|
|
55
|
+
username: last.username,
|
|
56
|
+
profileHref: last.userId === null ? null : memberHref(last.userId),
|
|
57
|
+
nameClass: nameClassOf(identities, last.userId),
|
|
58
|
+
},
|
|
59
|
+
at: formatTime(last.at, now, t),
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function toForumRow(
|
|
64
|
+
node: ForumNode<ForumListingRow>,
|
|
65
|
+
now: Date,
|
|
66
|
+
t: Translator | undefined,
|
|
67
|
+
unreadForumIds: ReadonlySet<number> | undefined,
|
|
68
|
+
identities: ReadonlyMap<number, MemberIdentity> | undefined,
|
|
69
|
+
ownThreadsOnlyForumIds: ReadonlySet<number> | undefined,
|
|
70
|
+
): ForumRowModel {
|
|
71
|
+
const ownThreadsOnly = ownThreadsOnlyForumIds?.has(node.id) ?? false
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
id: node.id,
|
|
75
|
+
title: node.title,
|
|
76
|
+
description: node.description,
|
|
77
|
+
href: hrefFor(node),
|
|
78
|
+
type: node.type,
|
|
79
|
+
threadCount: count(ownThreadsOnly ? 0 : node.threadCount, t),
|
|
80
|
+
postCount: count(ownThreadsOnly ? 0 : node.postCount, t),
|
|
81
|
+
lastPost: ownThreadsOnly ? null : toLastPost(node, now, t, identities),
|
|
82
|
+
isUnread: !ownThreadsOnly && (unreadForumIds?.has(node.id) ?? false),
|
|
83
|
+
subforums: node.children.map(
|
|
84
|
+
(child): LinkModel => ({ label: child.title, href: hrefFor(child) }),
|
|
85
|
+
),
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface BoardIndexBlock {
|
|
90
|
+
readonly block: CategoryBlockModel
|
|
91
|
+
readonly forums: readonly ForumRowModel[]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface BoardIndexView {
|
|
95
|
+
readonly index: Omit<BoardIndexModel, 'regions'>
|
|
96
|
+
readonly blocks: readonly BoardIndexBlock[]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface SectionInput extends BoardIndexInput {
|
|
100
|
+
readonly categoryId: number
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function findNode(
|
|
104
|
+
nodes: readonly ForumNode<ForumListingRow>[],
|
|
105
|
+
id: number,
|
|
106
|
+
): ForumNode<ForumListingRow> | null {
|
|
107
|
+
for (const node of nodes) {
|
|
108
|
+
if (node.id === id) return node
|
|
109
|
+
const found = findNode(node.children, id)
|
|
110
|
+
if (found !== null) return found
|
|
111
|
+
}
|
|
112
|
+
return null
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function buildSectionView(input: SectionInput): BoardIndexBlock | null {
|
|
116
|
+
const tree = buildTree(
|
|
117
|
+
keepVisibleSubtrees(input.rows, (row) => input.visibleForumIds.has(row.id)),
|
|
118
|
+
)
|
|
119
|
+
const node = findNode(tree, input.categoryId)
|
|
120
|
+
if (node === null) return null
|
|
121
|
+
|
|
122
|
+
const row = (candidate: ForumNode<ForumListingRow>): ForumRowModel =>
|
|
123
|
+
toForumRow(
|
|
124
|
+
candidate,
|
|
125
|
+
input.now,
|
|
126
|
+
input.t,
|
|
127
|
+
input.unreadForumIds,
|
|
128
|
+
input.identities,
|
|
129
|
+
input.ownThreadsOnlyForumIds,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
return { block: { category: row(node) }, forums: node.children.map(row) }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function buildBoardIndexView(input: BoardIndexInput): BoardIndexView {
|
|
136
|
+
const tree = buildTree(
|
|
137
|
+
keepVisibleSubtrees(input.rows, (row) => input.visibleForumIds.has(row.id)),
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
index: {
|
|
142
|
+
markAllReadAction: input.markAllReadAction ?? null,
|
|
143
|
+
},
|
|
144
|
+
blocks: tree.map((node) => ({
|
|
145
|
+
block: {
|
|
146
|
+
category: toForumRow(
|
|
147
|
+
node,
|
|
148
|
+
input.now,
|
|
149
|
+
input.t,
|
|
150
|
+
input.unreadForumIds,
|
|
151
|
+
input.identities,
|
|
152
|
+
input.ownThreadsOnlyForumIds,
|
|
153
|
+
),
|
|
154
|
+
},
|
|
155
|
+
forums: node.children.map((child) =>
|
|
156
|
+
toForumRow(
|
|
157
|
+
child,
|
|
158
|
+
input.now,
|
|
159
|
+
input.t,
|
|
160
|
+
input.unreadForumIds,
|
|
161
|
+
input.identities,
|
|
162
|
+
input.ownThreadsOnlyForumIds,
|
|
163
|
+
),
|
|
164
|
+
),
|
|
165
|
+
})),
|
|
166
|
+
}
|
|
167
|
+
}
|