@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,212 @@
1
+ <script setup lang="ts">
2
+ const route = useRoute();
3
+ const videoId = computed(() => route.params.id as string);
4
+
5
+ // Video API may return enriched data beyond the base VideoDetail type
6
+ const { data: video } = useLazyFetch<any>(() => `/api/videos/${videoId.value}`);
7
+
8
+ useSeoMeta({
9
+ title: () => video.value?.title ? `${video.value.title} — ${useSiteName()}` : `Video — ${useSiteName()}`,
10
+ description: () => video.value?.description ?? '',
11
+ });
12
+
13
+ // Track view — GET already handles view counting server-side
14
+ // No separate POST needed (the server route increments viewCount on GET)
15
+
16
+ function buildEmbedUrl(url: string): string | null {
17
+ const ytMatch = url.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);
18
+ if (ytMatch) return `https://www.youtube.com/embed/${ytMatch[1]}`;
19
+ const vimeoMatch = url.match(/vimeo\.com\/(\d+)/);
20
+ if (vimeoMatch) return `https://player.vimeo.com/video/${vimeoMatch[1]}`;
21
+ return null;
22
+ }
23
+
24
+ const videoEmbedUrl = computed(() => {
25
+ const url = video.value?.embedUrl || video.value?.url;
26
+ return url ? buildEmbedUrl(url) : null;
27
+ });
28
+
29
+ const categoryName = computed(() => {
30
+ const cat = video.value?.category;
31
+ if (!cat) return null;
32
+ return typeof cat === 'string' ? cat : cat.name;
33
+ });
34
+
35
+ const authorInitial = computed(() => {
36
+ const a = video.value?.author;
37
+ return (a?.displayName || a?.username || 'U').charAt(0).toUpperCase();
38
+ });
39
+ </script>
40
+
41
+ <template>
42
+ <div v-if="video" class="cpub-video-page">
43
+ <!-- Video player -->
44
+ <div class="cpub-video-player">
45
+ <iframe
46
+ v-if="videoEmbedUrl"
47
+ :src="videoEmbedUrl"
48
+ class="cpub-video-iframe"
49
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
50
+ allowfullscreen
51
+ :title="video.title || 'Video'"
52
+ />
53
+ <div v-else class="cpub-video-placeholder">
54
+ <i class="fa-solid fa-play"></i>
55
+ <p>Video preview not available</p>
56
+ <a v-if="video.url" :href="video.url" target="_blank" rel="noopener" class="cpub-link">Open video link</a>
57
+ </div>
58
+ </div>
59
+
60
+ <!-- Video info -->
61
+ <div class="cpub-video-info">
62
+ <h1 class="cpub-video-title">{{ video.title }}</h1>
63
+ <div class="cpub-video-meta">
64
+ <span v-if="categoryName"><i class="fa-solid fa-tag"></i> {{ categoryName }}</span>
65
+ <span><i class="fa-regular fa-eye"></i> {{ (video.viewCount ?? 0).toLocaleString() }} views</span>
66
+ <span v-if="video.duration"><i class="fa-regular fa-clock"></i> {{ video.duration }}</span>
67
+ <span v-if="video.createdAt">{{ new Date(video.createdAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) }}</span>
68
+ </div>
69
+ <p v-if="video.description" class="cpub-video-desc">{{ video.description }}</p>
70
+
71
+ <!-- Author -->
72
+ <div v-if="video.author" class="cpub-video-author">
73
+ <div class="cpub-video-author-av">
74
+ <img v-if="video.author.avatarUrl" :src="video.author.avatarUrl" :alt="video.author.displayName || video.author.username" class="cpub-video-author-av-img" />
75
+ <span v-else>{{ authorInitial }}</span>
76
+ </div>
77
+ <div>
78
+ <NuxtLink
79
+ v-if="video.author.username"
80
+ :to="`/u/${video.author.username}`"
81
+ class="cpub-video-author-name"
82
+ >
83
+ {{ video.author.displayName ?? video.author.username }}
84
+ </NuxtLink>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ <div v-else class="cpub-empty-state" style="padding: 64px">
90
+ <p class="cpub-empty-state-title">Video not found</p>
91
+ </div>
92
+ </template>
93
+
94
+ <style scoped>
95
+ .cpub-video-page {
96
+ max-width: 960px;
97
+ }
98
+
99
+ .cpub-video-player {
100
+ width: 100%;
101
+ aspect-ratio: 16/9;
102
+ background: var(--text);
103
+ border: var(--border-width-default) solid var(--border);
104
+ box-shadow: var(--shadow-md);
105
+ margin-bottom: 20px;
106
+ overflow: hidden;
107
+ }
108
+
109
+ .cpub-video-iframe {
110
+ width: 100%;
111
+ height: 100%;
112
+ border: none;
113
+ }
114
+
115
+ .cpub-video-placeholder {
116
+ width: 100%;
117
+ height: 100%;
118
+ display: flex;
119
+ flex-direction: column;
120
+ align-items: center;
121
+ justify-content: center;
122
+ gap: 10px;
123
+ color: var(--surface3);
124
+ }
125
+
126
+ .cpub-video-placeholder i {
127
+ font-size: 48px;
128
+ }
129
+
130
+ .cpub-video-placeholder p {
131
+ font-size: 13px;
132
+ }
133
+
134
+ .cpub-video-info {
135
+ background: var(--surface);
136
+ border: var(--border-width-default) solid var(--border);
137
+ padding: 20px;
138
+ }
139
+
140
+ .cpub-video-title {
141
+ font-size: 20px;
142
+ font-weight: 700;
143
+ margin-bottom: 8px;
144
+ }
145
+
146
+ .cpub-video-meta {
147
+ display: flex;
148
+ align-items: center;
149
+ gap: 16px;
150
+ font-size: 11px;
151
+ font-family: var(--font-mono);
152
+ color: var(--text-faint);
153
+ margin-bottom: 14px;
154
+ }
155
+
156
+ .cpub-video-meta i {
157
+ margin-right: 4px;
158
+ }
159
+
160
+ .cpub-video-desc {
161
+ font-size: 14px;
162
+ color: var(--text-dim);
163
+ line-height: 1.7;
164
+ margin-bottom: 20px;
165
+ }
166
+
167
+ .cpub-video-author {
168
+ display: flex;
169
+ align-items: center;
170
+ gap: 10px;
171
+ padding-top: 14px;
172
+ border-top: var(--border-width-default) solid var(--border);
173
+ }
174
+
175
+ .cpub-video-author-av {
176
+ width: 36px;
177
+ height: 36px;
178
+ border-radius: 50%;
179
+ background: var(--surface3);
180
+ border: var(--border-width-default) solid var(--border);
181
+ display: flex;
182
+ align-items: center;
183
+ justify-content: center;
184
+ font-family: var(--font-mono);
185
+ font-size: 13px;
186
+ font-weight: 600;
187
+ color: var(--text-dim);
188
+ overflow: hidden;
189
+ }
190
+
191
+ .cpub-video-author-av-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
192
+
193
+ .cpub-video-author-name {
194
+ font-size: 13px;
195
+ font-weight: 600;
196
+ color: var(--text);
197
+ text-decoration: none;
198
+ }
199
+
200
+ .cpub-video-author-name:hover {
201
+ color: var(--accent);
202
+ }
203
+
204
+ .cpub-link {
205
+ color: var(--accent);
206
+ text-decoration: none;
207
+ }
208
+
209
+ .cpub-link:hover {
210
+ text-decoration: underline;
211
+ }
212
+ </style>
@@ -0,0 +1,327 @@
1
+ <script setup lang="ts">
2
+ useSeoMeta({ title: `Video Hub — ${useSiteName()}` });
3
+
4
+ const activeFilter = ref('');
5
+ const sortOption = ref('recent');
6
+
7
+ const { data: categories } = await useFetch<Array<{ id: string; name: string; slug: string }>>('/api/videos/categories');
8
+ const page = ref(1);
9
+ const pageSize = 20;
10
+
11
+ // Reset page on filter change
12
+ watch([activeFilter, sortOption], () => { page.value = 1; });
13
+
14
+ const { data: videosData, pending: loadingVideos } = useFetch<{ items: any[]; total: number }>('/api/videos', {
15
+ query: computed(() => ({
16
+ categoryId: activeFilter.value || undefined,
17
+ sort: sortOption.value,
18
+ limit: pageSize,
19
+ offset: (page.value - 1) * pageSize,
20
+ })),
21
+ watch: [activeFilter, sortOption, page],
22
+ });
23
+
24
+ const videos = computed(() => videosData.value?.items ?? []);
25
+ const totalVideos = computed(() => videosData.value?.total ?? 0);
26
+
27
+ const filterOptions = computed(() => {
28
+ const cats = categories.value ?? [];
29
+ return [{ id: '', name: 'All' }, ...cats];
30
+ });
31
+
32
+ function formatDuration(seconds: number | null): string {
33
+ if (!seconds) return '0:00';
34
+ const h = Math.floor(seconds / 3600);
35
+ const m = Math.floor((seconds % 3600) / 60);
36
+ const s = seconds % 60;
37
+ if (h > 0) return `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`;
38
+ return `${m}:${String(s).padStart(2, '0')}`;
39
+ }
40
+
41
+ function formatDate(dateStr: string): string {
42
+ return new Date(dateStr).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
43
+ }
44
+
45
+ </script>
46
+
47
+ <template>
48
+ <div class="cpub-videos">
49
+
50
+ <!-- HERO -->
51
+ <div class="cpub-video-hero">
52
+ <div class="cpub-video-hero-inner">
53
+ <div class="cpub-hero-eyebrow"><i class="fa-solid fa-play-circle"></i> &nbsp;Video Hub</div>
54
+ <div class="cpub-hero-row">
55
+ <h1 class="cpub-hero-title">Video Hub</h1>
56
+ <span class="cpub-tag cpub-tag-live"><i class="fa-solid fa-circle" style="font-size:8px;"></i> Beta</span>
57
+ </div>
58
+ <p class="cpub-hero-sub">Tutorials, conference talks, project demos, and live build streams from the community.</p>
59
+ <div class="cpub-hero-actions">
60
+ <NuxtLink to="/videos/submit" class="cpub-btn cpub-btn-primary" style="text-decoration:none;"><i class="fa-solid fa-upload"></i> Submit Video</NuxtLink>
61
+ </div>
62
+ </div>
63
+ </div>
64
+
65
+ <!-- FILTER BAR -->
66
+ <div class="cpub-filter-bar">
67
+ <button
68
+ v-for="f in filterOptions"
69
+ :key="f.id"
70
+ class="cpub-fchip"
71
+ :class="{ active: activeFilter === f.id }"
72
+ @click="activeFilter = f.id"
73
+ >{{ f.name }}</button>
74
+ <div class="cpub-filter-right">
75
+ <select v-model="sortOption" class="cpub-sort-select">
76
+ <option value="recent">Sort: Most Recent</option>
77
+ <option value="viewed">Sort: Most Viewed</option>
78
+ <option value="rated">Sort: Top Rated</option>
79
+ <option value="shortest">Sort: Shortest First</option>
80
+ </select>
81
+ </div>
82
+ </div>
83
+
84
+ <!-- MAIN -->
85
+ <div class="cpub-page-wrap">
86
+ <div class="cpub-main-grid">
87
+
88
+ <!-- LEFT COLUMN -->
89
+ <div>
90
+ <!-- FEATURED VIDEO (most viewed) -->
91
+ <div v-if="videos.length" class="cpub-featured-section">
92
+ <div class="cpub-sec-head">
93
+ <h2>Featured</h2>
94
+ </div>
95
+ <NuxtLink :to="`/videos/${videos[0].id}`" class="cpub-featured-player" style="text-decoration: none; display: block;">
96
+ <div class="cpub-featured-player-bg">
97
+ <div class="cpub-featured-bg-gradient"></div>
98
+ <div class="cpub-featured-bg-grid"></div>
99
+ <div class="cpub-featured-player-icon"><i class="fa-solid fa-video"></i></div>
100
+ </div>
101
+ <div class="cpub-play-overlay">
102
+ <div class="cpub-play-circle"><i class="fa fa-play"></i></div>
103
+ </div>
104
+ <div v-if="videos[0].duration" class="cpub-featured-duration">{{ formatDuration(videos[0].duration) }}</div>
105
+ </NuxtLink>
106
+ <div class="cpub-featured-info">
107
+ <NuxtLink :to="`/videos/${videos[0].id}`" class="cpub-featured-title" style="text-decoration: none; color: inherit;">{{ videos[0].title }}</NuxtLink>
108
+ <div class="cpub-featured-stats">
109
+ <span><i class="fa-solid fa-eye"></i> {{ videos[0].viewCount.toLocaleString() }} views</span>
110
+ <span>·</span>
111
+ <span>{{ formatDate(videos[0].createdAt) }}</span>
112
+ </div>
113
+ </div>
114
+ </div>
115
+
116
+ <hr v-if="videos.length" class="cpub-divider" style="margin:20px 0;" />
117
+
118
+ <!-- VIDEO GRID -->
119
+ <div class="cpub-sec-head">
120
+ <h2>Recent Videos</h2>
121
+ <span class="cpub-sec-sub">{{ totalVideos }} videos</span>
122
+ </div>
123
+
124
+ <!-- Loading skeleton -->
125
+ <div v-if="loadingVideos" class="cpub-video-grid">
126
+ <div v-for="i in 4" :key="i" class="cpub-vcard">
127
+ <div class="cpub-vcard-thumb" style="background: var(--surface2)">
128
+ <div class="cpub-vcard-thumb-overlay"></div>
129
+ </div>
130
+ <div class="cpub-vcard-body">
131
+ <div class="cpub-vcard-title" style="background: var(--surface2); height: 14px; width: 80%;"></div>
132
+ <div class="cpub-vcard-stats" style="background: var(--surface2); height: 10px; width: 50%; margin-top: 8px;"></div>
133
+ </div>
134
+ </div>
135
+ </div>
136
+
137
+ <!-- Real data -->
138
+ <div v-else-if="videos.length" class="cpub-video-grid">
139
+ <NuxtLink v-for="v in videos" :key="v.id" :to="`/videos/${v.id}`" style="text-decoration: none;">
140
+ <VideoCard :video="v" />
141
+ </NuxtLink>
142
+ </div>
143
+
144
+ <!-- Empty state -->
145
+ <div v-else class="cpub-empty-state">
146
+ <div class="cpub-empty-icon"><i class="fa-solid fa-film"></i></div>
147
+ <p class="cpub-empty-title">No videos yet</p>
148
+ <p class="cpub-empty-sub">Be the first to upload a video to the community.</p>
149
+ </div>
150
+
151
+ <!-- Pagination -->
152
+ <div v-if="totalVideos > pageSize" class="cpub-pagination">
153
+ <button class="cpub-page-btn" :disabled="page <= 1" @click="page--">
154
+ <i class="fa-solid fa-chevron-left" style="font-size: 10px"></i>
155
+ </button>
156
+ <span class="cpub-page-info">Page {{ page }} of {{ Math.ceil(totalVideos / pageSize) }}</span>
157
+ <button class="cpub-page-btn" :disabled="page >= Math.ceil(totalVideos / pageSize)" @click="page++">
158
+ <i class="fa-solid fa-chevron-right" style="font-size: 10px"></i>
159
+ </button>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- SIDEBAR -->
164
+ <aside class="cpub-sidebar">
165
+
166
+ <!-- CATEGORIES -->
167
+ <div class="cpub-sb-block">
168
+ <div class="cpub-sb-block-head">
169
+ <div class="cpub-sb-block-title">Categories</div>
170
+ </div>
171
+ <template v-if="categories?.length">
172
+ <div v-for="cat in categories" :key="cat.id" class="cpub-playlist-item" style="cursor: pointer;" @click="activeFilter = cat.id">
173
+ <div class="cpub-playlist-info">
174
+ <div class="cpub-playlist-title">{{ cat.name }}</div>
175
+ </div>
176
+ </div>
177
+ </template>
178
+ <div v-else style="padding: 14px 16px; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono);">
179
+ No categories yet
180
+ </div>
181
+ </div>
182
+
183
+ <!-- STATS -->
184
+ <div class="cpub-sb-block">
185
+ <div class="cpub-sb-block-head">
186
+ <div class="cpub-sb-block-title">Video Stats</div>
187
+ </div>
188
+ <div style="padding: 14px 16px; font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);">
189
+ {{ totalVideos }} total videos
190
+ </div>
191
+ </div>
192
+
193
+ </aside>
194
+
195
+ </div>
196
+ </div>
197
+
198
+ </div>
199
+ </template>
200
+
201
+ <style scoped>
202
+ /* HERO */
203
+ .cpub-video-hero { background: var(--surface); border-bottom: var(--border-width-default) solid var(--border); padding: 32px 32px 28px; }
204
+ .cpub-video-hero-inner { max-width: 1200px; margin: 0 auto; }
205
+ /* cpub-hero-eyebrow → global components.css */
206
+ .cpub-hero-row { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
207
+ .cpub-hero-title { font-size: 28px; font-weight: 700; letter-spacing: -.03em; font-family: var(--font-mono); }
208
+ .cpub-hero-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
209
+ .cpub-hero-actions { display: flex; align-items: center; gap: 10px; }
210
+
211
+ /* TAGS (page-specific) */
212
+ .cpub-tag-live { background: var(--red); border-color: var(--red); color: var(--color-text-inverse); font-family: var(--font-mono); animation: cpub-livepulse 2s infinite; }
213
+ @keyframes cpub-livepulse { 0%,100% { opacity: 1; } 50% { opacity: .75; } }
214
+
215
+ /* FILTER BAR */
216
+ .cpub-filter-bar { background: var(--surface); border-bottom: var(--border-width-default) solid var(--border); padding: 0 32px; display: flex; align-items: center; gap: 6px; position: sticky; top: 48px; z-index: 50; overflow-x: auto; scrollbar-width: none; }
217
+ .cpub-filter-bar::-webkit-scrollbar { display: none; }
218
+ .cpub-fchip { font-size: 11px; font-family: var(--font-mono); padding: 12px 14px; border-bottom: 3px solid transparent; color: var(--text-dim); cursor: pointer; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none; }
219
+ .cpub-fchip:hover { color: var(--text); }
220
+ .cpub-fchip.active { color: var(--accent); border-bottom-color: var(--accent); }
221
+ .cpub-filter-right { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 8px 0; }
222
+ .cpub-sort-select { font-size: 11px; font-family: var(--font-mono); padding: 5px 12px; border-radius: var(--radius); border: var(--border-width-default) solid var(--border); background: var(--surface); color: var(--text-dim); cursor: pointer; outline: none; }
223
+
224
+ /* LAYOUT */
225
+ .cpub-page-wrap { max-width: 1200px; margin: 0 auto; padding: 28px 32px; }
226
+ .cpub-main-grid { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
227
+ /* cpub-sec-sub, cpub-sec-head-right → global components.css */
228
+ .cpub-view-all-link { font-size: 11px; color: var(--accent); font-family: var(--font-mono); text-decoration: none; }
229
+ .cpub-view-all-link:hover { text-decoration: underline; }
230
+
231
+ /* FEATURED VIDEO */
232
+ .cpub-featured-section { margin-bottom: 24px; }
233
+ .cpub-featured-player { background: var(--surface3); border: var(--border-width-default) solid var(--border); border-radius: var(--radius); aspect-ratio: 16/9; position: relative; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-md); }
234
+ .cpub-featured-player-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
235
+ .cpub-featured-bg-grid { position: absolute; inset: 0; background-image: repeating-linear-gradient(0deg, var(--border2) 0, var(--border2) 1px, transparent 1px, transparent 32px), repeating-linear-gradient(90deg, var(--border2) 0, var(--border2) 1px, transparent 1px, transparent 32px); opacity: .3; }
236
+ .cpub-featured-bg-gradient { position: absolute; inset: 0; background: var(--surface3); }
237
+ .cpub-featured-player-icon { font-size: 48px; position: relative; z-index: 2; opacity: .25; color: var(--text-dim); }
238
+ .cpub-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 3; }
239
+ .cpub-play-circle { width: 68px; height: 68px; border-radius: 0; background: var(--surface); border: var(--border-width-default) solid var(--border); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); transition: background .15s; }
240
+ .cpub-featured-player:hover .cpub-play-circle { background: var(--accent-bg); border-color: var(--accent); }
241
+ .cpub-play-circle i { font-size: 22px; color: var(--text); margin-left: 3px; }
242
+ .cpub-featured-duration { position: absolute; bottom: 12px; right: 12px; font-size: 11px; font-family: var(--font-mono); background: var(--surface); color: var(--text); padding: 3px 8px; border: var(--border-width-default) solid var(--border); z-index: 4; }
243
+ .cpub-featured-quality { position: absolute; bottom: 12px; left: 12px; z-index: 4; }
244
+ .cpub-featured-info { margin-top: 16px; }
245
+ .cpub-featured-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
246
+ .cpub-featured-meta-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
247
+ .cpub-featured-author { display: flex; align-items: center; gap: 8px; }
248
+ .cpub-featured-author-av { width: 24px; height: 24px; border-radius: 50%; background: var(--surface2); border: var(--border-width-default) solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 9px; font-family: var(--font-mono); color: var(--text-dim); flex-shrink: 0; }
249
+ .cpub-featured-author-name { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }
250
+ .cpub-featured-stats { display: flex; align-items: center; gap: 10px; font-size: 11px; font-family: var(--font-mono); color: var(--text-faint); }
251
+ .cpub-featured-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; max-width: 640px; }
252
+
253
+ /* VIDEO GRID */
254
+ .cpub-video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
255
+ .cpub-vcard { background: var(--surface); border: var(--border-width-default) solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color .15s; box-shadow: var(--shadow-md); }
256
+ .cpub-vcard:hover { border-color: var(--accent); }
257
+ .cpub-vcard:hover .cpub-vcard-title { color: var(--accent); }
258
+ .cpub-vcard-thumb { aspect-ratio: 16/9; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; border-bottom: var(--border-width-default) solid var(--border); }
259
+ .cpub-vcard-thumb-overlay { position: absolute; inset: 0; background: var(--surface3); opacity: .5; }
260
+ .cpub-vcard-thumb-icon { font-size: 24px; position: relative; z-index: 1; opacity: .3; color: var(--text-dim); }
261
+ .cpub-vcard-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2; opacity: 0; transition: opacity .15s; }
262
+ .cpub-vcard:hover .cpub-vcard-play { opacity: 1; }
263
+ .cpub-vcard-play-btn { width: 38px; height: 38px; border-radius: 0; background: var(--surface); border: var(--border-width-default) solid var(--border); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }
264
+ .cpub-vcard-play-btn i { font-size: 13px; color: var(--text); margin-left: 2px; }
265
+ .cpub-vcard-duration { position: absolute; bottom: 8px; right: 8px; font-size: 10px; font-family: var(--font-mono); background: var(--surface); color: var(--text); padding: 2px 7px; border: var(--border-width-default) solid var(--border); z-index: 3; }
266
+ .cpub-vcard-type { position: absolute; top: 8px; left: 8px; z-index: 3; }
267
+ .cpub-vcard-body { padding: 12px 14px; }
268
+ .cpub-vcard-title { font-size: 12px; font-weight: 600; line-height: 1.35; margin-bottom: 7px; transition: color .1s; }
269
+ .cpub-vcard-author-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
270
+ .cpub-vcard-av { width: 18px; height: 18px; border-radius: 50%; background: var(--surface2); border: var(--border-width-default) solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 7px; font-family: var(--font-mono); color: var(--text-faint); flex-shrink: 0; }
271
+ .cpub-vcard-author { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
272
+ .cpub-vcard-stats { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); display: flex; align-items: center; gap: 8px; }
273
+
274
+ /* SIDEBAR */
275
+ .cpub-sidebar { display: flex; flex-direction: column; gap: 0; }
276
+ .cpub-sb-block { background: var(--surface); border: var(--border-width-default) solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow-md); }
277
+ .cpub-sb-block-head { padding: 14px 16px; border-bottom: var(--border-width-default) solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--surface2); }
278
+ .cpub-sb-block-title { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text); font-family: var(--font-mono); display: flex; align-items: center; gap: 6px; }
279
+ .cpub-sb-block-link { font-size: 10px; font-family: var(--font-mono); color: var(--accent); text-decoration: none; }
280
+ .cpub-sb-block-link:hover { text-decoration: underline; }
281
+
282
+ /* LIVE NOW */
283
+ .cpub-live-item { padding: 12px 16px; border-bottom: var(--border-width-default) solid var(--border2); cursor: pointer; }
284
+ .cpub-live-item:last-child { border-bottom: none; }
285
+ .cpub-live-item:hover .cpub-live-title { color: var(--accent); }
286
+ .cpub-live-item-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
287
+ .cpub-live-thumb { width: 56px; height: 38px; border-radius: var(--radius); border: var(--border-width-default) solid var(--border); background: var(--red-bg); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; position: relative; overflow: hidden; }
288
+ .cpub-live-thumb-bg { position: absolute; inset: 0; background: var(--red-bg); }
289
+ .cpub-live-thumb-icon { position: relative; z-index: 1; color: var(--red); }
290
+ .cpub-live-title { font-size: 12px; font-weight: 600; line-height: 1.3; transition: color .1s; }
291
+ .cpub-live-meta { display: flex; align-items: center; gap: 8px; font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); }
292
+ .cpub-live-viewers { display: flex; align-items: center; gap: 4px; color: var(--red); }
293
+ .cpub-live-viewers::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: cpub-livepulse 1.5s infinite; }
294
+
295
+ /* PLAYLISTS */
296
+ .cpub-playlist-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: var(--border-width-default) solid var(--border2); cursor: pointer; align-items: center; }
297
+ .cpub-playlist-item:last-child { border-bottom: none; }
298
+ .cpub-playlist-item:hover .cpub-playlist-title { color: var(--accent); }
299
+ .cpub-playlist-thumb-stack { width: 52px; height: 38px; position: relative; flex-shrink: 0; }
300
+ .cpub-pls-layer { position: absolute; border-radius: var(--radius); border: var(--border-width-default) solid var(--border); background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 11px; }
301
+ .cpub-pls-layer-1 { width: 100%; height: 100%; left: 0; top: 0; background: var(--surface3); }
302
+ .cpub-pls-layer-2 { width: 92%; height: 88%; left: 4%; top: -4px; background: var(--surface2); z-index: 1; }
303
+ .cpub-pls-layer-3 { width: 86%; height: 76%; left: 7%; top: -7px; background: var(--border2); z-index: 0; }
304
+ .cpub-pls-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2; font-size: 14px; color: var(--text-dim); }
305
+ .cpub-playlist-info { flex: 1; }
306
+ .cpub-playlist-title { font-size: 12px; font-weight: 600; margin-bottom: 2px; transition: color .1s; }
307
+ .cpub-playlist-count { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); }
308
+
309
+ /* CREATORS */
310
+ .cpub-creator-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: var(--border-width-default) solid var(--border2); }
311
+ .cpub-creator-item:last-child { border-bottom: none; }
312
+ .cpub-creator-av { width: 32px; height: 32px; border-radius: 50%; border: var(--border-width-default) solid var(--border); background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 11px; font-family: var(--font-mono); font-weight: 600; color: var(--text-dim); flex-shrink: 0; }
313
+ .cpub-creator-info { flex: 1; }
314
+ .cpub-creator-name { font-size: 12px; font-weight: 600; }
315
+ .cpub-creator-subs { font-size: 10px; font-family: var(--font-mono); color: var(--text-faint); }
316
+ .cpub-creator-sub-btn { font-size: 10px; font-family: var(--font-mono); padding: 5px 12px; border-radius: var(--radius); border: var(--border-width-default) solid var(--border); background: var(--surface); color: var(--text-dim); cursor: pointer; white-space: nowrap; }
317
+ .cpub-creator-sub-btn:hover { background: var(--surface2); }
318
+ .cpub-subbed { border-color: var(--green); color: var(--green); background: var(--green-bg); }
319
+
320
+ /* PAGINATION (page-specific) */
321
+ .cpub-page-info { font-size: 11px; font-family: var(--font-mono); color: var(--text-dim); }
322
+
323
+ /* EMPTY STATE (page-specific) */
324
+ .cpub-empty-icon { font-size: 32px; color: var(--text-faint); margin-bottom: 12px; }
325
+ .cpub-empty-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
326
+ .cpub-empty-sub { font-size: 12px; color: var(--text-dim); }
327
+ </style>
@@ -0,0 +1,112 @@
1
+ <script setup lang="ts">
2
+ definePageMeta({ middleware: 'auth' });
3
+ useSeoMeta({ title: `Submit Video — ${useSiteName()}` });
4
+
5
+ const toast = useToast();
6
+ const { extract: extractError } = useApiError();
7
+ const saving = ref(false);
8
+
9
+ const title = ref('');
10
+ const description = ref('');
11
+ const url = ref('');
12
+ const categoryId = ref('');
13
+
14
+ const { data: categories } = await useFetch('/api/videos/categories');
15
+
16
+ // Video embed preview
17
+ const embedUrl = computed(() => {
18
+ const v = url.value.trim();
19
+ if (!v) return '';
20
+ const ytMatch = v.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\s]+)/);
21
+ if (ytMatch) return `https://www.youtube.com/embed/${ytMatch[1]}`;
22
+ const vimeoMatch = v.match(/vimeo\.com\/(\d+)/);
23
+ if (vimeoMatch) return `https://player.vimeo.com/video/${vimeoMatch[1]}`;
24
+ return '';
25
+ });
26
+
27
+ async function handleSubmit(): Promise<void> {
28
+ if (!title.value.trim() || !url.value.trim()) return;
29
+ saving.value = true;
30
+ try {
31
+ const result = await $fetch<{ id: string }>('/api/videos', {
32
+ method: 'POST',
33
+ body: {
34
+ title: title.value,
35
+ description: description.value || undefined,
36
+ url: url.value,
37
+ categoryId: categoryId.value || undefined,
38
+ },
39
+ });
40
+ toast.success('Video submitted!');
41
+ await navigateTo(`/videos/${result.id}`);
42
+ } catch (err: unknown) {
43
+ toast.error(extractError(err));
44
+ } finally {
45
+ saving.value = false;
46
+ }
47
+ }
48
+ </script>
49
+
50
+ <template>
51
+ <div class="video-submit">
52
+ <NuxtLink to="/videos" class="cpub-back-link"><i class="fa-solid fa-arrow-left"></i> Video Hub</NuxtLink>
53
+ <h1 class="page-title">Submit Video</h1>
54
+ <p class="page-subtitle">Share a YouTube or Vimeo video with the community.</p>
55
+
56
+ <form class="submit-form" @submit.prevent="handleSubmit" aria-label="Submit video">
57
+ <div class="form-section">
58
+ <div class="form-field">
59
+ <label for="video-title" class="form-label">Title</label>
60
+ <input id="video-title" v-model="title" type="text" class="form-input" required placeholder="Video title" />
61
+ </div>
62
+
63
+ <div class="form-field">
64
+ <label for="video-url" class="form-label">Video URL</label>
65
+ <input id="video-url" v-model="url" type="url" class="form-input" required placeholder="https://youtube.com/watch?v=..." />
66
+ </div>
67
+
68
+ <!-- Preview -->
69
+ <div v-if="embedUrl" class="video-preview">
70
+ <iframe :src="embedUrl" frameborder="0" allowfullscreen class="video-iframe" />
71
+ </div>
72
+
73
+ <div class="form-field">
74
+ <label for="video-desc" class="form-label">Description</label>
75
+ <textarea id="video-desc" v-model="description" class="form-textarea" rows="3" placeholder="What is this video about?" />
76
+ </div>
77
+
78
+ <div class="form-field">
79
+ <label for="video-cat" class="form-label">Category</label>
80
+ <select id="video-cat" v-model="categoryId" class="form-select">
81
+ <option value="">— None —</option>
82
+ <option v-for="cat in (categories ?? [])" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
83
+ </select>
84
+ </div>
85
+ </div>
86
+
87
+ <button type="submit" class="cpub-btn cpub-btn-primary" :disabled="saving || !title.trim() || !url.trim()">
88
+ <i class="fa-solid fa-upload"></i> {{ saving ? 'Submitting...' : 'Submit Video' }}
89
+ </button>
90
+ </form>
91
+ </div>
92
+ </template>
93
+
94
+ <style scoped>
95
+ .video-submit { max-width: 640px; margin: 0 auto; padding: 32px; }
96
+ .cpub-back-link { font-size: 11px; font-family: var(--font-mono); color: var(--text-faint); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; }
97
+ .cpub-back-link:hover { color: var(--accent); }
98
+ .page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
99
+ .page-subtitle { font-size: 13px; color: var(--text-dim); margin-bottom: 24px; }
100
+
101
+ .submit-form { display: flex; flex-direction: column; gap: 20px; }
102
+ .form-section { border: var(--border-width-default) solid var(--border); background: var(--surface); padding: 20px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 12px; }
103
+ .form-field { display: flex; flex-direction: column; gap: 4px; }
104
+ .form-label { font-size: 10px; font-weight: 600; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
105
+ .form-input, .form-textarea, .form-select { padding: 8px 10px; border: var(--border-width-default) solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-family: inherit; }
106
+ .form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent); outline: none; }
107
+ .form-textarea { resize: vertical; }
108
+
109
+ .video-preview { border: var(--border-width-default) solid var(--border); box-shadow: var(--shadow-md); }
110
+ .video-iframe { width: 100%; aspect-ratio: 16/9; display: block; }
111
+
112
+ </style>