@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.
Files changed (436) hide show
  1. package/LICENSE +661 -0
  2. package/app.vue +7 -0
  3. package/components/AnnouncementBand.vue +117 -0
  4. package/components/AppToast.vue +108 -0
  5. package/components/AuthorCard.vue +119 -0
  6. package/components/AuthorRow.vue +81 -0
  7. package/components/CommentSection.vue +330 -0
  8. package/components/ContentCard.vue +340 -0
  9. package/components/ContentPicker.vue +240 -0
  10. package/components/ContentStarterForm.vue +214 -0
  11. package/components/ContentTypeBadge.vue +46 -0
  12. package/components/CountdownTimer.vue +68 -0
  13. package/components/CpubEditor.vue +87 -0
  14. package/components/DiscussionItem.vue +191 -0
  15. package/components/EditorPropertiesPanel.vue +393 -0
  16. package/components/EngagementBar.vue +131 -0
  17. package/components/FederatedContentCard.vue +291 -0
  18. package/components/FeedItem.vue +283 -0
  19. package/components/FilterChip.vue +21 -0
  20. package/components/HeatmapGrid.vue +92 -0
  21. package/components/ImageUpload.vue +219 -0
  22. package/components/MemberCard.vue +163 -0
  23. package/components/MessageThread.vue +120 -0
  24. package/components/NotificationItem.vue +103 -0
  25. package/components/ProgressTracker.vue +41 -0
  26. package/components/PublishErrorsModal.vue +116 -0
  27. package/components/RemoteActorCard.vue +206 -0
  28. package/components/RemoteUserSearch.vue +117 -0
  29. package/components/SearchFilters.vue +188 -0
  30. package/components/SearchSidebar.vue +181 -0
  31. package/components/SectionHeader.vue +17 -0
  32. package/components/ShareToHubModal.vue +189 -0
  33. package/components/SiteLogo.vue +21 -0
  34. package/components/SkillBar.vue +57 -0
  35. package/components/SortSelect.vue +30 -0
  36. package/components/StatBar.vue +14 -0
  37. package/components/TOCNav.vue +69 -0
  38. package/components/TimelineItem.vue +82 -0
  39. package/components/VideoCard.vue +106 -0
  40. package/components/blocks/BlockBuildStepView.vue +92 -0
  41. package/components/blocks/BlockCalloutView.vue +82 -0
  42. package/components/blocks/BlockCheckpointView.vue +50 -0
  43. package/components/blocks/BlockCodeView.vue +212 -0
  44. package/components/blocks/BlockContentRenderer.vue +143 -0
  45. package/components/blocks/BlockDividerView.vue +11 -0
  46. package/components/blocks/BlockDownloadsView.vue +126 -0
  47. package/components/blocks/BlockEmbedView.vue +61 -0
  48. package/components/blocks/BlockGalleryView.vue +57 -0
  49. package/components/blocks/BlockHeadingView.vue +29 -0
  50. package/components/blocks/BlockImageView.vue +34 -0
  51. package/components/blocks/BlockMarkdownView.vue +118 -0
  52. package/components/blocks/BlockMathView.vue +45 -0
  53. package/components/blocks/BlockPartsListView.vue +104 -0
  54. package/components/blocks/BlockQuizView.vue +239 -0
  55. package/components/blocks/BlockQuoteView.vue +41 -0
  56. package/components/blocks/BlockSectionHeaderView.vue +58 -0
  57. package/components/blocks/BlockSliderView.vue +236 -0
  58. package/components/blocks/BlockTextView.vue +41 -0
  59. package/components/blocks/BlockToolListView.vue +87 -0
  60. package/components/blocks/BlockVideoView.vue +89 -0
  61. package/components/editors/ArticleEditor.vue +545 -0
  62. package/components/editors/BlockCanvas.vue +487 -0
  63. package/components/editors/BlockInsertZone.vue +84 -0
  64. package/components/editors/BlockPicker.vue +285 -0
  65. package/components/editors/BlockWrapper.vue +192 -0
  66. package/components/editors/BlogEditor.vue +567 -0
  67. package/components/editors/EditorBlocks.vue +248 -0
  68. package/components/editors/EditorSection.vue +81 -0
  69. package/components/editors/EditorShell.vue +168 -0
  70. package/components/editors/EditorTagInput.vue +114 -0
  71. package/components/editors/EditorVisibility.vue +110 -0
  72. package/components/editors/ExplainerEditor.vue +503 -0
  73. package/components/editors/MarkdownImportDialog.vue +249 -0
  74. package/components/editors/ProjectEditor.vue +446 -0
  75. package/components/editors/blocks/BuildStepBlock.vue +102 -0
  76. package/components/editors/blocks/CalloutBlock.vue +122 -0
  77. package/components/editors/blocks/CheckpointBlock.vue +27 -0
  78. package/components/editors/blocks/CodeBlock.vue +177 -0
  79. package/components/editors/blocks/DividerBlock.vue +22 -0
  80. package/components/editors/blocks/DownloadsBlock.vue +41 -0
  81. package/components/editors/blocks/EmbedBlock.vue +20 -0
  82. package/components/editors/blocks/GalleryBlock.vue +236 -0
  83. package/components/editors/blocks/HeadingBlock.vue +96 -0
  84. package/components/editors/blocks/ImageBlock.vue +271 -0
  85. package/components/editors/blocks/MarkdownBlock.vue +258 -0
  86. package/components/editors/blocks/MathBlock.vue +37 -0
  87. package/components/editors/blocks/PartsListBlock.vue +358 -0
  88. package/components/editors/blocks/QuizBlock.vue +47 -0
  89. package/components/editors/blocks/QuoteBlock.vue +101 -0
  90. package/components/editors/blocks/SectionHeaderBlock.vue +130 -0
  91. package/components/editors/blocks/SliderBlock.vue +318 -0
  92. package/components/editors/blocks/TextBlock.vue +201 -0
  93. package/components/editors/blocks/ToolListBlock.vue +70 -0
  94. package/components/editors/blocks/VideoBlock.vue +22 -0
  95. package/components/hub/HubDiscussions.vue +47 -0
  96. package/components/hub/HubFeed.vue +199 -0
  97. package/components/hub/HubHero.vue +185 -0
  98. package/components/hub/HubLayout.vue +103 -0
  99. package/components/hub/HubMembers.vue +40 -0
  100. package/components/hub/HubProducts.vue +93 -0
  101. package/components/hub/HubProjects.vue +207 -0
  102. package/components/hub/HubSidebar.vue +12 -0
  103. package/components/hub/HubSidebarCard.vue +35 -0
  104. package/components/views/ArticleView.vue +771 -0
  105. package/components/views/BlogView.vue +667 -0
  106. package/components/views/ExplainerView.vue +688 -0
  107. package/components/views/ProjectView.vue +1500 -0
  108. package/composables/useApiError.ts +39 -0
  109. package/composables/useAuth.ts +87 -0
  110. package/composables/useBlockEditor.ts +187 -0
  111. package/composables/useContentSave.ts +253 -0
  112. package/composables/useContentTypes.ts +37 -0
  113. package/composables/useEngagement.ts +196 -0
  114. package/composables/useFeatures.ts +33 -0
  115. package/composables/useFederation.ts +72 -0
  116. package/composables/useJsonLd.ts +183 -0
  117. package/composables/useMarkdownImport.ts +77 -0
  118. package/composables/useMirrorContent.ts +105 -0
  119. package/composables/useNotifications.ts +73 -0
  120. package/composables/usePublishValidation.ts +65 -0
  121. package/composables/useSanitize.ts +34 -0
  122. package/composables/useSiteName.ts +4 -0
  123. package/composables/useTheme.ts +34 -0
  124. package/composables/useToast.ts +35 -0
  125. package/error.vue +129 -0
  126. package/layouts/admin.vue +213 -0
  127. package/layouts/auth.vue +63 -0
  128. package/layouts/default.vue +269 -0
  129. package/layouts/editor.vue +129 -0
  130. package/middleware/auth.ts +6 -0
  131. package/nuxt.config.ts +83 -0
  132. package/package.json +59 -0
  133. package/pages/[type]/[slug]/edit.vue +676 -0
  134. package/pages/[type]/[slug]/index.vue +313 -0
  135. package/pages/[type]/index.vue +118 -0
  136. package/pages/about.vue +100 -0
  137. package/pages/admin/audit.vue +66 -0
  138. package/pages/admin/content.vue +116 -0
  139. package/pages/admin/federation.vue +446 -0
  140. package/pages/admin/index.vue +62 -0
  141. package/pages/admin/reports.vue +88 -0
  142. package/pages/admin/settings.vue +167 -0
  143. package/pages/admin/users.vue +145 -0
  144. package/pages/auth/forgot-password.vue +103 -0
  145. package/pages/auth/login.vue +216 -0
  146. package/pages/auth/oauth/authorize.vue +178 -0
  147. package/pages/auth/register.vue +246 -0
  148. package/pages/auth/reset-password.vue +124 -0
  149. package/pages/auth/verify-email.vue +80 -0
  150. package/pages/cert/[code].vue +154 -0
  151. package/pages/contests/[slug]/edit.vue +153 -0
  152. package/pages/contests/[slug]/index.vue +556 -0
  153. package/pages/contests/[slug]/judge.vue +160 -0
  154. package/pages/contests/create.vue +192 -0
  155. package/pages/contests/index.vue +69 -0
  156. package/pages/create.vue +219 -0
  157. package/pages/dashboard.vue +521 -0
  158. package/pages/docs/[siteSlug]/[...pagePath].vue +704 -0
  159. package/pages/docs/[siteSlug]/edit.vue +480 -0
  160. package/pages/docs/[siteSlug]/index.vue +380 -0
  161. package/pages/docs/create.vue +60 -0
  162. package/pages/docs/index.vue +181 -0
  163. package/pages/explore.vue +422 -0
  164. package/pages/federated-hubs/[id]/index.vue +385 -0
  165. package/pages/federated-hubs/[id]/posts/[postId].vue +309 -0
  166. package/pages/federation/index.vue +157 -0
  167. package/pages/federation/search.vue +43 -0
  168. package/pages/federation/users/[handle].vue +221 -0
  169. package/pages/feed.vue +135 -0
  170. package/pages/hubs/[slug]/index.vue +513 -0
  171. package/pages/hubs/[slug]/members.vue +134 -0
  172. package/pages/hubs/[slug]/posts/[postId].vue +352 -0
  173. package/pages/hubs/[slug]/settings.vue +254 -0
  174. package/pages/hubs/create.vue +201 -0
  175. package/pages/hubs/index.vue +207 -0
  176. package/pages/index.vue +1005 -0
  177. package/pages/learn/[slug]/[lessonSlug]/edit.vue +413 -0
  178. package/pages/learn/[slug]/[lessonSlug]/index.vue +438 -0
  179. package/pages/learn/[slug]/edit.vue +414 -0
  180. package/pages/learn/[slug]/index.vue +341 -0
  181. package/pages/learn/create.vue +71 -0
  182. package/pages/learn/index.vue +360 -0
  183. package/pages/messages/[conversationId].vue +113 -0
  184. package/pages/messages/index.vue +303 -0
  185. package/pages/mirror/[id].vue +115 -0
  186. package/pages/notifications.vue +91 -0
  187. package/pages/products/[slug].vue +128 -0
  188. package/pages/products/index.vue +122 -0
  189. package/pages/search.vue +692 -0
  190. package/pages/settings/account.vue +170 -0
  191. package/pages/settings/appearance.vue +80 -0
  192. package/pages/settings/index.vue +81 -0
  193. package/pages/settings/notifications.vue +68 -0
  194. package/pages/settings/profile.vue +838 -0
  195. package/pages/tags/[slug].vue +111 -0
  196. package/pages/tags/index.vue +73 -0
  197. package/pages/u/[username]/followers.vue +86 -0
  198. package/pages/u/[username]/following.vue +94 -0
  199. package/pages/u/[username]/index.vue +837 -0
  200. package/pages/videos/[id].vue +212 -0
  201. package/pages/videos/index.vue +327 -0
  202. package/pages/videos/submit.vue +112 -0
  203. package/plugins/auth.ts +23 -0
  204. package/server/api/admin/audit.get.ts +17 -0
  205. package/server/api/admin/content/[id].delete.ts +15 -0
  206. package/server/api/admin/content/[id].patch.ts +37 -0
  207. package/server/api/admin/federation/activity.get.ts +31 -0
  208. package/server/api/admin/federation/clients.get.ts +9 -0
  209. package/server/api/admin/federation/clients.post.ts +16 -0
  210. package/server/api/admin/federation/hub-mirrors/index.get.ts +10 -0
  211. package/server/api/admin/federation/hub-mirrors/index.post.ts +42 -0
  212. package/server/api/admin/federation/mirrors/[id]/backfill.post.ts +39 -0
  213. package/server/api/admin/federation/mirrors/[id].delete.ts +11 -0
  214. package/server/api/admin/federation/mirrors/[id].get.ts +15 -0
  215. package/server/api/admin/federation/mirrors/[id].put.ts +22 -0
  216. package/server/api/admin/federation/mirrors/index.get.ts +9 -0
  217. package/server/api/admin/federation/mirrors/index.post.ts +30 -0
  218. package/server/api/admin/federation/pending.get.ts +22 -0
  219. package/server/api/admin/federation/refederate.post.ts +92 -0
  220. package/server/api/admin/federation/repair-types.post.ts +57 -0
  221. package/server/api/admin/federation/retry.post.ts +41 -0
  222. package/server/api/admin/federation/stats.get.ts +26 -0
  223. package/server/api/admin/reports/[id]/resolve.post.ts +12 -0
  224. package/server/api/admin/reports.get.ts +17 -0
  225. package/server/api/admin/settings.get.ts +22 -0
  226. package/server/api/admin/settings.put.ts +11 -0
  227. package/server/api/admin/stats.get.ts +9 -0
  228. package/server/api/admin/users/[id]/role.put.ts +12 -0
  229. package/server/api/admin/users/[id]/status.put.ts +12 -0
  230. package/server/api/admin/users/[id].delete.ts +10 -0
  231. package/server/api/admin/users.get.ts +18 -0
  232. package/server/api/auth/federated/callback.get.ts +67 -0
  233. package/server/api/auth/federated/login.post.ts +60 -0
  234. package/server/api/auth/oauth2/authorize.get.ts +30 -0
  235. package/server/api/auth/oauth2/authorize.post.ts +51 -0
  236. package/server/api/auth/oauth2/register.post.ts +41 -0
  237. package/server/api/auth/oauth2/token.post.ts +48 -0
  238. package/server/api/cert/[code].get.ts +13 -0
  239. package/server/api/content/[id]/build.post.ts +9 -0
  240. package/server/api/content/[id]/fork.post.ts +10 -0
  241. package/server/api/content/[id]/index.delete.ts +18 -0
  242. package/server/api/content/[id]/index.get.ts +15 -0
  243. package/server/api/content/[id]/index.put.ts +23 -0
  244. package/server/api/content/[id]/products/[productId].delete.ts +28 -0
  245. package/server/api/content/[id]/products-sync.post.ts +29 -0
  246. package/server/api/content/[id]/products.get.ts +9 -0
  247. package/server/api/content/[id]/products.post.ts +31 -0
  248. package/server/api/content/[id]/publish.post.ts +17 -0
  249. package/server/api/content/[id]/report.post.ts +17 -0
  250. package/server/api/content/[id]/versions.get.ts +9 -0
  251. package/server/api/content/[id]/view.post.ts +34 -0
  252. package/server/api/content/index.get.ts +23 -0
  253. package/server/api/content/index.post.ts +11 -0
  254. package/server/api/contests/[slug]/entries.get.ts +18 -0
  255. package/server/api/contests/[slug]/entries.post.ts +23 -0
  256. package/server/api/contests/[slug]/index.delete.ts +21 -0
  257. package/server/api/contests/[slug]/index.get.ts +11 -0
  258. package/server/api/contests/[slug]/index.put.ts +15 -0
  259. package/server/api/contests/[slug]/judge.post.ts +12 -0
  260. package/server/api/contests/[slug]/transition.post.ts +24 -0
  261. package/server/api/contests/index.get.ts +10 -0
  262. package/server/api/contests/index.post.ts +28 -0
  263. package/server/api/docs/[siteSlug]/index.delete.ts +14 -0
  264. package/server/api/docs/[siteSlug]/index.get.ts +17 -0
  265. package/server/api/docs/[siteSlug]/index.put.ts +20 -0
  266. package/server/api/docs/[siteSlug]/nav.get.ts +26 -0
  267. package/server/api/docs/[siteSlug]/pages/[pageId].delete.ts +14 -0
  268. package/server/api/docs/[siteSlug]/pages/[pageId].get.ts +31 -0
  269. package/server/api/docs/[siteSlug]/pages/[pageId].put.ts +15 -0
  270. package/server/api/docs/[siteSlug]/pages/index.get.ts +34 -0
  271. package/server/api/docs/[siteSlug]/pages/index.post.ts +28 -0
  272. package/server/api/docs/[siteSlug]/pages/reorder.post.ts +26 -0
  273. package/server/api/docs/[siteSlug]/search.get.ts +20 -0
  274. package/server/api/docs/[siteSlug]/versions.post.ts +11 -0
  275. package/server/api/docs/index.get.ts +6 -0
  276. package/server/api/docs/index.post.ts +10 -0
  277. package/server/api/federated-hubs/[id]/posts/[postId].get.ts +16 -0
  278. package/server/api/federated-hubs/[id]/posts.get.ts +15 -0
  279. package/server/api/federated-hubs/[id].get.ts +16 -0
  280. package/server/api/federation/boost.post.ts +21 -0
  281. package/server/api/federation/content/[id].get.ts +15 -0
  282. package/server/api/federation/follow.post.ts +16 -0
  283. package/server/api/federation/health.get.ts +56 -0
  284. package/server/api/federation/hub-follow.post.ts +27 -0
  285. package/server/api/federation/hub-post-like.post.ts +115 -0
  286. package/server/api/federation/hub-post-likes.get.ts +24 -0
  287. package/server/api/federation/hub-post-reply.post.ts +42 -0
  288. package/server/api/federation/hub-post.post.ts +33 -0
  289. package/server/api/federation/like.post.ts +21 -0
  290. package/server/api/federation/remote-actor.get.ts +22 -0
  291. package/server/api/federation/reply.post.ts +22 -0
  292. package/server/api/federation/search.post.ts +17 -0
  293. package/server/api/federation/timeline.get.ts +22 -0
  294. package/server/api/federation/unfollow.post.ts +17 -0
  295. package/server/api/files/[id].delete.ts +35 -0
  296. package/server/api/files/mine.get.ts +31 -0
  297. package/server/api/files/upload-from-url.post.ts +68 -0
  298. package/server/api/files/upload.post.ts +105 -0
  299. package/server/api/health.get.ts +4 -0
  300. package/server/api/hubs/[slug]/bans/[userId].delete.ts +13 -0
  301. package/server/api/hubs/[slug]/bans.get.ts +20 -0
  302. package/server/api/hubs/[slug]/bans.post.ts +23 -0
  303. package/server/api/hubs/[slug]/feed.xml.get.ts +60 -0
  304. package/server/api/hubs/[slug]/gallery.get.ts +21 -0
  305. package/server/api/hubs/[slug]/index.delete.ts +18 -0
  306. package/server/api/hubs/[slug]/index.get.ts +14 -0
  307. package/server/api/hubs/[slug]/index.put.ts +22 -0
  308. package/server/api/hubs/[slug]/invites.get.ts +20 -0
  309. package/server/api/hubs/[slug]/invites.post.ts +27 -0
  310. package/server/api/hubs/[slug]/join.post.ts +17 -0
  311. package/server/api/hubs/[slug]/leave.post.ts +13 -0
  312. package/server/api/hubs/[slug]/members/[userId].delete.ts +13 -0
  313. package/server/api/hubs/[slug]/members/[userId].put.ts +16 -0
  314. package/server/api/hubs/[slug]/members.get.ts +20 -0
  315. package/server/api/hubs/[slug]/posts/[postId]/like.post.ts +21 -0
  316. package/server/api/hubs/[slug]/posts/[postId]/lock.post.ts +17 -0
  317. package/server/api/hubs/[slug]/posts/[postId]/pin.post.ts +17 -0
  318. package/server/api/hubs/[slug]/posts/[postId]/replies.get.ts +16 -0
  319. package/server/api/hubs/[slug]/posts/[postId]/replies.post.ts +21 -0
  320. package/server/api/hubs/[slug]/posts/[postId].delete.ts +23 -0
  321. package/server/api/hubs/[slug]/posts/[postId].get.ts +16 -0
  322. package/server/api/hubs/[slug]/posts/index.get.ts +16 -0
  323. package/server/api/hubs/[slug]/posts/index.post.ts +36 -0
  324. package/server/api/hubs/[slug]/products.get.ts +26 -0
  325. package/server/api/hubs/[slug]/products.post.ts +18 -0
  326. package/server/api/hubs/[slug]/share.post.ts +39 -0
  327. package/server/api/hubs/index.get.ts +15 -0
  328. package/server/api/hubs/index.post.ts +11 -0
  329. package/server/api/image-proxy.get.ts +91 -0
  330. package/server/api/learn/[slug]/[lessonSlug]/complete.post.ts +13 -0
  331. package/server/api/learn/[slug]/[lessonSlug]/index.get.ts +68 -0
  332. package/server/api/learn/[slug]/enroll.post.ts +12 -0
  333. package/server/api/learn/[slug]/index.delete.ts +12 -0
  334. package/server/api/learn/[slug]/index.get.ts +14 -0
  335. package/server/api/learn/[slug]/index.put.ts +19 -0
  336. package/server/api/learn/[slug]/lessons/[lessonId].delete.ts +14 -0
  337. package/server/api/learn/[slug]/lessons/[lessonId].put.ts +24 -0
  338. package/server/api/learn/[slug]/lessons.post.ts +10 -0
  339. package/server/api/learn/[slug]/modules/[moduleId].delete.ts +14 -0
  340. package/server/api/learn/[slug]/modules/[moduleId].put.ts +15 -0
  341. package/server/api/learn/[slug]/modules.post.ts +14 -0
  342. package/server/api/learn/[slug]/publish.post.ts +13 -0
  343. package/server/api/learn/[slug]/unenroll.post.ts +12 -0
  344. package/server/api/learn/certificates.get.ts +9 -0
  345. package/server/api/learn/enrollments.get.ts +9 -0
  346. package/server/api/learn/index.get.ts +17 -0
  347. package/server/api/learn/index.post.ts +11 -0
  348. package/server/api/me.get.ts +13 -0
  349. package/server/api/messages/[conversationId]/info.get.ts +43 -0
  350. package/server/api/messages/[conversationId]/stream.get.ts +73 -0
  351. package/server/api/messages/[conversationId].get.ts +13 -0
  352. package/server/api/messages/[conversationId].post.ts +12 -0
  353. package/server/api/messages/index.get.ts +39 -0
  354. package/server/api/messages/index.post.ts +58 -0
  355. package/server/api/notifications/[id].delete.ts +11 -0
  356. package/server/api/notifications/count.get.ts +10 -0
  357. package/server/api/notifications/index.get.ts +24 -0
  358. package/server/api/notifications/read.post.ts +15 -0
  359. package/server/api/notifications/stream.get.ts +59 -0
  360. package/server/api/openapi.get.ts +5 -0
  361. package/server/api/products/[id].delete.ts +15 -0
  362. package/server/api/products/[id].put.ts +18 -0
  363. package/server/api/products/[slug]/content.get.ts +21 -0
  364. package/server/api/products/[slug].get.ts +16 -0
  365. package/server/api/products/index.get.ts +28 -0
  366. package/server/api/profile.get.ts +15 -0
  367. package/server/api/profile.put.ts +24 -0
  368. package/server/api/resolve-identity.post.ts +34 -0
  369. package/server/api/search/index.get.ts +24 -0
  370. package/server/api/search/trending.get.ts +22 -0
  371. package/server/api/social/bookmark.get.ts +16 -0
  372. package/server/api/social/bookmark.post.ts +15 -0
  373. package/server/api/social/bookmarks.get.ts +16 -0
  374. package/server/api/social/comments/[id].delete.ts +13 -0
  375. package/server/api/social/comments.get.ts +18 -0
  376. package/server/api/social/comments.post.ts +11 -0
  377. package/server/api/social/like.get.ts +17 -0
  378. package/server/api/social/like.post.ts +35 -0
  379. package/server/api/stats.get.ts +8 -0
  380. package/server/api/user/hubs.get.ts +22 -0
  381. package/server/api/users/[username]/content.get.ts +21 -0
  382. package/server/api/users/[username]/feed.xml.get.ts +65 -0
  383. package/server/api/users/[username]/follow.delete.ts +15 -0
  384. package/server/api/users/[username]/follow.post.ts +15 -0
  385. package/server/api/users/[username]/followers.get.ts +22 -0
  386. package/server/api/users/[username]/following.get.ts +22 -0
  387. package/server/api/users/[username]/learning.get.ts +18 -0
  388. package/server/api/users/[username].get.ts +25 -0
  389. package/server/api/users/index.get.ts +78 -0
  390. package/server/api/videos/[id].get.ts +18 -0
  391. package/server/api/videos/categories/[id].delete.ts +15 -0
  392. package/server/api/videos/categories/[id].put.ts +17 -0
  393. package/server/api/videos/categories.get.ts +7 -0
  394. package/server/api/videos/categories.post.ts +11 -0
  395. package/server/api/videos/index.get.ts +20 -0
  396. package/server/api/videos/index.post.ts +11 -0
  397. package/server/middleware/auth.ts +180 -0
  398. package/server/middleware/features.ts +31 -0
  399. package/server/middleware/security.ts +54 -0
  400. package/server/plugins/auto-admin.ts +69 -0
  401. package/server/plugins/federation-delivery.ts +74 -0
  402. package/server/routes/.well-known/nodeinfo.ts +15 -0
  403. package/server/routes/.well-known/webfinger.ts +86 -0
  404. package/server/routes/actor/followers.ts +34 -0
  405. package/server/routes/actor/following.ts +34 -0
  406. package/server/routes/actor/outbox.ts +31 -0
  407. package/server/routes/actor.ts +30 -0
  408. package/server/routes/feed.xml.ts +59 -0
  409. package/server/routes/hubs/[slug]/followers.ts +39 -0
  410. package/server/routes/hubs/[slug]/inbox.ts +35 -0
  411. package/server/routes/hubs/[slug]/outbox.ts +43 -0
  412. package/server/routes/hubs/[slug]/posts/[postId].ts +63 -0
  413. package/server/routes/hubs/[slug].ts +29 -0
  414. package/server/routes/inbox.ts +34 -0
  415. package/server/routes/nodeinfo/2.1.ts +27 -0
  416. package/server/routes/robots.txt.ts +19 -0
  417. package/server/routes/sitemap.xml.ts +105 -0
  418. package/server/routes/users/[username]/followers.ts +33 -0
  419. package/server/routes/users/[username]/following.ts +33 -0
  420. package/server/routes/users/[username]/inbox.ts +34 -0
  421. package/server/routes/users/[username]/outbox.ts +35 -0
  422. package/server/routes/users/[username].ts +62 -0
  423. package/server/utils/auth.ts +36 -0
  424. package/server/utils/db.ts +34 -0
  425. package/server/utils/errors.ts +24 -0
  426. package/server/utils/inbox.ts +122 -0
  427. package/server/utils/validate.ts +82 -0
  428. package/theme/base.css +283 -0
  429. package/theme/components.css +322 -0
  430. package/theme/dark.css +87 -0
  431. package/theme/editor-panels.css +63 -0
  432. package/theme/forms.css +216 -0
  433. package/theme/generics.css +68 -0
  434. package/theme/layouts.css +415 -0
  435. package/theme/prose.css +342 -0
  436. package/types/hub.ts +61 -0
@@ -0,0 +1,116 @@
1
+ <script setup lang="ts">
2
+ definePageMeta({ layout: 'admin', middleware: 'auth' });
3
+ useSeoMeta({ title: `Content Management — Admin — ${useSiteName()}` });
4
+
5
+ const toast = useToast();
6
+ const { data, refresh } = await useFetch('/api/content', {
7
+ query: { limit: 50, sort: 'recent' },
8
+ });
9
+
10
+ async function removeContent(id: string, title: string): Promise<void> {
11
+ if (!confirm(`Remove "${title}"? This cannot be undone.`)) return;
12
+ try {
13
+ await $fetch(`/api/admin/content/${id}`, { method: 'DELETE' });
14
+ toast.success('Content removed');
15
+ await refresh();
16
+ } catch {
17
+ toast.error('Failed to remove content');
18
+ }
19
+ }
20
+
21
+ async function toggleFeatured(id: string, current: boolean): Promise<void> {
22
+ try {
23
+ await $fetch(`/api/admin/content/${id}`, {
24
+ method: 'PATCH',
25
+ body: { isFeatured: !current },
26
+ });
27
+ toast.success(current ? 'Unfeatured' : 'Featured on homepage');
28
+ await refresh();
29
+ } catch {
30
+ toast.error('Failed to update featured status');
31
+ }
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <div class="cpub-admin-content">
37
+ <h1 class="cpub-admin-title">Content Management</h1>
38
+
39
+ <div class="cpub-admin-table-wrap" v-if="data?.items?.length">
40
+ <table class="cpub-admin-table">
41
+ <thead>
42
+ <tr>
43
+ <th>Title</th>
44
+ <th>Type</th>
45
+ <th>Author</th>
46
+ <th>Status</th>
47
+ <th>Views</th>
48
+ <th>Created</th>
49
+ <th>Actions</th>
50
+ </tr>
51
+ </thead>
52
+ <tbody>
53
+ <tr v-for="item in data.items" :key="item.id">
54
+ <td>
55
+ <NuxtLink :to="`/${item.type}/${item.slug}`" class="cpub-admin-link">{{ item.title }}</NuxtLink>
56
+ </td>
57
+ <td><ContentTypeBadge :type="item.type" /></td>
58
+ <td class="cpub-admin-author">{{ item.author?.displayName || item.author?.username || 'Unknown' }}</td>
59
+ <td>
60
+ <span :class="['cpub-status-badge', `cpub-status-${item.status}`]">{{ item.status }}</span>
61
+ </td>
62
+ <td class="cpub-admin-num">{{ item.viewCount ?? 0 }}</td>
63
+ <td class="cpub-admin-date">{{ new Date(item.createdAt).toLocaleDateString() }}</td>
64
+ <td class="cpub-admin-actions">
65
+ <button
66
+ v-if="item.source !== 'federated'"
67
+ class="cpub-admin-action"
68
+ :class="{ 'cpub-admin-action--active': item.isFeatured }"
69
+ :title="item.isFeatured ? 'Remove from featured' : 'Feature on homepage'"
70
+ @click="toggleFeatured(item.id, !!item.isFeatured)"
71
+ >
72
+ <i class="fa-solid fa-star"></i>
73
+ </button>
74
+ <span v-if="item.source === 'federated'" class="cpub-admin-federated-tag">
75
+ <i class="fa-solid fa-globe"></i> federated
76
+ </span>
77
+ <button class="cpub-admin-action cpub-admin-action--danger" title="Remove content" @click="removeContent(item.id, item.title)">
78
+ <i class="fa-solid fa-trash"></i>
79
+ </button>
80
+ </td>
81
+ </tr>
82
+ </tbody>
83
+ </table>
84
+ </div>
85
+ <p class="cpub-empty" v-else>No content found.</p>
86
+ </div>
87
+ </template>
88
+
89
+ <style scoped>
90
+ .cpub-admin-title { font-size: var(--text-xl); font-weight: var(--font-weight-bold); margin-bottom: var(--space-6); }
91
+ .cpub-admin-table-wrap { overflow-x: auto; }
92
+ .cpub-admin-table { width: 100%; border-collapse: collapse; }
93
+ .cpub-admin-table th { font-family: var(--font-mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); text-align: left; padding: 8px 12px; border-bottom: var(--border-width-default) solid var(--border); }
94
+ .cpub-admin-table td { padding: 8px 12px; border-bottom: var(--border-width-default) solid var(--border2); font-size: 13px; }
95
+ .cpub-admin-link { color: var(--text); text-decoration: none; font-weight: 500; }
96
+ .cpub-admin-link:hover { color: var(--accent); }
97
+ .cpub-admin-author { font-size: 12px; color: var(--text-dim); }
98
+ .cpub-admin-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
99
+ .cpub-admin-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
100
+ .cpub-status-badge { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; padding: 2px 8px; }
101
+ .cpub-status-published { color: var(--green); background: var(--green-bg); border: var(--border-width-default) solid var(--green-border); }
102
+ .cpub-status-draft { color: var(--text-dim); background: var(--surface2); border: var(--border-width-default) solid var(--border2); }
103
+ .cpub-admin-actions { display: flex; gap: 6px; }
104
+ .cpub-admin-action { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 12px; padding: 4px 6px; }
105
+ .cpub-admin-action:hover { color: var(--accent); }
106
+ .cpub-admin-action--active { color: var(--yellow, #e6b800); }
107
+ .cpub-admin-action--danger:hover { color: var(--red); }
108
+ .cpub-admin-federated-tag { font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 3px; }
109
+ .cpub-empty { color: var(--text-faint); text-align: center; padding: var(--space-10) 0; }
110
+
111
+ @media (max-width: 768px) {
112
+ .cpub-admin-title { font-size: var(--text-lg); }
113
+ .cpub-admin-table { font-size: var(--text-xs); display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
114
+ .cpub-admin-table th, .cpub-admin-table td { padding: var(--space-1) var(--space-2); white-space: nowrap; }
115
+ }
116
+ </style>
@@ -0,0 +1,446 @@
1
+ <script setup lang="ts">
2
+ definePageMeta({ layout: 'admin', middleware: 'auth' });
3
+ useSeoMeta({ title: `Federation — Admin — ${useSiteName()}` });
4
+
5
+ const activeTab = ref<'activity' | 'mirrors' | 'clients' | 'tools'>('activity');
6
+
7
+ const { data: statsData } = await useFetch('/api/admin/federation/stats', {
8
+ default: () => ({ inbound: 0, outbound: 0, pending: 0, failed: 0, followers: 0, following: 0 }),
9
+ });
10
+
11
+ const { data: activityData } = await useFetch('/api/admin/federation/activity', {
12
+ query: { limit: 50 },
13
+ default: () => ({ items: [], total: 0 }),
14
+ });
15
+
16
+ const { data: mirrorsData, refresh: refreshMirrors } = await useFetch<any[]>('/api/admin/federation/mirrors', {
17
+ default: () => [],
18
+ });
19
+
20
+ const { data: clientsData } = await useFetch<any[]>('/api/admin/federation/clients', {
21
+ default: () => [],
22
+ });
23
+
24
+ // Mirror creation
25
+ const newMirrorDomain = ref('');
26
+ const newMirrorActorUri = ref('');
27
+ const mirrorCreating = ref(false);
28
+
29
+ async function createMirror(): Promise<void> {
30
+ if (!newMirrorDomain.value) return;
31
+ mirrorCreating.value = true;
32
+ try {
33
+ await $fetch('/api/admin/federation/mirrors', {
34
+ method: 'POST',
35
+ body: {
36
+ remoteDomain: newMirrorDomain.value,
37
+ remoteActorUri: newMirrorActorUri.value || `https://${newMirrorDomain.value}/actor`,
38
+ direction: 'pull',
39
+ },
40
+ });
41
+ newMirrorDomain.value = '';
42
+ newMirrorActorUri.value = '';
43
+ await refreshMirrors();
44
+ } finally {
45
+ mirrorCreating.value = false;
46
+ }
47
+ }
48
+
49
+ async function toggleMirror(id: string, currentStatus: string): Promise<void> {
50
+ await $fetch(`/api/admin/federation/mirrors/${id}`, {
51
+ method: 'PUT',
52
+ body: { action: currentStatus === 'active' ? 'pause' : 'resume' },
53
+ });
54
+ await refreshMirrors();
55
+ }
56
+
57
+ async function deleteMirror(id: string): Promise<void> {
58
+ await $fetch(`/api/admin/federation/mirrors/${id}`, { method: 'DELETE' });
59
+ await refreshMirrors();
60
+ }
61
+
62
+ // Backfill
63
+ const backfilling = ref<string | null>(null);
64
+ const backfillResult = ref<{ processed: number; errors: number; pages: number } | null>(null);
65
+
66
+ async function backfillMirror(id: string): Promise<void> {
67
+ backfilling.value = id;
68
+ backfillResult.value = null;
69
+ try {
70
+ const result = await $fetch<{ processed: number; errors: number; pages: number }>(`/api/admin/federation/mirrors/${id}/backfill`, { method: 'POST' });
71
+ backfillResult.value = result;
72
+ await refreshMirrors();
73
+ } finally {
74
+ backfilling.value = null;
75
+ }
76
+ }
77
+
78
+ // Retry failed activities
79
+ const retrying = ref(false);
80
+
81
+ async function retryFailed(): Promise<void> {
82
+ retrying.value = true;
83
+ try {
84
+ await $fetch('/api/admin/federation/retry', { method: 'POST' });
85
+ window.location.reload();
86
+ } finally {
87
+ retrying.value = false;
88
+ }
89
+ }
90
+
91
+ // Activity filters
92
+ const activityFilter = ref<{ direction?: string; status?: string; type?: string }>({});
93
+ const filteredActivities = computed(() => {
94
+ const items = (activityData.value?.items ?? []) as Array<{ id: string; direction: string; type: string; actorUri: string; status: string; createdAt: string }>;
95
+ return items.filter((act) => {
96
+ if (activityFilter.value.direction && act.direction !== activityFilter.value.direction) return false;
97
+ if (activityFilter.value.status && act.status !== activityFilter.value.status) return false;
98
+ if (activityFilter.value.type && act.type !== activityFilter.value.type) return false;
99
+ return true;
100
+ });
101
+ });
102
+
103
+ // Tools: pending activities
104
+ const pendingData = ref<{ count: number; activities: Array<{ id: string; activityType: string; actorUri: string; objectUri: string; createdAt: string; status: string }> } | null>(null);
105
+ const loadingPending = ref(false);
106
+
107
+ async function loadPending(): Promise<void> {
108
+ loadingPending.value = true;
109
+ try {
110
+ pendingData.value = await ($fetch as Function)('/api/admin/federation/pending');
111
+ } finally {
112
+ loadingPending.value = false;
113
+ }
114
+ }
115
+
116
+ // Tools: repair content types
117
+ const repairResult = ref<{ total: number; updated: number; errors: number } | null>(null);
118
+ const repairing = ref(false);
119
+
120
+ async function repairTypes(): Promise<void> {
121
+ repairing.value = true;
122
+ repairResult.value = null;
123
+ try {
124
+ repairResult.value = await ($fetch as Function)('/api/admin/federation/repair-types', { method: 'POST' });
125
+ } finally {
126
+ repairing.value = false;
127
+ }
128
+ }
129
+
130
+ // Tools: re-federate
131
+ const refederating = ref(false);
132
+ const refederateResult = ref<{ queued: number; content?: number; hubs?: number; hubsFound?: number; hubPosts?: number } | null>(null);
133
+
134
+ async function refederate(): Promise<void> {
135
+ refederating.value = true;
136
+ refederateResult.value = null;
137
+ try {
138
+ refederateResult.value = await ($fetch as Function)('/api/admin/federation/refederate', { method: 'POST' });
139
+ } finally {
140
+ refederating.value = false;
141
+ }
142
+ }
143
+ </script>
144
+
145
+ <template>
146
+ <div>
147
+ <h1 class="cpub-admin-title">Federation</h1>
148
+
149
+ <!-- Stats -->
150
+ <div class="cpub-fed-stats">
151
+ <div class="cpub-fed-stat">
152
+ <span class="cpub-fed-stat-val">{{ statsData?.inbound ?? 0 }}</span>
153
+ <span class="cpub-fed-stat-label">Inbound</span>
154
+ </div>
155
+ <div class="cpub-fed-stat">
156
+ <span class="cpub-fed-stat-val">{{ statsData?.outbound ?? 0 }}</span>
157
+ <span class="cpub-fed-stat-label">Outbound</span>
158
+ </div>
159
+ <div class="cpub-fed-stat">
160
+ <span class="cpub-fed-stat-val">{{ statsData?.pending ?? 0 }}</span>
161
+ <span class="cpub-fed-stat-label">Pending</span>
162
+ </div>
163
+ <div class="cpub-fed-stat">
164
+ <span class="cpub-fed-stat-val">{{ statsData?.failed ?? 0 }}</span>
165
+ <span class="cpub-fed-stat-label">Failed</span>
166
+ </div>
167
+ <div class="cpub-fed-stat">
168
+ <span class="cpub-fed-stat-val">{{ statsData?.followers ?? 0 }}</span>
169
+ <span class="cpub-fed-stat-label">Followers</span>
170
+ </div>
171
+ <div class="cpub-fed-stat">
172
+ <span class="cpub-fed-stat-val">{{ statsData?.following ?? 0 }}</span>
173
+ <span class="cpub-fed-stat-label">Following</span>
174
+ </div>
175
+ </div>
176
+
177
+ <!-- Tabs -->
178
+ <div class="cpub-fed-tabs">
179
+ <button :class="{ active: activeTab === 'activity' }" @click="activeTab = 'activity'">Activity</button>
180
+ <button :class="{ active: activeTab === 'mirrors' }" @click="activeTab = 'mirrors'">Mirrors</button>
181
+ <button :class="{ active: activeTab === 'clients' }" @click="activeTab = 'clients'">OAuth Clients</button>
182
+ <button :class="{ active: activeTab === 'tools' }" @click="activeTab = 'tools'">Tools</button>
183
+ </div>
184
+
185
+ <!-- Activity Tab -->
186
+ <div v-if="activeTab === 'activity'">
187
+ <!-- Filters + Retry -->
188
+ <div class="cpub-fed-form">
189
+ <select v-model="activityFilter.direction" class="cpub-fed-input" style="flex:0 0 auto;width:auto;">
190
+ <option value="">All directions</option>
191
+ <option value="inbound">Inbound</option>
192
+ <option value="outbound">Outbound</option>
193
+ </select>
194
+ <select v-model="activityFilter.status" class="cpub-fed-input" style="flex:0 0 auto;width:auto;">
195
+ <option value="">All statuses</option>
196
+ <option value="pending">Pending</option>
197
+ <option value="delivered">Delivered</option>
198
+ <option value="processed">Processed</option>
199
+ <option value="failed">Failed</option>
200
+ </select>
201
+ <select v-model="activityFilter.type" class="cpub-fed-input" style="flex:0 0 auto;width:auto;">
202
+ <option value="">All types</option>
203
+ <option value="Create">Create</option>
204
+ <option value="Update">Update</option>
205
+ <option value="Delete">Delete</option>
206
+ <option value="Follow">Follow</option>
207
+ <option value="Accept">Accept</option>
208
+ <option value="Like">Like</option>
209
+ <option value="Announce">Announce</option>
210
+ <option value="Undo">Undo</option>
211
+ </select>
212
+ <button
213
+ v-if="(statsData?.failed ?? 0) > 0"
214
+ class="cpub-fed-btn"
215
+ :disabled="retrying"
216
+ @click="retryFailed"
217
+ >
218
+ {{ retrying ? 'Retrying...' : `Retry ${statsData?.failed ?? 0} Failed` }}
219
+ </button>
220
+ </div>
221
+
222
+ <div class="cpub-fed-activity-list">
223
+ <div v-if="!filteredActivities.length" class="cpub-fed-empty">No matching activity.</div>
224
+ <div v-for="act in filteredActivities" :key="act.id" class="cpub-fed-activity-row">
225
+ <span class="cpub-fed-dir" :class="act.direction">{{ act.direction === 'inbound' ? 'IN' : 'OUT' }}</span>
226
+ <span class="cpub-fed-type">{{ act.type }}</span>
227
+ <span class="cpub-fed-actor">{{ act.actorUri }}</span>
228
+ <span class="cpub-fed-status" :class="act.status">{{ act.status }}</span>
229
+ <time class="cpub-fed-time">{{ new Date(act.createdAt).toLocaleString() }}</time>
230
+ </div>
231
+ </div>
232
+ </div>
233
+
234
+ <!-- Mirrors Tab -->
235
+ <div v-if="activeTab === 'mirrors'">
236
+ <div class="cpub-fed-form">
237
+ <input v-model="newMirrorDomain" placeholder="remote-instance.com" class="cpub-fed-input" />
238
+ <button :disabled="mirrorCreating || !newMirrorDomain" class="cpub-fed-btn" @click="createMirror">
239
+ {{ mirrorCreating ? 'Creating...' : 'Add Mirror' }}
240
+ </button>
241
+ </div>
242
+
243
+ <div class="cpub-fed-activity-list">
244
+ <div v-if="!mirrorsData?.length" class="cpub-fed-empty">No mirrors configured.</div>
245
+ <div v-for="m in mirrorsData" :key="m.id" class="cpub-fed-activity-row">
246
+ <span class="cpub-fed-status" :class="m.status">{{ m.status }}</span>
247
+ <span class="cpub-fed-type">{{ m.remoteDomain }}</span>
248
+ <span class="cpub-fed-actor">{{ m.contentCount }} items</span>
249
+ <span v-if="m.lastError" class="cpub-fed-error" :title="m.lastError">err</span>
250
+ <button class="cpub-fed-btn-sm" @click="toggleMirror(m.id, m.status)">
251
+ {{ m.status === 'active' ? 'Pause' : 'Resume' }}
252
+ </button>
253
+ <button
254
+ class="cpub-fed-btn-sm"
255
+ :disabled="backfilling === m.id"
256
+ @click="backfillMirror(m.id)"
257
+ >
258
+ {{ backfilling === m.id ? 'Backfilling...' : 'Backfill' }}
259
+ </button>
260
+ <button class="cpub-fed-btn-sm cpub-fed-btn-danger" @click="deleteMirror(m.id)">Delete</button>
261
+ </div>
262
+ </div>
263
+
264
+ <!-- Backfill result -->
265
+ <div v-if="backfillResult" class="cpub-fed-result">
266
+ Backfill complete: {{ backfillResult.processed }} items, {{ backfillResult.errors }} errors, {{ backfillResult.pages }} pages.
267
+ </div>
268
+ </div>
269
+
270
+ <!-- OAuth Clients Tab -->
271
+ <div v-if="activeTab === 'clients'">
272
+ <div class="cpub-fed-activity-list">
273
+ <div v-if="!clientsData?.length" class="cpub-fed-empty">No OAuth clients registered.</div>
274
+ <div v-for="c in clientsData" :key="c.id" class="cpub-fed-activity-row">
275
+ <span class="cpub-fed-type">{{ c.instanceDomain }}</span>
276
+ <span class="cpub-fed-actor">{{ c.clientId }}</span>
277
+ <time class="cpub-fed-time">{{ new Date(c.createdAt).toLocaleString() }}</time>
278
+ </div>
279
+ </div>
280
+ <p class="cpub-fed-info-text">
281
+ Clients are auto-registered via the <code>/api/auth/oauth2/register</code> endpoint.
282
+ </p>
283
+ </div>
284
+
285
+ <!-- Tools Tab -->
286
+ <div v-if="activeTab === 'tools'">
287
+ <div class="cpub-fed-tools">
288
+ <!-- Pending Activities -->
289
+ <div class="cpub-fed-tool-card">
290
+ <h3 class="cpub-fed-tool-title"><i class="fa-solid fa-clock-rotate-left"></i> Pending Activities</h3>
291
+ <p class="cpub-fed-tool-desc">View outbound activities that haven't been delivered yet. Useful for debugging stuck Delete or Create activities.</p>
292
+ <button class="cpub-fed-btn" :disabled="loadingPending" @click="loadPending">
293
+ {{ loadingPending ? 'Loading...' : 'Load Pending' }}
294
+ </button>
295
+ <div v-if="pendingData" class="cpub-fed-tool-result">
296
+ <p>{{ pendingData.count }} pending activities</p>
297
+ <div v-if="pendingData.activities.length" class="cpub-fed-activity-list" style="margin-top: 8px;">
298
+ <div v-for="act in pendingData.activities" :key="act.id" class="cpub-fed-activity-row">
299
+ <span class="cpub-fed-type">{{ act.activityType }}</span>
300
+ <span class="cpub-fed-actor">{{ act.objectUri }}</span>
301
+ <time class="cpub-fed-time">{{ new Date(act.createdAt).toLocaleString() }}</time>
302
+ </div>
303
+ </div>
304
+ </div>
305
+ </div>
306
+
307
+ <!-- Repair Content Types -->
308
+ <div class="cpub-fed-tool-card">
309
+ <h3 class="cpub-fed-tool-title"><i class="fa-solid fa-wrench"></i> Repair Content Types</h3>
310
+ <p class="cpub-fed-tool-desc">Re-fetch source objects for federated content with missing <code>cpub:type</code> and update them. Fixes items backfilled before type extension was added.</p>
311
+ <button class="cpub-fed-btn" :disabled="repairing" @click="repairTypes">
312
+ {{ repairing ? 'Repairing...' : 'Repair Types' }}
313
+ </button>
314
+ <div v-if="repairResult" class="cpub-fed-tool-result">
315
+ Checked {{ repairResult.total }} items, updated {{ repairResult.updated }}, {{ repairResult.errors }} errors.
316
+ </div>
317
+ </div>
318
+
319
+ <!-- Re-federate All Content + Hub Posts -->
320
+ <div class="cpub-fed-tool-card">
321
+ <h3 class="cpub-fed-tool-title"><i class="fa-solid fa-rotate"></i> Re-federate All</h3>
322
+ <p class="cpub-fed-tool-desc">Queue all published content (Create) and hub posts (Announce) for re-delivery. Safe to run multiple times.</p>
323
+ <button class="cpub-fed-btn" :disabled="refederating" @click="refederate">
324
+ {{ refederating ? 'Queuing...' : 'Re-federate All' }}
325
+ </button>
326
+ <div v-if="refederateResult" class="cpub-fed-tool-result">
327
+ Queued {{ refederateResult.queued }} items for delivery.
328
+ <span v-if="refederateResult.content !== undefined" style="display: block; font-size: 12px; color: var(--text-faint); margin-top: 4px">
329
+ {{ refederateResult.content }} content, {{ refederateResult.hubs ?? 0 }}/{{ refederateResult.hubsFound ?? '?' }} hubs announced, {{ refederateResult.hubPosts ?? 0 }} hub posts
330
+ </span>
331
+ </div>
332
+ </div>
333
+ </div>
334
+ </div>
335
+ </div>
336
+ </template>
337
+
338
+ <style scoped>
339
+ .cpub-admin-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
340
+
341
+ .cpub-fed-stats {
342
+ display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; margin-bottom: 24px;
343
+ }
344
+ .cpub-fed-stat {
345
+ padding: 16px; background: var(--surface); border: var(--border-width-default) solid var(--border);
346
+ display: flex; flex-direction: column; align-items: center; gap: 4px;
347
+ box-shadow: var(--shadow-md);
348
+ }
349
+ .cpub-fed-stat-val { font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); }
350
+ .cpub-fed-stat-label {
351
+ font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
352
+ color: var(--text-dim); font-family: var(--font-mono);
353
+ }
354
+
355
+ .cpub-fed-tabs {
356
+ display: flex; gap: 0; margin-bottom: 16px; border-bottom: var(--border-width-default) solid var(--border);
357
+ }
358
+ .cpub-fed-tabs button {
359
+ padding: 8px 16px; font-family: var(--font-mono); font-size: 11px; font-weight: 600;
360
+ text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
361
+ background: transparent; border: none; color: var(--text-dim);
362
+ border-bottom: var(--border-width-default) solid transparent; margin-bottom: -2px;
363
+ }
364
+ .cpub-fed-tabs button.active {
365
+ color: var(--accent); border-bottom-color: var(--accent);
366
+ }
367
+
368
+ .cpub-fed-form {
369
+ display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
370
+ }
371
+ .cpub-fed-input {
372
+ flex: 1; padding: 8px 12px; font-family: var(--font-mono); font-size: 0.8125rem;
373
+ border: var(--border-width-default) solid var(--border); background: var(--surface); color: var(--text);
374
+ }
375
+ .cpub-fed-btn {
376
+ padding: 8px 16px; font-family: var(--font-mono); font-size: 11px; font-weight: 600;
377
+ text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
378
+ background: var(--accent); color: var(--color-text-inverse); border: var(--border-width-default) solid var(--accent);
379
+ box-shadow: var(--shadow-sm); transition: box-shadow 0.15s, transform 0.15s;
380
+ }
381
+ .cpub-fed-btn:hover { box-shadow: none; transform: translate(2px, 2px); }
382
+ .cpub-fed-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
383
+ .cpub-fed-btn-sm {
384
+ padding: 2px 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
385
+ text-transform: uppercase; cursor: pointer; background: transparent;
386
+ border: var(--border-width-default) solid var(--border); color: var(--text-dim);
387
+ }
388
+ .cpub-fed-btn-sm:hover { border-color: var(--accent); color: var(--accent); }
389
+ .cpub-fed-btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
390
+ .cpub-fed-btn-danger:hover { border-color: var(--red); color: var(--red); }
391
+
392
+ .cpub-fed-activity-list {
393
+ border: var(--border-width-default) solid var(--border); overflow: hidden;
394
+ box-shadow: var(--shadow-md);
395
+ }
396
+ .cpub-fed-empty { padding: 24px; text-align: center; color: var(--text-faint); font-size: 0.8125rem; }
397
+ .cpub-fed-activity-row {
398
+ display: flex; align-items: center; gap: 10px; padding: 10px 14px;
399
+ border-bottom: var(--border-width-default) solid var(--border); font-size: 0.75rem;
400
+ }
401
+ .cpub-fed-activity-row:last-child { border-bottom: none; }
402
+ .cpub-fed-dir {
403
+ font-size: 10px; font-weight: 700; padding: 2px 6px;
404
+ text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono);
405
+ border: var(--border-width-default) solid var(--border);
406
+ }
407
+ .cpub-fed-dir.inbound { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-border); }
408
+ .cpub-fed-dir.outbound { background: var(--surface2); color: var(--text-dim); }
409
+ .cpub-fed-type { font-weight: 600; color: var(--text); min-width: 60px; font-family: var(--font-mono); }
410
+ .cpub-fed-actor { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font-family: var(--font-mono); }
411
+ .cpub-fed-status { font-size: 10px; font-weight: 600; padding: 2px 6px; text-transform: uppercase; font-family: var(--font-mono); border: var(--border-width-default) solid var(--border); }
412
+ .cpub-fed-status.delivered, .cpub-fed-status.processed, .cpub-fed-status.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-bg); }
413
+ .cpub-fed-status.pending { color: var(--text-dim); }
414
+ .cpub-fed-status.paused { color: var(--text-dim); background: var(--surface2); }
415
+ .cpub-fed-status.failed { color: var(--red); border-color: var(--red); }
416
+ .cpub-fed-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); white-space: nowrap; }
417
+ .cpub-fed-error { font-size: 10px; color: var(--red); font-family: var(--font-mono); cursor: help; }
418
+ .cpub-fed-info-text { font-size: 0.75rem; color: var(--text-dim); margin-top: 12px; }
419
+ .cpub-fed-info-text code { font-family: var(--font-mono); background: var(--surface2); padding: 1px 4px; }
420
+
421
+ .cpub-fed-result {
422
+ margin-top: 8px; padding: 10px 14px; font-size: 0.8125rem; font-family: var(--font-mono);
423
+ background: var(--accent-bg); border: var(--border-width-default) solid var(--accent-border); color: var(--text);
424
+ }
425
+
426
+ /* Tools tab */
427
+ .cpub-fed-tools { display: flex; flex-direction: column; gap: 16px; }
428
+ .cpub-fed-tool-card {
429
+ padding: 20px; background: var(--surface); border: var(--border-width-default) solid var(--border);
430
+ box-shadow: var(--shadow-sm);
431
+ }
432
+ .cpub-fed-tool-title {
433
+ font-family: var(--font-mono); font-size: 0.875rem; font-weight: 700;
434
+ text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
435
+ display: flex; align-items: center; gap: 8px;
436
+ }
437
+ .cpub-fed-tool-title i { color: var(--accent); }
438
+ .cpub-fed-tool-desc {
439
+ font-size: 0.8125rem; color: var(--text-dim); margin-bottom: 12px; line-height: 1.5;
440
+ }
441
+ .cpub-fed-tool-desc code { font-family: var(--font-mono); background: var(--surface2); padding: 1px 4px; }
442
+ .cpub-fed-tool-result {
443
+ margin-top: 10px; padding: 10px 14px; font-size: 0.8125rem; font-family: var(--font-mono);
444
+ background: var(--accent-bg); border: var(--border-width-default) solid var(--accent-border); color: var(--text);
445
+ }
446
+ </style>
@@ -0,0 +1,62 @@
1
+ <script setup lang="ts">
2
+ definePageMeta({ layout: 'admin', middleware: 'auth' });
3
+ useSeoMeta({ title: `Admin Dashboard — ${useSiteName()}` });
4
+
5
+ const { data: stats } = await useFetch('/api/admin/stats');
6
+ </script>
7
+
8
+ <template>
9
+ <div class="cpub-admin-dashboard">
10
+ <h1 class="cpub-admin-title">Platform Dashboard</h1>
11
+
12
+ <div class="cpub-stats-grid" v-if="stats">
13
+ <div class="cpub-stat-card" v-for="stat in [
14
+ { label: 'Users', value: stats.users?.total ?? 0, icon: 'fa-solid fa-users' },
15
+ { label: 'Content', value: stats.content?.total ?? 0, icon: 'fa-solid fa-file-lines' },
16
+ { label: 'Communities', value: stats.hubs?.total ?? 0, icon: 'fa-solid fa-people-group' },
17
+ { label: 'Reports', value: stats.reports?.pending ?? 0, icon: 'fa-solid fa-flag' },
18
+ ]" :key="stat.label">
19
+ <i :class="[stat.icon, 'cpub-stat-icon']"></i>
20
+ <span class="cpub-stat-value">{{ stat.value }}</span>
21
+ <span class="cpub-stat-label">{{ stat.label }}</span>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="cpub-admin-quick-links">
26
+ <h2 class="cpub-admin-section-title">Quick Actions</h2>
27
+ <div class="cpub-admin-actions-grid">
28
+ <NuxtLink to="/admin/users" class="cpub-admin-action">
29
+ <i class="fa-solid fa-user-gear cpub-admin-action-icon"></i>
30
+ <span class="cpub-admin-action-label">Manage Users</span>
31
+ </NuxtLink>
32
+ <NuxtLink to="/admin/reports" class="cpub-admin-action">
33
+ <i class="fa-solid fa-flag cpub-admin-action-icon"></i>
34
+ <span class="cpub-admin-action-label">Review Reports</span>
35
+ </NuxtLink>
36
+ <NuxtLink to="/admin/content" class="cpub-admin-action">
37
+ <i class="fa-solid fa-newspaper cpub-admin-action-icon"></i>
38
+ <span class="cpub-admin-action-label">Manage Content</span>
39
+ </NuxtLink>
40
+ <NuxtLink to="/admin/settings" class="cpub-admin-action">
41
+ <i class="fa-solid fa-gear cpub-admin-action-icon"></i>
42
+ <span class="cpub-admin-action-label">Instance Settings</span>
43
+ </NuxtLink>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <style scoped>
50
+ .cpub-admin-title { font-size: var(--text-xl); font-weight: var(--font-weight-bold); margin-bottom: var(--space-6); }
51
+ .cpub-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-8); }
52
+ .cpub-stat-card { padding: var(--space-5); background: var(--surface); border: var(--border-width-default) solid var(--border); box-shadow: var(--shadow-md); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
53
+ .cpub-stat-icon { font-size: var(--text-xl); color: var(--text-dim); margin-bottom: var(--space-1); }
54
+ .cpub-stat-value { font-size: var(--text-3xl); font-weight: var(--font-weight-bold); font-family: var(--font-mono); }
55
+ .cpub-stat-label { font-family: var(--font-mono); font-size: 10px; font-weight: var(--font-weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-widest); color: var(--text-dim); }
56
+ .cpub-admin-section-title { font-size: var(--text-lg); font-weight: var(--font-weight-bold); margin-bottom: var(--space-4); }
57
+ .cpub-admin-actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
58
+ .cpub-admin-action { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-5); background: var(--surface); border: var(--border-width-default) solid var(--border); text-decoration: none; color: var(--text); transition: all 0.15s; }
59
+ .cpub-admin-action:hover { background: var(--surface2); box-shadow: var(--shadow-md); transform: translate(-1px, -1px); }
60
+ .cpub-admin-action-icon { font-size: var(--text-xl); color: var(--text-dim); }
61
+ .cpub-admin-action-label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-dim); }
62
+ </style>