@commonpub/layer 0.1.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 +661 -0
- package/app.vue +7 -0
- package/components/AnnouncementBand.vue +117 -0
- package/components/AppToast.vue +108 -0
- package/components/AuthorCard.vue +119 -0
- package/components/AuthorRow.vue +81 -0
- package/components/CommentSection.vue +330 -0
- package/components/ContentCard.vue +340 -0
- package/components/ContentPicker.vue +240 -0
- package/components/ContentStarterForm.vue +214 -0
- package/components/ContentTypeBadge.vue +46 -0
- package/components/CountdownTimer.vue +68 -0
- package/components/CpubEditor.vue +87 -0
- package/components/DiscussionItem.vue +191 -0
- package/components/EditorPropertiesPanel.vue +393 -0
- package/components/EngagementBar.vue +131 -0
- package/components/FederatedContentCard.vue +291 -0
- package/components/FeedItem.vue +283 -0
- package/components/FilterChip.vue +21 -0
- package/components/HeatmapGrid.vue +92 -0
- package/components/ImageUpload.vue +219 -0
- package/components/MemberCard.vue +163 -0
- package/components/MessageThread.vue +120 -0
- package/components/NotificationItem.vue +103 -0
- package/components/ProgressTracker.vue +41 -0
- package/components/PublishErrorsModal.vue +116 -0
- package/components/RemoteActorCard.vue +206 -0
- package/components/RemoteUserSearch.vue +117 -0
- package/components/SearchFilters.vue +188 -0
- package/components/SearchSidebar.vue +181 -0
- package/components/SectionHeader.vue +17 -0
- package/components/ShareToHubModal.vue +189 -0
- package/components/SiteLogo.vue +21 -0
- package/components/SkillBar.vue +57 -0
- package/components/SortSelect.vue +30 -0
- package/components/StatBar.vue +14 -0
- package/components/TOCNav.vue +69 -0
- package/components/TimelineItem.vue +82 -0
- package/components/VideoCard.vue +106 -0
- package/components/blocks/BlockBuildStepView.vue +92 -0
- package/components/blocks/BlockCalloutView.vue +82 -0
- package/components/blocks/BlockCheckpointView.vue +50 -0
- package/components/blocks/BlockCodeView.vue +212 -0
- package/components/blocks/BlockContentRenderer.vue +143 -0
- package/components/blocks/BlockDividerView.vue +11 -0
- package/components/blocks/BlockDownloadsView.vue +126 -0
- package/components/blocks/BlockEmbedView.vue +61 -0
- package/components/blocks/BlockGalleryView.vue +57 -0
- package/components/blocks/BlockHeadingView.vue +29 -0
- package/components/blocks/BlockImageView.vue +34 -0
- package/components/blocks/BlockMarkdownView.vue +118 -0
- package/components/blocks/BlockMathView.vue +45 -0
- package/components/blocks/BlockPartsListView.vue +104 -0
- package/components/blocks/BlockQuizView.vue +239 -0
- package/components/blocks/BlockQuoteView.vue +41 -0
- package/components/blocks/BlockSectionHeaderView.vue +58 -0
- package/components/blocks/BlockSliderView.vue +236 -0
- package/components/blocks/BlockTextView.vue +41 -0
- package/components/blocks/BlockToolListView.vue +87 -0
- package/components/blocks/BlockVideoView.vue +89 -0
- package/components/editors/ArticleEditor.vue +545 -0
- package/components/editors/BlockCanvas.vue +487 -0
- package/components/editors/BlockInsertZone.vue +84 -0
- package/components/editors/BlockPicker.vue +285 -0
- package/components/editors/BlockWrapper.vue +192 -0
- package/components/editors/BlogEditor.vue +567 -0
- package/components/editors/EditorBlocks.vue +248 -0
- package/components/editors/EditorSection.vue +81 -0
- package/components/editors/EditorShell.vue +168 -0
- package/components/editors/EditorTagInput.vue +114 -0
- package/components/editors/EditorVisibility.vue +110 -0
- package/components/editors/ExplainerEditor.vue +503 -0
- package/components/editors/MarkdownImportDialog.vue +249 -0
- package/components/editors/ProjectEditor.vue +446 -0
- package/components/editors/blocks/BuildStepBlock.vue +102 -0
- package/components/editors/blocks/CalloutBlock.vue +122 -0
- package/components/editors/blocks/CheckpointBlock.vue +27 -0
- package/components/editors/blocks/CodeBlock.vue +177 -0
- package/components/editors/blocks/DividerBlock.vue +22 -0
- package/components/editors/blocks/DownloadsBlock.vue +41 -0
- package/components/editors/blocks/EmbedBlock.vue +20 -0
- package/components/editors/blocks/GalleryBlock.vue +236 -0
- package/components/editors/blocks/HeadingBlock.vue +96 -0
- package/components/editors/blocks/ImageBlock.vue +271 -0
- package/components/editors/blocks/MarkdownBlock.vue +258 -0
- package/components/editors/blocks/MathBlock.vue +37 -0
- package/components/editors/blocks/PartsListBlock.vue +358 -0
- package/components/editors/blocks/QuizBlock.vue +47 -0
- package/components/editors/blocks/QuoteBlock.vue +101 -0
- package/components/editors/blocks/SectionHeaderBlock.vue +130 -0
- package/components/editors/blocks/SliderBlock.vue +318 -0
- package/components/editors/blocks/TextBlock.vue +201 -0
- package/components/editors/blocks/ToolListBlock.vue +70 -0
- package/components/editors/blocks/VideoBlock.vue +22 -0
- package/components/hub/HubDiscussions.vue +47 -0
- package/components/hub/HubFeed.vue +199 -0
- package/components/hub/HubHero.vue +185 -0
- package/components/hub/HubLayout.vue +103 -0
- package/components/hub/HubMembers.vue +40 -0
- package/components/hub/HubProducts.vue +93 -0
- package/components/hub/HubProjects.vue +207 -0
- package/components/hub/HubSidebar.vue +12 -0
- package/components/hub/HubSidebarCard.vue +35 -0
- package/components/views/ArticleView.vue +771 -0
- package/components/views/BlogView.vue +667 -0
- package/components/views/ExplainerView.vue +688 -0
- package/components/views/ProjectView.vue +1500 -0
- package/composables/useApiError.ts +39 -0
- package/composables/useAuth.ts +87 -0
- package/composables/useBlockEditor.ts +187 -0
- package/composables/useContentSave.ts +253 -0
- package/composables/useContentTypes.ts +37 -0
- package/composables/useEngagement.ts +196 -0
- package/composables/useFeatures.ts +33 -0
- package/composables/useFederation.ts +72 -0
- package/composables/useJsonLd.ts +183 -0
- package/composables/useMarkdownImport.ts +77 -0
- package/composables/useMirrorContent.ts +105 -0
- package/composables/useNotifications.ts +73 -0
- package/composables/usePublishValidation.ts +65 -0
- package/composables/useSanitize.ts +34 -0
- package/composables/useSiteName.ts +4 -0
- package/composables/useTheme.ts +34 -0
- package/composables/useToast.ts +35 -0
- package/error.vue +129 -0
- package/layouts/admin.vue +213 -0
- package/layouts/auth.vue +63 -0
- package/layouts/default.vue +269 -0
- package/layouts/editor.vue +129 -0
- package/middleware/auth.ts +6 -0
- package/nuxt.config.ts +83 -0
- package/package.json +59 -0
- package/pages/[type]/[slug]/edit.vue +676 -0
- package/pages/[type]/[slug]/index.vue +313 -0
- package/pages/[type]/index.vue +118 -0
- package/pages/about.vue +100 -0
- package/pages/admin/audit.vue +66 -0
- package/pages/admin/content.vue +116 -0
- package/pages/admin/federation.vue +446 -0
- package/pages/admin/index.vue +62 -0
- package/pages/admin/reports.vue +88 -0
- package/pages/admin/settings.vue +167 -0
- package/pages/admin/users.vue +145 -0
- package/pages/auth/forgot-password.vue +103 -0
- package/pages/auth/login.vue +216 -0
- package/pages/auth/oauth/authorize.vue +178 -0
- package/pages/auth/register.vue +246 -0
- package/pages/auth/reset-password.vue +124 -0
- package/pages/auth/verify-email.vue +80 -0
- package/pages/cert/[code].vue +154 -0
- package/pages/contests/[slug]/edit.vue +153 -0
- package/pages/contests/[slug]/index.vue +556 -0
- package/pages/contests/[slug]/judge.vue +160 -0
- package/pages/contests/create.vue +192 -0
- package/pages/contests/index.vue +69 -0
- package/pages/create.vue +219 -0
- package/pages/dashboard.vue +521 -0
- package/pages/docs/[siteSlug]/[...pagePath].vue +704 -0
- package/pages/docs/[siteSlug]/edit.vue +480 -0
- package/pages/docs/[siteSlug]/index.vue +380 -0
- package/pages/docs/create.vue +60 -0
- package/pages/docs/index.vue +181 -0
- package/pages/explore.vue +422 -0
- package/pages/federated-hubs/[id]/index.vue +385 -0
- package/pages/federated-hubs/[id]/posts/[postId].vue +309 -0
- package/pages/federation/index.vue +157 -0
- package/pages/federation/search.vue +43 -0
- package/pages/federation/users/[handle].vue +221 -0
- package/pages/feed.vue +135 -0
- package/pages/hubs/[slug]/index.vue +513 -0
- package/pages/hubs/[slug]/members.vue +134 -0
- package/pages/hubs/[slug]/posts/[postId].vue +352 -0
- package/pages/hubs/[slug]/settings.vue +254 -0
- package/pages/hubs/create.vue +201 -0
- package/pages/hubs/index.vue +207 -0
- package/pages/index.vue +1005 -0
- package/pages/learn/[slug]/[lessonSlug]/edit.vue +413 -0
- package/pages/learn/[slug]/[lessonSlug]/index.vue +438 -0
- package/pages/learn/[slug]/edit.vue +414 -0
- package/pages/learn/[slug]/index.vue +341 -0
- package/pages/learn/create.vue +71 -0
- package/pages/learn/index.vue +360 -0
- package/pages/messages/[conversationId].vue +113 -0
- package/pages/messages/index.vue +303 -0
- package/pages/mirror/[id].vue +115 -0
- package/pages/notifications.vue +91 -0
- package/pages/products/[slug].vue +128 -0
- package/pages/products/index.vue +122 -0
- package/pages/search.vue +692 -0
- package/pages/settings/account.vue +170 -0
- package/pages/settings/appearance.vue +80 -0
- package/pages/settings/index.vue +81 -0
- package/pages/settings/notifications.vue +68 -0
- package/pages/settings/profile.vue +838 -0
- package/pages/tags/[slug].vue +111 -0
- package/pages/tags/index.vue +73 -0
- package/pages/u/[username]/followers.vue +86 -0
- package/pages/u/[username]/following.vue +94 -0
- package/pages/u/[username]/index.vue +837 -0
- package/pages/videos/[id].vue +212 -0
- package/pages/videos/index.vue +327 -0
- package/pages/videos/submit.vue +112 -0
- package/plugins/auth.ts +23 -0
- package/server/api/admin/audit.get.ts +17 -0
- package/server/api/admin/content/[id].delete.ts +15 -0
- package/server/api/admin/content/[id].patch.ts +37 -0
- package/server/api/admin/federation/activity.get.ts +31 -0
- package/server/api/admin/federation/clients.get.ts +9 -0
- package/server/api/admin/federation/clients.post.ts +16 -0
- package/server/api/admin/federation/hub-mirrors/index.get.ts +10 -0
- package/server/api/admin/federation/hub-mirrors/index.post.ts +42 -0
- package/server/api/admin/federation/mirrors/[id]/backfill.post.ts +39 -0
- package/server/api/admin/federation/mirrors/[id].delete.ts +11 -0
- package/server/api/admin/federation/mirrors/[id].get.ts +15 -0
- package/server/api/admin/federation/mirrors/[id].put.ts +22 -0
- package/server/api/admin/federation/mirrors/index.get.ts +9 -0
- package/server/api/admin/federation/mirrors/index.post.ts +30 -0
- package/server/api/admin/federation/pending.get.ts +22 -0
- package/server/api/admin/federation/refederate.post.ts +92 -0
- package/server/api/admin/federation/repair-types.post.ts +57 -0
- package/server/api/admin/federation/retry.post.ts +41 -0
- package/server/api/admin/federation/stats.get.ts +26 -0
- package/server/api/admin/reports/[id]/resolve.post.ts +12 -0
- package/server/api/admin/reports.get.ts +17 -0
- package/server/api/admin/settings.get.ts +22 -0
- package/server/api/admin/settings.put.ts +11 -0
- package/server/api/admin/stats.get.ts +9 -0
- package/server/api/admin/users/[id]/role.put.ts +12 -0
- package/server/api/admin/users/[id]/status.put.ts +12 -0
- package/server/api/admin/users/[id].delete.ts +10 -0
- package/server/api/admin/users.get.ts +18 -0
- package/server/api/auth/federated/callback.get.ts +67 -0
- package/server/api/auth/federated/login.post.ts +60 -0
- package/server/api/auth/oauth2/authorize.get.ts +30 -0
- package/server/api/auth/oauth2/authorize.post.ts +51 -0
- package/server/api/auth/oauth2/register.post.ts +41 -0
- package/server/api/auth/oauth2/token.post.ts +48 -0
- package/server/api/cert/[code].get.ts +13 -0
- package/server/api/content/[id]/build.post.ts +9 -0
- package/server/api/content/[id]/fork.post.ts +10 -0
- package/server/api/content/[id]/index.delete.ts +18 -0
- package/server/api/content/[id]/index.get.ts +15 -0
- package/server/api/content/[id]/index.put.ts +23 -0
- package/server/api/content/[id]/products/[productId].delete.ts +28 -0
- package/server/api/content/[id]/products-sync.post.ts +29 -0
- package/server/api/content/[id]/products.get.ts +9 -0
- package/server/api/content/[id]/products.post.ts +31 -0
- package/server/api/content/[id]/publish.post.ts +17 -0
- package/server/api/content/[id]/report.post.ts +17 -0
- package/server/api/content/[id]/versions.get.ts +9 -0
- package/server/api/content/[id]/view.post.ts +34 -0
- package/server/api/content/index.get.ts +23 -0
- package/server/api/content/index.post.ts +11 -0
- package/server/api/contests/[slug]/entries.get.ts +18 -0
- package/server/api/contests/[slug]/entries.post.ts +23 -0
- package/server/api/contests/[slug]/index.delete.ts +21 -0
- package/server/api/contests/[slug]/index.get.ts +11 -0
- package/server/api/contests/[slug]/index.put.ts +15 -0
- package/server/api/contests/[slug]/judge.post.ts +12 -0
- package/server/api/contests/[slug]/transition.post.ts +24 -0
- package/server/api/contests/index.get.ts +10 -0
- package/server/api/contests/index.post.ts +28 -0
- package/server/api/docs/[siteSlug]/index.delete.ts +14 -0
- package/server/api/docs/[siteSlug]/index.get.ts +17 -0
- package/server/api/docs/[siteSlug]/index.put.ts +20 -0
- package/server/api/docs/[siteSlug]/nav.get.ts +26 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].delete.ts +14 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].get.ts +31 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].put.ts +15 -0
- package/server/api/docs/[siteSlug]/pages/index.get.ts +34 -0
- package/server/api/docs/[siteSlug]/pages/index.post.ts +28 -0
- package/server/api/docs/[siteSlug]/pages/reorder.post.ts +26 -0
- package/server/api/docs/[siteSlug]/search.get.ts +20 -0
- package/server/api/docs/[siteSlug]/versions.post.ts +11 -0
- package/server/api/docs/index.get.ts +6 -0
- package/server/api/docs/index.post.ts +10 -0
- package/server/api/federated-hubs/[id]/posts/[postId].get.ts +16 -0
- package/server/api/federated-hubs/[id]/posts.get.ts +15 -0
- package/server/api/federated-hubs/[id].get.ts +16 -0
- package/server/api/federation/boost.post.ts +21 -0
- package/server/api/federation/content/[id].get.ts +15 -0
- package/server/api/federation/follow.post.ts +16 -0
- package/server/api/federation/health.get.ts +56 -0
- package/server/api/federation/hub-follow.post.ts +27 -0
- package/server/api/federation/hub-post-like.post.ts +115 -0
- package/server/api/federation/hub-post-likes.get.ts +24 -0
- package/server/api/federation/hub-post-reply.post.ts +42 -0
- package/server/api/federation/hub-post.post.ts +33 -0
- package/server/api/federation/like.post.ts +21 -0
- package/server/api/federation/remote-actor.get.ts +22 -0
- package/server/api/federation/reply.post.ts +22 -0
- package/server/api/federation/search.post.ts +17 -0
- package/server/api/federation/timeline.get.ts +22 -0
- package/server/api/federation/unfollow.post.ts +17 -0
- package/server/api/files/[id].delete.ts +35 -0
- package/server/api/files/mine.get.ts +31 -0
- package/server/api/files/upload-from-url.post.ts +68 -0
- package/server/api/files/upload.post.ts +105 -0
- package/server/api/health.get.ts +4 -0
- package/server/api/hubs/[slug]/bans/[userId].delete.ts +13 -0
- package/server/api/hubs/[slug]/bans.get.ts +20 -0
- package/server/api/hubs/[slug]/bans.post.ts +23 -0
- package/server/api/hubs/[slug]/feed.xml.get.ts +60 -0
- package/server/api/hubs/[slug]/gallery.get.ts +21 -0
- package/server/api/hubs/[slug]/index.delete.ts +18 -0
- package/server/api/hubs/[slug]/index.get.ts +14 -0
- package/server/api/hubs/[slug]/index.put.ts +22 -0
- package/server/api/hubs/[slug]/invites.get.ts +20 -0
- package/server/api/hubs/[slug]/invites.post.ts +27 -0
- package/server/api/hubs/[slug]/join.post.ts +17 -0
- package/server/api/hubs/[slug]/leave.post.ts +13 -0
- package/server/api/hubs/[slug]/members/[userId].delete.ts +13 -0
- package/server/api/hubs/[slug]/members/[userId].put.ts +16 -0
- package/server/api/hubs/[slug]/members.get.ts +20 -0
- package/server/api/hubs/[slug]/posts/[postId]/like.post.ts +21 -0
- package/server/api/hubs/[slug]/posts/[postId]/lock.post.ts +17 -0
- package/server/api/hubs/[slug]/posts/[postId]/pin.post.ts +17 -0
- package/server/api/hubs/[slug]/posts/[postId]/replies.get.ts +16 -0
- package/server/api/hubs/[slug]/posts/[postId]/replies.post.ts +21 -0
- package/server/api/hubs/[slug]/posts/[postId].delete.ts +23 -0
- package/server/api/hubs/[slug]/posts/[postId].get.ts +16 -0
- package/server/api/hubs/[slug]/posts/index.get.ts +16 -0
- package/server/api/hubs/[slug]/posts/index.post.ts +36 -0
- package/server/api/hubs/[slug]/products.get.ts +26 -0
- package/server/api/hubs/[slug]/products.post.ts +18 -0
- package/server/api/hubs/[slug]/share.post.ts +39 -0
- package/server/api/hubs/index.get.ts +15 -0
- package/server/api/hubs/index.post.ts +11 -0
- package/server/api/image-proxy.get.ts +91 -0
- package/server/api/learn/[slug]/[lessonSlug]/complete.post.ts +13 -0
- package/server/api/learn/[slug]/[lessonSlug]/index.get.ts +68 -0
- package/server/api/learn/[slug]/enroll.post.ts +12 -0
- package/server/api/learn/[slug]/index.delete.ts +12 -0
- package/server/api/learn/[slug]/index.get.ts +14 -0
- package/server/api/learn/[slug]/index.put.ts +19 -0
- package/server/api/learn/[slug]/lessons/[lessonId].delete.ts +14 -0
- package/server/api/learn/[slug]/lessons/[lessonId].put.ts +24 -0
- package/server/api/learn/[slug]/lessons.post.ts +10 -0
- package/server/api/learn/[slug]/modules/[moduleId].delete.ts +14 -0
- package/server/api/learn/[slug]/modules/[moduleId].put.ts +15 -0
- package/server/api/learn/[slug]/modules.post.ts +14 -0
- package/server/api/learn/[slug]/publish.post.ts +13 -0
- package/server/api/learn/[slug]/unenroll.post.ts +12 -0
- package/server/api/learn/certificates.get.ts +9 -0
- package/server/api/learn/enrollments.get.ts +9 -0
- package/server/api/learn/index.get.ts +17 -0
- package/server/api/learn/index.post.ts +11 -0
- package/server/api/me.get.ts +13 -0
- package/server/api/messages/[conversationId]/info.get.ts +43 -0
- package/server/api/messages/[conversationId]/stream.get.ts +73 -0
- package/server/api/messages/[conversationId].get.ts +13 -0
- package/server/api/messages/[conversationId].post.ts +12 -0
- package/server/api/messages/index.get.ts +39 -0
- package/server/api/messages/index.post.ts +58 -0
- package/server/api/notifications/[id].delete.ts +11 -0
- package/server/api/notifications/count.get.ts +10 -0
- package/server/api/notifications/index.get.ts +24 -0
- package/server/api/notifications/read.post.ts +15 -0
- package/server/api/notifications/stream.get.ts +59 -0
- package/server/api/openapi.get.ts +5 -0
- package/server/api/products/[id].delete.ts +15 -0
- package/server/api/products/[id].put.ts +18 -0
- package/server/api/products/[slug]/content.get.ts +21 -0
- package/server/api/products/[slug].get.ts +16 -0
- package/server/api/products/index.get.ts +28 -0
- package/server/api/profile.get.ts +15 -0
- package/server/api/profile.put.ts +24 -0
- package/server/api/resolve-identity.post.ts +34 -0
- package/server/api/search/index.get.ts +24 -0
- package/server/api/search/trending.get.ts +22 -0
- package/server/api/social/bookmark.get.ts +16 -0
- package/server/api/social/bookmark.post.ts +15 -0
- package/server/api/social/bookmarks.get.ts +16 -0
- package/server/api/social/comments/[id].delete.ts +13 -0
- package/server/api/social/comments.get.ts +18 -0
- package/server/api/social/comments.post.ts +11 -0
- package/server/api/social/like.get.ts +17 -0
- package/server/api/social/like.post.ts +35 -0
- package/server/api/stats.get.ts +8 -0
- package/server/api/user/hubs.get.ts +22 -0
- package/server/api/users/[username]/content.get.ts +21 -0
- package/server/api/users/[username]/feed.xml.get.ts +65 -0
- package/server/api/users/[username]/follow.delete.ts +15 -0
- package/server/api/users/[username]/follow.post.ts +15 -0
- package/server/api/users/[username]/followers.get.ts +22 -0
- package/server/api/users/[username]/following.get.ts +22 -0
- package/server/api/users/[username]/learning.get.ts +18 -0
- package/server/api/users/[username].get.ts +25 -0
- package/server/api/users/index.get.ts +78 -0
- package/server/api/videos/[id].get.ts +18 -0
- package/server/api/videos/categories/[id].delete.ts +15 -0
- package/server/api/videos/categories/[id].put.ts +17 -0
- package/server/api/videos/categories.get.ts +7 -0
- package/server/api/videos/categories.post.ts +11 -0
- package/server/api/videos/index.get.ts +20 -0
- package/server/api/videos/index.post.ts +11 -0
- package/server/middleware/auth.ts +180 -0
- package/server/middleware/features.ts +31 -0
- package/server/middleware/security.ts +54 -0
- package/server/plugins/auto-admin.ts +69 -0
- package/server/plugins/federation-delivery.ts +74 -0
- package/server/routes/.well-known/nodeinfo.ts +15 -0
- package/server/routes/.well-known/webfinger.ts +86 -0
- package/server/routes/actor/followers.ts +34 -0
- package/server/routes/actor/following.ts +34 -0
- package/server/routes/actor/outbox.ts +31 -0
- package/server/routes/actor.ts +30 -0
- package/server/routes/feed.xml.ts +59 -0
- package/server/routes/hubs/[slug]/followers.ts +39 -0
- package/server/routes/hubs/[slug]/inbox.ts +35 -0
- package/server/routes/hubs/[slug]/outbox.ts +43 -0
- package/server/routes/hubs/[slug]/posts/[postId].ts +63 -0
- package/server/routes/hubs/[slug].ts +29 -0
- package/server/routes/inbox.ts +34 -0
- package/server/routes/nodeinfo/2.1.ts +27 -0
- package/server/routes/robots.txt.ts +19 -0
- package/server/routes/sitemap.xml.ts +105 -0
- package/server/routes/users/[username]/followers.ts +33 -0
- package/server/routes/users/[username]/following.ts +33 -0
- package/server/routes/users/[username]/inbox.ts +34 -0
- package/server/routes/users/[username]/outbox.ts +35 -0
- package/server/routes/users/[username].ts +62 -0
- package/server/utils/auth.ts +36 -0
- package/server/utils/db.ts +34 -0
- package/server/utils/errors.ts +24 -0
- package/server/utils/inbox.ts +122 -0
- package/server/utils/validate.ts +82 -0
- package/theme/base.css +283 -0
- package/theme/components.css +322 -0
- package/theme/dark.css +87 -0
- package/theme/editor-panels.css +63 -0
- package/theme/forms.css +216 -0
- package/theme/generics.css +68 -0
- package/theme/layouts.css +415 -0
- package/theme/prose.css +342 -0
- package/types/hub.ts +61 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({ layout: 'admin', middleware: 'auth' });
|
|
3
|
+
useSeoMeta({ title: `Reports — Admin — ${useSiteName()}` });
|
|
4
|
+
|
|
5
|
+
const { data: reportsData, refresh } = await useFetch('/api/admin/reports');
|
|
6
|
+
const toast = useToast();
|
|
7
|
+
|
|
8
|
+
interface Report {
|
|
9
|
+
id: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
status: string;
|
|
13
|
+
reporterId: string;
|
|
14
|
+
targetType: string;
|
|
15
|
+
targetId: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const reports = computed<Report[]>(() => {
|
|
20
|
+
if (!reportsData.value) return [];
|
|
21
|
+
if (Array.isArray(reportsData.value)) return reportsData.value as unknown as Report[];
|
|
22
|
+
const data = reportsData.value as unknown as { items?: Report[] };
|
|
23
|
+
return data.items ?? [];
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
async function resolveReport(id: string, resolution: 'resolved' | 'dismissed'): Promise<void> {
|
|
27
|
+
try {
|
|
28
|
+
await $fetch(`/api/admin/reports/${id}/resolve` as string, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
body: { resolution },
|
|
31
|
+
});
|
|
32
|
+
toast.success(`Report ${resolution}`);
|
|
33
|
+
await refresh();
|
|
34
|
+
} catch {
|
|
35
|
+
toast.error('Failed to update report');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div class="admin-reports">
|
|
42
|
+
<h1 class="admin-page-title">Reports</h1>
|
|
43
|
+
|
|
44
|
+
<template v-if="reports.length">
|
|
45
|
+
<div class="report-card" v-for="report in reports" :key="report.id">
|
|
46
|
+
<div class="report-header">
|
|
47
|
+
<span class="report-status" :class="`status-${report.status}`">{{ report.status }}</span>
|
|
48
|
+
<span class="report-type">{{ report.targetType }}</span>
|
|
49
|
+
<time class="report-date">{{ new Date(report.createdAt).toLocaleDateString() }}</time>
|
|
50
|
+
</div>
|
|
51
|
+
<p class="report-reason"><strong>{{ report.reason }}</strong></p>
|
|
52
|
+
<p v-if="report.description" class="report-desc">{{ report.description }}</p>
|
|
53
|
+
<div class="report-meta">
|
|
54
|
+
<span class="report-meta-item">Reporter: <code>{{ report.reporterId }}</code></span>
|
|
55
|
+
<span class="report-meta-item">Target: <code>{{ report.targetId }}</code></span>
|
|
56
|
+
</div>
|
|
57
|
+
<div v-if="report.status === 'pending'" class="report-actions">
|
|
58
|
+
<button class="cpub-btn cpub-btn-sm" style="color: var(--green); border-color: var(--green-border);" @click="resolveReport(report.id, 'resolved')">
|
|
59
|
+
<i class="fa-solid fa-check"></i> Resolve
|
|
60
|
+
</button>
|
|
61
|
+
<button class="cpub-btn cpub-btn-sm" @click="resolveReport(report.id, 'dismissed')">
|
|
62
|
+
<i class="fa-solid fa-xmark"></i> Dismiss
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
<p class="admin-empty" v-else>No reports to review.</p>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<style scoped>
|
|
72
|
+
.admin-page-title { font-size: var(--text-xl); font-weight: var(--font-weight-bold); margin-bottom: var(--space-6); }
|
|
73
|
+
.report-card { padding: 16px; border: var(--border-width-default) solid var(--border); background: var(--surface); margin-bottom: 12px; box-shadow: var(--shadow-md); }
|
|
74
|
+
.report-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
|
75
|
+
.report-status { font-size: 10px; font-family: var(--font-mono); font-weight: 600; text-transform: uppercase; padding: 2px 8px; }
|
|
76
|
+
.status-pending { background: var(--yellow-bg); color: var(--yellow); border: var(--border-width-default) solid var(--yellow-border); }
|
|
77
|
+
.status-resolved { background: var(--green-bg); color: var(--green); border: var(--border-width-default) solid var(--green-border); }
|
|
78
|
+
.status-dismissed { background: var(--surface2); color: var(--text-faint); border: var(--border-width-default) solid var(--border2); }
|
|
79
|
+
.report-type { font-size: 10px; font-family: var(--font-mono); color: var(--accent); background: var(--accent-bg); padding: 2px 6px; border: var(--border-width-default) solid var(--accent-border); }
|
|
80
|
+
.report-date { font-size: 11px; color: var(--text-faint); margin-left: auto; font-family: var(--font-mono); }
|
|
81
|
+
.report-reason { font-size: 13px; margin-bottom: 4px; }
|
|
82
|
+
.report-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin-bottom: 8px; }
|
|
83
|
+
.report-meta { display: flex; gap: 16px; margin-bottom: 10px; }
|
|
84
|
+
.report-meta-item { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); }
|
|
85
|
+
.report-meta-item code { background: var(--surface2); padding: 1px 4px; }
|
|
86
|
+
.report-actions { display: flex; gap: 6px; padding-top: 8px; border-top: var(--border-width-default) solid var(--border2); }
|
|
87
|
+
.admin-empty { color: var(--text-faint); text-align: center; padding: var(--space-8) 0; }
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({ layout: 'admin', middleware: 'auth' });
|
|
3
|
+
|
|
4
|
+
useSeoMeta({ title: `Settings — Admin — ${useSiteName()}` });
|
|
5
|
+
|
|
6
|
+
const { data: settings, refresh } = await useFetch<Record<string, string>>('/api/admin/settings');
|
|
7
|
+
|
|
8
|
+
const saving = ref(false);
|
|
9
|
+
const editKey = ref('');
|
|
10
|
+
const editValue = ref('');
|
|
11
|
+
const newKey = ref('');
|
|
12
|
+
const newValue = ref('');
|
|
13
|
+
|
|
14
|
+
const knownSettings = [
|
|
15
|
+
{ key: 'instance.name', label: 'Instance Name', desc: 'Public name of this CommonPub instance' },
|
|
16
|
+
{ key: 'instance.description', label: 'Instance Description', desc: 'Short description shown in metadata' },
|
|
17
|
+
{ key: 'instance.registrationOpen', label: 'Open Registration', desc: 'Allow new user signups (true/false)' },
|
|
18
|
+
{ key: 'instance.maxUploadSize', label: 'Max Upload Size (MB)', desc: 'Maximum file upload size in megabytes' },
|
|
19
|
+
{ key: 'instance.contactEmail', label: 'Contact Email', desc: 'Admin contact email for the instance' },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function startEdit(key: string, value: string): void {
|
|
23
|
+
editKey.value = key;
|
|
24
|
+
editValue.value = value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function cancelEdit(): void {
|
|
28
|
+
editKey.value = '';
|
|
29
|
+
editValue.value = '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function saveSetting(key: string, value: string): Promise<void> {
|
|
33
|
+
saving.value = true;
|
|
34
|
+
try {
|
|
35
|
+
await $fetch('/api/admin/settings', {
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
body: { key, value },
|
|
38
|
+
});
|
|
39
|
+
editKey.value = '';
|
|
40
|
+
editValue.value = '';
|
|
41
|
+
await refresh();
|
|
42
|
+
} catch {
|
|
43
|
+
// Error handling via toast if available
|
|
44
|
+
} finally {
|
|
45
|
+
saving.value = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function addSetting(): Promise<void> {
|
|
50
|
+
if (!newKey.value.trim()) return;
|
|
51
|
+
await saveSetting(newKey.value.trim(), newValue.value);
|
|
52
|
+
newKey.value = '';
|
|
53
|
+
newValue.value = '';
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<div class="admin-settings">
|
|
59
|
+
<h1 class="admin-page-title">Instance Settings</h1>
|
|
60
|
+
|
|
61
|
+
<div class="settings-list" v-if="settings">
|
|
62
|
+
<div v-for="item in knownSettings" :key="item.key" class="settings-row">
|
|
63
|
+
<div class="settings-label">
|
|
64
|
+
<span class="settings-key">{{ item.label }}</span>
|
|
65
|
+
<span class="settings-desc">{{ item.desc }}</span>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="settings-value-col">
|
|
68
|
+
<template v-if="editKey === item.key">
|
|
69
|
+
<input v-model="editValue" class="settings-input" @keyup.enter="saveSetting(item.key, editValue)" @keyup.escape="cancelEdit" />
|
|
70
|
+
<button class="cpub-btn cpub-btn-sm cpub-btn-primary" :disabled="saving" @click="saveSetting(item.key, editValue)">Save</button>
|
|
71
|
+
<button class="cpub-btn cpub-btn-sm" @click="cancelEdit">Cancel</button>
|
|
72
|
+
</template>
|
|
73
|
+
<template v-else>
|
|
74
|
+
<span class="settings-value">{{ (settings as Record<string, string>)[item.key] ?? '—' }}</span>
|
|
75
|
+
<button class="cpub-btn cpub-btn-sm" @click="startEdit(item.key, (settings as Record<string, string>)[item.key] ?? '')">Edit</button>
|
|
76
|
+
</template>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="settings-custom" v-if="settings">
|
|
82
|
+
<h2 class="settings-section-title">Custom Settings</h2>
|
|
83
|
+
<div v-for="(value, key) in (settings as Record<string, string>)" :key="key" class="settings-row">
|
|
84
|
+
<template v-if="!knownSettings.some(k => k.key === key)">
|
|
85
|
+
<div class="settings-label">
|
|
86
|
+
<span class="settings-key-mono">{{ key }}</span>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="settings-value-col">
|
|
89
|
+
<template v-if="editKey === key">
|
|
90
|
+
<input v-model="editValue" class="settings-input" @keyup.enter="saveSetting(key as string, editValue)" @keyup.escape="cancelEdit" />
|
|
91
|
+
<button class="cpub-btn cpub-btn-sm cpub-btn-primary" :disabled="saving" @click="saveSetting(key as string, editValue)">Save</button>
|
|
92
|
+
<button class="cpub-btn cpub-btn-sm" @click="cancelEdit">Cancel</button>
|
|
93
|
+
</template>
|
|
94
|
+
<template v-else>
|
|
95
|
+
<span class="settings-value">{{ value }}</span>
|
|
96
|
+
<button class="cpub-btn cpub-btn-sm" @click="startEdit(key as string, value)">Edit</button>
|
|
97
|
+
</template>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div class="settings-add">
|
|
103
|
+
<input v-model="newKey" class="settings-input" placeholder="Setting key" />
|
|
104
|
+
<input v-model="newValue" class="settings-input" placeholder="Value" />
|
|
105
|
+
<button class="cpub-btn cpub-btn-sm" :disabled="!newKey.trim()" @click="addSetting">Add</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<p class="admin-empty" v-if="!settings">No settings configured.</p>
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<style scoped>
|
|
114
|
+
.admin-page-title {
|
|
115
|
+
font-size: var(--text-xl);
|
|
116
|
+
font-weight: var(--font-weight-bold);
|
|
117
|
+
margin-bottom: var(--space-6);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.settings-list {
|
|
121
|
+
border: var(--border-width-default) solid var(--border);
|
|
122
|
+
background: var(--surface);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.settings-row {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
padding: var(--space-3) var(--space-4);
|
|
130
|
+
border-bottom: var(--border-width-default) solid var(--border);
|
|
131
|
+
gap: var(--space-4);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.settings-row:last-child { border-bottom: none; }
|
|
135
|
+
|
|
136
|
+
.settings-label { display: flex; flex-direction: column; gap: 2px; }
|
|
137
|
+
.settings-key { font-size: var(--text-sm); font-weight: var(--font-weight-semibold); }
|
|
138
|
+
.settings-key-mono { font-size: var(--text-sm); font-family: var(--font-mono); }
|
|
139
|
+
.settings-desc { font-size: var(--text-xs); color: var(--text-faint); }
|
|
140
|
+
|
|
141
|
+
.settings-value-col { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
|
|
142
|
+
.settings-value { font-size: var(--text-sm); font-family: var(--font-mono); color: var(--text-dim); }
|
|
143
|
+
.settings-input { font-size: var(--text-sm); padding: 4px 8px; border: var(--border-width-default) solid var(--border); background: var(--surface2); color: var(--text); font-family: var(--font-mono); min-width: 160px; }
|
|
144
|
+
|
|
145
|
+
.settings-custom { margin-top: var(--space-6); }
|
|
146
|
+
.settings-section-title { font-size: var(--text-md); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-3); }
|
|
147
|
+
|
|
148
|
+
.settings-add {
|
|
149
|
+
display: flex;
|
|
150
|
+
gap: var(--space-2);
|
|
151
|
+
margin-top: var(--space-3);
|
|
152
|
+
padding: var(--space-3) var(--space-4);
|
|
153
|
+
border: 2px dashed var(--border);
|
|
154
|
+
background: var(--surface);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.admin-empty {
|
|
158
|
+
color: var(--text-faint);
|
|
159
|
+
text-align: center;
|
|
160
|
+
padding: var(--space-8) 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@media (max-width: 768px) {
|
|
164
|
+
.settings-row { flex-direction: column; align-items: flex-start; gap: var(--space-1); }
|
|
165
|
+
.settings-add { flex-direction: column; }
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({ layout: 'admin', middleware: 'auth' });
|
|
3
|
+
useSeoMeta({ title: `Users — Admin — ${useSiteName()}` });
|
|
4
|
+
|
|
5
|
+
const search = ref('');
|
|
6
|
+
const toast = useToast();
|
|
7
|
+
|
|
8
|
+
const { data: users, refresh } = await useFetch('/api/admin/users', {
|
|
9
|
+
query: computed(() => ({ search: search.value || undefined })),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
interface AdminUser {
|
|
13
|
+
id: string;
|
|
14
|
+
username: string;
|
|
15
|
+
email: string;
|
|
16
|
+
role: string;
|
|
17
|
+
status: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const userList = computed<AdminUser[]>(() => {
|
|
22
|
+
if (!users.value) return [];
|
|
23
|
+
if (Array.isArray(users.value)) return users.value as AdminUser[];
|
|
24
|
+
return (users.value as { items?: AdminUser[] }).items ?? [];
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const roles = ['member', 'pro', 'verified', 'staff', 'admin'] as const;
|
|
28
|
+
|
|
29
|
+
async function changeRole(userId: string, role: string): Promise<void> {
|
|
30
|
+
try {
|
|
31
|
+
await $fetch(`/api/admin/users/${userId}/role`, {
|
|
32
|
+
method: 'PUT',
|
|
33
|
+
body: { role },
|
|
34
|
+
});
|
|
35
|
+
toast.success('Role updated');
|
|
36
|
+
await refresh();
|
|
37
|
+
} catch {
|
|
38
|
+
toast.error('Failed to update role');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function toggleStatus(userId: string, currentStatus: string): Promise<void> {
|
|
43
|
+
const newStatus = currentStatus === 'active' ? 'suspended' : 'active';
|
|
44
|
+
try {
|
|
45
|
+
await $fetch(`/api/admin/users/${userId}/status`, {
|
|
46
|
+
method: 'PUT',
|
|
47
|
+
body: { status: newStatus },
|
|
48
|
+
});
|
|
49
|
+
toast.success(`User ${newStatus}`);
|
|
50
|
+
await refresh();
|
|
51
|
+
} catch {
|
|
52
|
+
toast.error('Failed to update status');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function deleteUser(userId: string, username: string): Promise<void> {
|
|
57
|
+
if (!confirm(`Delete user @${username}? This cannot be undone.`)) return;
|
|
58
|
+
try {
|
|
59
|
+
await $fetch(`/api/admin/users/${userId}`, { method: 'DELETE' });
|
|
60
|
+
toast.success('User deleted');
|
|
61
|
+
await refresh();
|
|
62
|
+
} catch {
|
|
63
|
+
toast.error('Failed to delete user');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<div class="admin-users">
|
|
70
|
+
<h1 class="admin-page-title">Users</h1>
|
|
71
|
+
|
|
72
|
+
<input v-model="search" type="search" class="admin-search" placeholder="Search users..." aria-label="Search users" />
|
|
73
|
+
|
|
74
|
+
<div class="admin-table-wrap" v-if="userList.length">
|
|
75
|
+
<table class="admin-table">
|
|
76
|
+
<thead>
|
|
77
|
+
<tr>
|
|
78
|
+
<th>Username</th>
|
|
79
|
+
<th>Email</th>
|
|
80
|
+
<th>Role</th>
|
|
81
|
+
<th>Status</th>
|
|
82
|
+
<th>Joined</th>
|
|
83
|
+
<th>Actions</th>
|
|
84
|
+
</tr>
|
|
85
|
+
</thead>
|
|
86
|
+
<tbody>
|
|
87
|
+
<tr v-for="u in userList" :key="u.id">
|
|
88
|
+
<td>
|
|
89
|
+
<NuxtLink :to="`/u/${u.username}`" class="admin-link">@{{ u.username }}</NuxtLink>
|
|
90
|
+
</td>
|
|
91
|
+
<td class="admin-email">{{ u.email }}</td>
|
|
92
|
+
<td>
|
|
93
|
+
<select
|
|
94
|
+
class="admin-role-select"
|
|
95
|
+
:value="u.role"
|
|
96
|
+
@change="changeRole(u.id, ($event.target as HTMLSelectElement).value)"
|
|
97
|
+
>
|
|
98
|
+
<option v-for="r in roles" :key="r" :value="r">{{ r }}</option>
|
|
99
|
+
</select>
|
|
100
|
+
</td>
|
|
101
|
+
<td>
|
|
102
|
+
<button
|
|
103
|
+
class="admin-status-btn"
|
|
104
|
+
:class="u.status === 'active' ? 'status-active' : 'status-suspended'"
|
|
105
|
+
@click="toggleStatus(u.id, u.status)"
|
|
106
|
+
>
|
|
107
|
+
{{ u.status }}
|
|
108
|
+
</button>
|
|
109
|
+
</td>
|
|
110
|
+
<td class="admin-date">{{ new Date(u.createdAt).toLocaleDateString() }}</td>
|
|
111
|
+
<td>
|
|
112
|
+
<button class="admin-delete-btn" title="Delete user" @click="deleteUser(u.id, u.username)">
|
|
113
|
+
<i class="fa-solid fa-trash"></i>
|
|
114
|
+
</button>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
117
|
+
</tbody>
|
|
118
|
+
</table>
|
|
119
|
+
</div>
|
|
120
|
+
<p class="admin-empty" v-else>No users found.</p>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<style scoped>
|
|
125
|
+
.admin-page-title { font-size: var(--text-xl); font-weight: var(--font-weight-bold); margin-bottom: 16px; }
|
|
126
|
+
.admin-search { width: 100%; max-width: 400px; padding: 6px 10px; border: var(--border-width-default) solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; margin-bottom: 16px; }
|
|
127
|
+
.admin-search:focus { outline: none; border-color: var(--accent); }
|
|
128
|
+
.admin-table-wrap { overflow-x: auto; }
|
|
129
|
+
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
|
130
|
+
.admin-table th { text-align: left; padding: 8px 12px; border-bottom: var(--border-width-default) solid var(--border); font-weight: 600; color: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); }
|
|
131
|
+
.admin-table td { padding: 8px 12px; border-bottom: var(--border-width-default) solid var(--border2); }
|
|
132
|
+
.admin-link { color: var(--accent); text-decoration: none; font-weight: 500; }
|
|
133
|
+
.admin-link:hover { text-decoration: underline; }
|
|
134
|
+
.admin-email { font-size: 12px; color: var(--text-dim); }
|
|
135
|
+
.admin-date { font-size: 11px; font-family: var(--font-mono); color: var(--text-faint); }
|
|
136
|
+
.admin-role-select { padding: 3px 6px; border: var(--border-width-default) solid var(--border2); background: var(--surface); color: var(--text-dim); font-size: 11px; font-family: var(--font-mono); text-transform: capitalize; cursor: pointer; }
|
|
137
|
+
.admin-role-select:focus { border-color: var(--accent); outline: none; }
|
|
138
|
+
.admin-status-btn { font-size: 10px; font-family: var(--font-mono); text-transform: uppercase; padding: 2px 8px; cursor: pointer; border: var(--border-width-default) solid; background: none; }
|
|
139
|
+
.status-active { color: var(--green); border-color: var(--green-border); background: var(--green-bg); }
|
|
140
|
+
.status-suspended { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
|
|
141
|
+
.admin-status-btn:hover { opacity: 0.8; }
|
|
142
|
+
.admin-delete-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 12px; padding: 4px 6px; }
|
|
143
|
+
.admin-delete-btn:hover { color: var(--red); }
|
|
144
|
+
.admin-empty { color: var(--text-faint); text-align: center; padding: 32px 0; }
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({ layout: 'auth' });
|
|
3
|
+
|
|
4
|
+
useSeoMeta({
|
|
5
|
+
title: `Forgot Password — ${useSiteName()}`,
|
|
6
|
+
description: 'Reset your CommonPub account password.',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const email = ref('');
|
|
10
|
+
const error = ref('');
|
|
11
|
+
const success = ref(false);
|
|
12
|
+
const loading = ref(false);
|
|
13
|
+
|
|
14
|
+
async function handleSubmit(): Promise<void> {
|
|
15
|
+
error.value = '';
|
|
16
|
+
loading.value = true;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
await $fetch('/api/auth/forgot-password', {
|
|
20
|
+
method: 'POST',
|
|
21
|
+
body: { email: email.value },
|
|
22
|
+
});
|
|
23
|
+
success.value = true;
|
|
24
|
+
} catch (err: unknown) {
|
|
25
|
+
const message = (err as { data?: { message?: string } })?.data?.message;
|
|
26
|
+
error.value = message || 'Something went wrong. Please try again.';
|
|
27
|
+
} finally {
|
|
28
|
+
loading.value = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div class="forgot-page">
|
|
35
|
+
<h1 class="forgot-title">Forgot Password</h1>
|
|
36
|
+
|
|
37
|
+
<template v-if="success">
|
|
38
|
+
<div class="forgot-success">
|
|
39
|
+
<i class="fa-solid fa-envelope" style="font-size: 24px; color: var(--accent); margin-bottom: 12px;"></i>
|
|
40
|
+
<p class="forgot-success-text">
|
|
41
|
+
If an account exists for <strong>{{ email }}</strong>, we've sent a password reset link.
|
|
42
|
+
Check your inbox and spam folder.
|
|
43
|
+
</p>
|
|
44
|
+
</div>
|
|
45
|
+
<NuxtLink to="/auth/login" class="back-link">
|
|
46
|
+
<i class="fa-solid fa-arrow-left"></i> Back to login
|
|
47
|
+
</NuxtLink>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<template v-else>
|
|
51
|
+
<p class="forgot-desc">Enter your email address and we'll send you a link to reset your password.</p>
|
|
52
|
+
|
|
53
|
+
<form class="forgot-form" @submit.prevent="handleSubmit" aria-label="Forgot password form">
|
|
54
|
+
<div v-if="error" class="form-error" role="alert">{{ error }}</div>
|
|
55
|
+
|
|
56
|
+
<div class="field">
|
|
57
|
+
<label for="email" class="field-label">Email</label>
|
|
58
|
+
<input
|
|
59
|
+
id="email"
|
|
60
|
+
v-model="email"
|
|
61
|
+
type="email"
|
|
62
|
+
class="field-input"
|
|
63
|
+
autocomplete="email"
|
|
64
|
+
required
|
|
65
|
+
placeholder="you@example.com"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<button type="submit" class="submit-btn" :disabled="loading">
|
|
70
|
+
{{ loading ? 'Sending...' : 'Send Reset Link' }}
|
|
71
|
+
</button>
|
|
72
|
+
</form>
|
|
73
|
+
|
|
74
|
+
<p class="forgot-footer">
|
|
75
|
+
Remember your password?
|
|
76
|
+
<NuxtLink to="/auth/login">Log in</NuxtLink>
|
|
77
|
+
</p>
|
|
78
|
+
</template>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<style scoped>
|
|
83
|
+
.forgot-page { width: 100%; }
|
|
84
|
+
.forgot-title { font-size: 18px; font-weight: 600; margin-bottom: var(--space-3); }
|
|
85
|
+
.forgot-desc { font-size: 13px; color: var(--text-dim); margin-bottom: var(--space-5); line-height: 1.6; }
|
|
86
|
+
.forgot-form { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
87
|
+
.forgot-success { text-align: center; padding: var(--space-5) 0; }
|
|
88
|
+
.forgot-success-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
|
|
89
|
+
.back-link { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent); text-decoration: none; justify-content: center; margin-top: var(--space-4); }
|
|
90
|
+
.back-link:hover { text-decoration: underline; }
|
|
91
|
+
.form-error { padding: var(--space-3); background: var(--red-bg); color: var(--red); border: var(--border-width-default) solid var(--red); border-radius: var(--radius); font-size: 12px; }
|
|
92
|
+
.field { display: flex; flex-direction: column; gap: 4px; }
|
|
93
|
+
.field-label { font-size: 12px; font-weight: 500; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
|
|
94
|
+
.field-input { padding: 8px 12px; border: var(--border-width-default) solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 13px; font-family: var(--font-sans); outline: none; width: 100%; transition: border-color 0.15s; }
|
|
95
|
+
.field-input::placeholder { color: var(--text-faint); }
|
|
96
|
+
.field-input:focus { border-color: var(--accent); }
|
|
97
|
+
.submit-btn { padding: 7px 14px; background: var(--accent); color: var(--color-text-inverse); border: var(--border-width-default) solid var(--accent); border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow-sm); transition: all 0.15s; }
|
|
98
|
+
.submit-btn:hover:not(:disabled) { box-shadow: var(--shadow-md); transform: translate(-1px, -1px); }
|
|
99
|
+
.submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }
|
|
100
|
+
.forgot-footer { text-align: center; font-size: 12px; color: var(--text-dim); margin-top: var(--space-4); }
|
|
101
|
+
.forgot-footer a { color: var(--accent); text-decoration: none; }
|
|
102
|
+
.forgot-footer a:hover { text-decoration: underline; }
|
|
103
|
+
</style>
|