@vitnode/core 1.2.0-canary.60 → 1.2.0-canary.61

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 (274) hide show
  1. package/dist/scripts/get-config.js +15 -0
  2. package/dist/scripts/plugin.js +188 -0
  3. package/dist/scripts/prepare-database.js +177 -0
  4. package/dist/scripts/prepare-plugins-files.js +134 -0
  5. package/dist/scripts/run-interactive-shell-command.js +21 -0
  6. package/dist/scripts/scripts.js +39 -13
  7. package/dist/scripts/shared/file-utils.js +203 -0
  8. package/dist/src/api/adapters/sso/discord.js +1 -77
  9. package/dist/src/api/adapters/sso/facebook.js +1 -76
  10. package/dist/src/api/adapters/sso/google.js +1 -87
  11. package/dist/src/api/config.js +1 -67
  12. package/dist/src/api/lib/check-plugin-id.js +1 -43
  13. package/dist/src/api/lib/cron.js +1 -22
  14. package/dist/src/api/lib/logger-middleware.js +1 -35
  15. package/dist/src/api/lib/module.js +1 -22
  16. package/dist/src/api/lib/plugin.js +1 -22
  17. package/dist/src/api/lib/route.js +1 -27
  18. package/dist/src/api/lib/with-pagination.js +1 -83
  19. package/dist/src/api/middlewares/captcha.middleware.js +1 -63
  20. package/dist/src/api/middlewares/cron-auth.middleware.js +1 -19
  21. package/dist/src/api/middlewares/global.middleware.js +1 -93
  22. package/dist/src/api/middlewares/rate-limiter.middleware.js +1 -32
  23. package/dist/src/api/models/device.js +1 -61
  24. package/dist/src/api/models/email.js +1 -76
  25. package/dist/src/api/models/password.js +1 -36
  26. package/dist/src/api/models/session-admin.js +1 -106
  27. package/dist/src/api/models/session.js +1 -85
  28. package/dist/src/api/models/sso.js +1 -120
  29. package/dist/src/api/models/user/get-user-by-id.js +1 -19
  30. package/dist/src/api/models/user/sign-in-with-passwords.js +1 -22
  31. package/dist/src/api/models/user/sign-up.js +1 -73
  32. package/dist/src/api/models/user.js +1 -8
  33. package/dist/src/api/modules/admin/admin.module.js +1 -19
  34. package/dist/src/api/modules/admin/advanced/advanced.admin.module.js +1 -11
  35. package/dist/src/api/modules/admin/advanced/cron/cron.admin.module.js +1 -12
  36. package/dist/src/api/modules/admin/advanced/cron/routes/get.route.js +1 -66
  37. package/dist/src/api/modules/admin/advanced/cron/routes/run.route.js +1 -95
  38. package/dist/src/api/modules/admin/debug/debug.admin.module.js +1 -10
  39. package/dist/src/api/modules/admin/debug/routes/logs.route.js +1 -94
  40. package/dist/src/api/modules/admin/routes/session.route.js +1 -47
  41. package/dist/src/api/modules/admin/users/routes/list.route.js +1 -79
  42. package/dist/src/api/modules/admin/users/routes/users.route.js +1 -84
  43. package/dist/src/api/modules/admin/users/users.admin.module.js +1 -10
  44. package/dist/src/api/modules/cron/cron/clean.cron.js +1 -24
  45. package/dist/src/api/modules/cron/cron.module.js +1 -14
  46. package/dist/src/api/modules/cron/helpers/process-cron-jobs.d.ts.map +1 -1
  47. package/dist/src/api/modules/cron/helpers/process-cron-jobs.js +1 -76
  48. package/dist/src/api/modules/cron/routes/cron.route.js +1 -101
  49. package/dist/src/api/modules/middleware/middleware.module.js +1 -10
  50. package/dist/src/api/modules/middleware/route.js +1 -49
  51. package/dist/src/api/modules/users/avatar-color.js +1 -43
  52. package/dist/src/api/modules/users/routes/change-password.route.js +1 -58
  53. package/dist/src/api/modules/users/routes/reset-passowrd.route.js +1 -91
  54. package/dist/src/api/modules/users/routes/session.route.js +1 -46
  55. package/dist/src/api/modules/users/routes/sign-in.route.js +1 -71
  56. package/dist/src/api/modules/users/routes/sign-out.route.js +1 -43
  57. package/dist/src/api/modules/users/routes/sign-up.route.js +1 -77
  58. package/dist/src/api/modules/users/routes/test.route.js +1 -33
  59. package/dist/src/api/modules/users/sso/routes/callback.route.js +1 -52
  60. package/dist/src/api/modules/users/sso/routes/create-url.route.js +1 -36
  61. package/dist/src/api/modules/users/sso/sso.module.js +1 -12
  62. package/dist/src/api/modules/users/users.module.js +1 -26
  63. package/dist/src/api/plugin.js +1 -15
  64. package/dist/src/app/login/page.js +1 -16
  65. package/dist/src/app/login/reset-password/page.js +1 -18
  66. package/dist/src/app/login/sso/[providerId]/page.js +1 -10
  67. package/dist/src/app/register/page.js +1 -16
  68. package/dist/src/app_admin/core/advanced/cron/page.js +1 -42
  69. package/dist/src/app_admin/core/debug/page.js +1 -45
  70. package/dist/src/app_admin/core/page.js +1 -5
  71. package/dist/src/app_admin/core/test/page.js +1 -5
  72. package/dist/src/app_admin/core/users/page.js +1 -38
  73. package/dist/src/components/avatar.js +1 -14
  74. package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +1 -42
  75. package/dist/src/components/confirm-action/content.js +1 -31
  76. package/dist/src/components/date-format.js +1 -41
  77. package/dist/src/components/form/auto-form.js +1 -103
  78. package/dist/src/components/form/common/desc.js +1 -9
  79. package/dist/src/components/form/common/label.js +1 -18
  80. package/dist/src/components/form/fields/checkbox.js +1 -37
  81. package/dist/src/components/form/fields/combobox-async.js +1 -123
  82. package/dist/src/components/form/fields/combobox.js +1 -87
  83. package/dist/src/components/form/fields/input.js +1 -39
  84. package/dist/src/components/form/fields/radio-group.js +1 -50
  85. package/dist/src/components/form/fields/select.js +1 -58
  86. package/dist/src/components/form/fields/switch.js +1 -36
  87. package/dist/src/components/form/fields/textarea.js +1 -36
  88. package/dist/src/components/i18n-provider.js +1 -43
  89. package/dist/src/components/logo-vitnode.js +1 -119
  90. package/dist/src/components/switchers/langs/language-switcher.js +1 -47
  91. package/dist/src/components/switchers/themes/theme-switcher.js +1 -28
  92. package/dist/src/components/table/content.js +1 -81
  93. package/dist/src/components/table/data-table.js +1 -68
  94. package/dist/src/components/table/order-table-head.js +1 -50
  95. package/dist/src/components/table/pagination.js +1 -122
  96. package/dist/src/components/tiptap/extension.js +1 -33
  97. package/dist/src/components/tiptap/toolbar/actions/alignment-action.js +1 -91
  98. package/dist/src/components/tiptap/toolbar/actions/bold-action.js +1 -39
  99. package/dist/src/components/tiptap/toolbar/actions/headings-action.js +1 -93
  100. package/dist/src/components/tiptap/toolbar/actions/italic-action.js +1 -38
  101. package/dist/src/components/tiptap/toolbar/actions/list-action.js +1 -61
  102. package/dist/src/components/tiptap/toolbar/actions/text-format-more/text-format-more.js +1 -59
  103. package/dist/src/components/tiptap/toolbar/actions/underline-action.js +1 -38
  104. package/dist/src/components/tiptap/toolbar/actions/undo-redo-actions.js +1 -63
  105. package/dist/src/components/tiptap/toolbar/actions/utils/tooltip-shortcut.js +1 -11
  106. package/dist/src/components/tiptap/toolbar/tiptap-toolbar.js +1 -55
  107. package/dist/src/components/tiptap/toolbar/use-toolbar-editor.js +1 -5
  108. package/dist/src/components/ui/accordion.js +1 -46
  109. package/dist/src/components/ui/alert-dialog.js +1 -123
  110. package/dist/src/components/ui/alert.js +1 -39
  111. package/dist/src/components/ui/badge.js +1 -28
  112. package/dist/src/components/ui/button-client.js +1 -57
  113. package/dist/src/components/ui/button.js +1 -32
  114. package/dist/src/components/ui/card.js +1 -52
  115. package/dist/src/components/ui/checkbox.js +1 -20
  116. package/dist/src/components/ui/collapsible.js +1 -22
  117. package/dist/src/components/ui/command.js +1 -98
  118. package/dist/src/components/ui/context-menu.js +1 -140
  119. package/dist/src/components/ui/dialog.js +1 -189
  120. package/dist/src/components/ui/drawer.js +1 -83
  121. package/dist/src/components/ui/dropdown-menu.js +1 -141
  122. package/dist/src/components/ui/editor-content.js +1 -10
  123. package/dist/src/components/ui/editor.js +1 -35
  124. package/dist/src/components/ui/form.js +1 -148
  125. package/dist/src/components/ui/header-content.js +1 -30
  126. package/dist/src/components/ui/hover-card.js +1 -29
  127. package/dist/src/components/ui/input-otp.js +1 -48
  128. package/dist/src/components/ui/input.js +1 -11
  129. package/dist/src/components/ui/label.js +1 -12
  130. package/dist/src/components/ui/loader.js +1 -16
  131. package/dist/src/components/ui/menubar.js +1 -151
  132. package/dist/src/components/ui/navigation-menu.js +1 -82
  133. package/dist/src/components/ui/popover.js +1 -35
  134. package/dist/src/components/ui/progress.js +1 -19
  135. package/dist/src/components/ui/radio-group.js +1 -27
  136. package/dist/src/components/ui/scroll-area.js +1 -33
  137. package/dist/src/components/ui/select.js +1 -113
  138. package/dist/src/components/ui/separator.js +1 -14
  139. package/dist/src/components/ui/sheet.js +1 -92
  140. package/dist/src/components/ui/sidebar.js +1 -433
  141. package/dist/src/components/ui/skeleton.js +1 -10
  142. package/dist/src/components/ui/slider.js +1 -50
  143. package/dist/src/components/ui/sonner.js +1 -26
  144. package/dist/src/components/ui/switch.js +1 -16
  145. package/dist/src/components/ui/table.js +1 -63
  146. package/dist/src/components/ui/tabs.js +1 -33
  147. package/dist/src/components/ui/textarea.js +1 -10
  148. package/dist/src/components/ui/toggle-group.js +1 -45
  149. package/dist/src/components/ui/toggle.js +1 -34
  150. package/dist/src/components/ui/tooltip.js +1 -57
  151. package/dist/src/config.js +1 -4
  152. package/dist/src/database/admins.js +1 -74
  153. package/dist/src/database/cron.js +1 -22
  154. package/dist/src/database/languages.js +1 -52
  155. package/dist/src/database/logs.js +1 -34
  156. package/dist/src/database/moderators.js +1 -37
  157. package/dist/src/database/roles.js +1 -13
  158. package/dist/src/database/sessions.js +1 -60
  159. package/dist/src/database/users.js +1 -145
  160. package/dist/src/drizzle.config.js +1 -67
  161. package/dist/src/emails/default-template.js +1 -99
  162. package/dist/src/emails/reset-password.js +1 -132
  163. package/dist/src/emails/ui/button.js +1 -36
  164. package/dist/src/emails/ui/card.js +1 -39
  165. package/dist/src/hooks/use-before-unload.js +1 -30
  166. package/dist/src/hooks/use-captcha.js +1 -122
  167. package/dist/src/hooks/use-mobile.js +1 -16
  168. package/dist/src/lib/api/get-middleware-api.js +1 -13
  169. package/dist/src/lib/api/get-next-cron-run-date.js +1 -14
  170. package/dist/src/lib/api/get-next-cron-run-date.test.js +1 -55
  171. package/dist/src/lib/api/get-session-admin-api.js +1 -19
  172. package/dist/src/lib/api/get-session-api.js +1 -14
  173. package/dist/src/lib/api/should-cron-job-run.js +1 -16
  174. package/dist/src/lib/api/should-cron-job-run.test.js +1 -213
  175. package/dist/src/lib/api/validate-cron-schedule.d.ts +2 -0
  176. package/dist/src/lib/api/validate-cron-schedule.d.ts.map +1 -0
  177. package/dist/src/lib/api/validate-cron-schedule.js +1 -0
  178. package/dist/src/lib/api/validate-cron-schedule.test.d.ts +2 -0
  179. package/dist/src/lib/api/validate-cron-schedule.test.d.ts.map +1 -0
  180. package/dist/src/lib/api/validate-cron-schedule.test.js +1 -0
  181. package/dist/src/lib/colors.js +1 -140
  182. package/dist/src/lib/colors.test.js +1 -173
  183. package/dist/src/lib/config.js +1 -14
  184. package/dist/src/lib/ctrl-or-command-character.js +1 -5
  185. package/dist/src/lib/fetcher/cookie-from-string-to-object.js +1 -12
  186. package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +1 -78
  187. package/dist/src/lib/fetcher/core.js +3 -48
  188. package/dist/src/lib/fetcher/helpers-server.js +1 -18
  189. package/dist/src/lib/fetcher/helpers.js +1 -16
  190. package/dist/src/lib/fetcher/helpers.test.js +1 -37
  191. package/dist/src/lib/fetcher/types.js +1 -1
  192. package/dist/src/lib/fetcher-client.js +1 -17
  193. package/dist/src/lib/fetcher.js +1 -33
  194. package/dist/src/lib/helpers/auto-form.js +1 -98
  195. package/dist/src/lib/helpers/auto-form.test.js +1 -336
  196. package/dist/src/lib/navigation.js +1 -11
  197. package/dist/src/lib/plugin.js +1 -3
  198. package/dist/src/lib/special-characters.js +1 -4
  199. package/dist/src/lib/special-characters.test.js +1 -56
  200. package/dist/src/lib/utils.js +1 -5
  201. package/dist/src/locales/en.json +308 -0
  202. package/dist/src/tests/setup.js +1 -6
  203. package/dist/src/views/admin/layouts/admin-layout.js +1 -73
  204. package/dist/src/views/admin/layouts/sidebar/nav/item.js +1 -98
  205. package/dist/src/views/admin/layouts/sidebar/nav/nav.js +1 -60
  206. package/dist/src/views/admin/layouts/sidebar/sidebar.js +1 -28
  207. package/dist/src/views/admin/layouts/sidebar/sign-out.js +1 -14
  208. package/dist/src/views/admin/layouts/user-bar/client.js +1 -69
  209. package/dist/src/views/admin/layouts/user-bar/user-bar.js +1 -32
  210. package/dist/src/views/admin/sign-in/sign-in-admin-view.js +1 -27
  211. package/dist/src/views/admin/views/core/advanced/cron/cron-table-view.js +1 -97
  212. package/dist/src/views/admin/views/core/advanced/cron/run-action/mutation-api.js +1 -23
  213. package/dist/src/views/admin/views/core/advanced/cron/run-action/run-action.js +1 -38
  214. package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +1 -44
  215. package/dist/src/views/admin/views/core/debug/actions/clear-cache/clear-cache.js +1 -35
  216. package/dist/src/views/admin/views/core/debug/actions/clear-cache/mutation-api.js +1 -5
  217. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +1 -281
  218. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +1 -67
  219. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +1 -14
  220. package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +1 -30
  221. package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +1 -96
  222. package/dist/src/views/admin/views/core/test.js +1 -161
  223. package/dist/src/views/admin/views/core/users/users-admin-view.js +1 -89
  224. package/dist/src/views/auth/password-reset/change-password-form/form.js +1 -48
  225. package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +1 -22
  226. package/dist/src/views/auth/password-reset/change-password-form/use-form.js +1 -36
  227. package/dist/src/views/auth/password-reset/form/form.js +1 -104
  228. package/dist/src/views/auth/password-reset/form/mutation-api.js +1 -21
  229. package/dist/src/views/auth/password-reset/form/use-form.js +1 -33
  230. package/dist/src/views/auth/password-reset/password-reset-view.js +1 -37
  231. package/dist/src/views/auth/sign-in/form/form.js +1 -64
  232. package/dist/src/views/auth/sign-in/form/mutation-api.js +1 -33
  233. package/dist/src/views/auth/sign-in/form/use-form.js +1 -38
  234. package/dist/src/views/auth/sign-in/sign-in-view.js +1 -61
  235. package/dist/src/views/auth/sign-up/components/password-input.js +1 -96
  236. package/dist/src/views/auth/sign-up/email-confirmation-view.js +1 -55
  237. package/dist/src/views/auth/sign-up/form/form.js +1 -89
  238. package/dist/src/views/auth/sign-up/form/mutation-api.js +1 -30
  239. package/dist/src/views/auth/sign-up/form/use-form.js +1 -70
  240. package/dist/src/views/auth/sign-up/sign-up-view.js +1 -65
  241. package/dist/src/views/auth/sign-up/wrapper.js +1 -22
  242. package/dist/src/views/auth/sso/buttons/client.js +1 -22
  243. package/dist/src/views/auth/sso/buttons/mutation-api.js +1 -24
  244. package/dist/src/views/auth/sso/buttons/sso-buttons.js +1 -56
  245. package/dist/src/views/auth/sso/callback/callback-sso-view.js +1 -32
  246. package/dist/src/views/auth/sso/callback/client/client.js +1 -68
  247. package/dist/src/views/auth/sso/callback/client/mutation-api.js +1 -32
  248. package/dist/src/views/error/back-button.js +1 -14
  249. package/dist/src/views/error/error-view.js +1 -58
  250. package/dist/src/views/error/global-error-view.js +1 -50
  251. package/dist/src/views/layouts/provider.js +1 -44
  252. package/dist/src/views/layouts/root-layout.js +1 -25
  253. package/dist/src/views/layouts/theme/header/header.js +1 -38
  254. package/dist/src/views/layouts/theme/header/user/auth/auth.js +1 -33
  255. package/dist/src/views/layouts/theme/header/user/auth/client.js +1 -47
  256. package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +1 -27
  257. package/dist/src/views/layouts/theme/header/user/user.js +1 -32
  258. package/dist/src/views/layouts/theme/layout.js +1 -16
  259. package/dist/src/vitnode.config.js +1 -42
  260. package/dist/tsconfig.tsbuildinfo +1 -1
  261. package/dist/tsup.config.js +18 -0
  262. package/dist/vitest.config.d.ts.map +1 -1
  263. package/dist/vitest.config.js +49 -0
  264. package/eslint.config.mjs +2 -0
  265. package/package.json +6 -10
  266. package/dist/src/api/adapters/cron/node-cron.adapter.d.ts +0 -3
  267. package/dist/src/api/adapters/cron/node-cron.adapter.d.ts.map +0 -1
  268. package/dist/src/api/adapters/cron/node-cron.adapter.js +0 -11
  269. package/dist/src/api/adapters/email/nodemailer.d.ts +0 -10
  270. package/dist/src/api/adapters/email/nodemailer.d.ts.map +0 -1
  271. package/dist/src/api/adapters/email/nodemailer.js +0 -30
  272. package/dist/src/api/adapters/email/resend.d.ts +0 -6
  273. package/dist/src/api/adapters/email/resend.d.ts.map +0 -1
  274. package/dist/src/api/adapters/email/resend.js +0 -21
@@ -1,69 +1 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { BugIcon, HomeIcon, LogOut } from "lucide-react";
4
- import { useTranslations } from "next-intl";
5
- import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from "../../../../components/ui/dropdown-menu.js";
6
- import { Link } from "../../../../lib/navigation.js";
7
- import { logOutMutationApi } from "../../../layouts/theme/header/user/auth/log-out-mutation-api.js";
8
- export const ClientUserBarAdmin = ({ user })=>{
9
- const t = useTranslations("admin.global.nav.user_bar");
10
- return /*#__PURE__*/ _jsxs(_Fragment, {
11
- children: [
12
- /*#__PURE__*/ _jsx(DropdownMenuLabel, {
13
- className: "p-0 font-normal",
14
- children: /*#__PURE__*/ _jsxs("div", {
15
- className: "flex flex-col px-2 py-2 text-left",
16
- children: [
17
- /*#__PURE__*/ _jsx("span", {
18
- className: "font-medium",
19
- children: user.name
20
- }),
21
- /*#__PURE__*/ _jsx("span", {
22
- className: "text-muted-foreground text-xs",
23
- children: user.email
24
- })
25
- ]
26
- })
27
- }),
28
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
29
- /*#__PURE__*/ _jsxs(DropdownMenuGroup, {
30
- children: [
31
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
32
- asChild: true,
33
- children: /*#__PURE__*/ _jsxs(Link, {
34
- href: "/",
35
- target: "_blank",
36
- children: [
37
- /*#__PURE__*/ _jsx(HomeIcon, {}),
38
- t("home_page")
39
- ]
40
- })
41
- }),
42
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
43
- asChild: true,
44
- children: /*#__PURE__*/ _jsxs(Link, {
45
- href: "/admin/core/debug",
46
- children: [
47
- /*#__PURE__*/ _jsx(BugIcon, {}),
48
- t("debug")
49
- ]
50
- })
51
- })
52
- ]
53
- }),
54
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
55
- /*#__PURE__*/ _jsxs(DropdownMenuItem, {
56
- className: "text-destructive focus:text-destructive",
57
- onClick: async ()=>{
58
- await logOutMutationApi({
59
- isAdmin: true
60
- });
61
- },
62
- children: [
63
- /*#__PURE__*/ _jsx(LogOut, {}),
64
- t("log_out")
65
- ]
66
- })
67
- ]
68
- });
69
- };
1
+ "use client";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{BugIcon,HomeIcon,LogOut}from"lucide-react";import{useTranslations}from"next-intl";import{DropdownMenuGroup,DropdownMenuItem,DropdownMenuLabel,DropdownMenuSeparator}from"../../../../components/ui/dropdown-menu.js";import{Link}from"../../../../lib/navigation.js";import{logOutMutationApi}from"../../../layouts/theme/header/user/auth/log-out-mutation-api.js";export const ClientUserBarAdmin=({user})=>{const t=useTranslations("admin.global.nav.user_bar");return _jsxs(_Fragment,{children:[_jsx(DropdownMenuLabel,{className:"p-0 font-normal",children:_jsxs("div",{className:"flex flex-col px-2 py-2 text-left",children:[_jsx("span",{className:"font-medium",children:user.name}),_jsx("span",{className:"text-muted-foreground text-xs",children:user.email})]})}),_jsx(DropdownMenuSeparator,{}),_jsxs(DropdownMenuGroup,{children:[_jsx(DropdownMenuItem,{asChild:true,children:_jsxs(Link,{href:"/",target:"_blank",children:[_jsx(HomeIcon,{}),t("home_page")]})}),_jsx(DropdownMenuItem,{asChild:true,children:_jsxs(Link,{href:"/admin/core/debug",children:[_jsx(BugIcon,{}),t("debug")]})})]}),_jsx(DropdownMenuSeparator,{}),_jsxs(DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:async()=>{await logOutMutationApi({isAdmin:true})},children:[_jsx(LogOut,{}),t("log_out")]})]})};
@@ -1,32 +1 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Avatar } from "../../../../components/avatar.js";
4
- import { Button } from "../../../../components/ui/button.js";
5
- import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "../../../../components/ui/dropdown-menu.js";
6
- import { ClientUserBarAdmin } from "./client.js";
7
- export const UserBarAdmin = ({ user })=>{
8
- return /*#__PURE__*/ _jsxs(DropdownMenu, {
9
- children: [
10
- /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
11
- asChild: true,
12
- children: /*#__PURE__*/ _jsx(Button, {
13
- "aria-label": user.name,
14
- size: "icon",
15
- variant: "ghost",
16
- children: /*#__PURE__*/ _jsx(Avatar, {
17
- size: 24,
18
- user: user
19
- })
20
- })
21
- }),
22
- /*#__PURE__*/ _jsx(DropdownMenuContent, {
23
- className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
24
- side: "bottom",
25
- sideOffset: 4,
26
- children: /*#__PURE__*/ _jsx(ClientUserBarAdmin, {
27
- user: user
28
- })
29
- })
30
- ]
31
- });
32
- };
1
+ "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{Avatar}from"../../../../components/avatar.js";import{Button}from"../../../../components/ui/button.js";import{DropdownMenu,DropdownMenuContent,DropdownMenuTrigger}from"../../../../components/ui/dropdown-menu.js";import{ClientUserBarAdmin}from"./client.js";export const UserBarAdmin=({user})=>{return _jsxs(DropdownMenu,{children:[_jsx(DropdownMenuTrigger,{asChild:true,children:_jsx(Button,{"aria-label":user.name,size:"icon",variant:"ghost",children:_jsx(Avatar,{size:24,user:user})})}),_jsx(DropdownMenuContent,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",sideOffset:4,children:_jsx(ClientUserBarAdmin,{user:user})})]})};
@@ -1,27 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { I18nProvider } from "../../../components/i18n-provider.js";
3
- import { LogoVitNode } from "../../../components/logo-vitnode.js";
4
- import { Card } from "../../../components/ui/card.js";
5
- import { FormSignIn } from "../../auth/sign-in/form/form.js";
6
- export const SignInAdminView = ()=>{
7
- return /*#__PURE__*/ _jsx(I18nProvider, {
8
- namespaces: [
9
- "core.auth.sign_in"
10
- ],
11
- children: /*#__PURE__*/ _jsxs("div", {
12
- className: "mx-auto flex min-h-screen max-w-md flex-col items-center justify-center gap-10 px-4 py-16",
13
- children: [
14
- /*#__PURE__*/ _jsx(LogoVitNode, {
15
- className: "w-64"
16
- }),
17
- /*#__PURE__*/ _jsx(Card, {
18
- className: "w-full p-6",
19
- children: /*#__PURE__*/ _jsx(FormSignIn, {
20
- isAdmin: true,
21
- isEmail: false
22
- })
23
- })
24
- ]
25
- })
26
- });
27
- };
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{I18nProvider}from"../../../components/i18n-provider.js";import{LogoVitNode}from"../../../components/logo-vitnode.js";import{Card}from"../../../components/ui/card.js";import{FormSignIn}from"../../auth/sign-in/form/form.js";export const SignInAdminView=()=>{return _jsx(I18nProvider,{namespaces:["core.auth.sign_in"],children:_jsxs("div",{className:"mx-auto flex min-h-screen max-w-md flex-col items-center justify-center gap-10 px-4 py-16",children:[_jsx(LogoVitNode,{className:"w-64"}),_jsx(Card,{className:"w-full p-6",children:_jsx(FormSignIn,{isAdmin:true,isEmail:false})})]})})};
@@ -1,97 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getTranslations } from "next-intl/server";
3
- import { cronAdminModule } from "../../../../../../api/modules/admin/advanced/cron/cron.admin.module.js";
4
- import { DateFormat } from "../../../../../../components/date-format.js";
5
- import { DataTable } from "../../../../../../components/table/data-table.js";
6
- import { fetcher } from "../../../../../../lib/fetcher.js";
7
- import { RunActionCronTable } from "./run-action/run-action.js";
8
- export const CronTableView = async ({ searchParams })=>{
9
- const query = await searchParams;
10
- const res = await fetcher(cronAdminModule, {
11
- path: "/",
12
- method: "get",
13
- module: "cron",
14
- prefixPath: "/admin/advanced",
15
- args: {
16
- query
17
- },
18
- withPagination: true
19
- });
20
- const [data, t] = await Promise.all([
21
- res.json(),
22
- getTranslations("admin.advanced.cron")
23
- ]);
24
- return /*#__PURE__*/ _jsx(DataTable, {
25
- columns: [
26
- {
27
- id: "name",
28
- label: t("list.name"),
29
- cell: ({ row })=>/*#__PURE__*/ _jsxs("div", {
30
- className: "flex max-w-sm flex-col",
31
- children: [
32
- /*#__PURE__*/ _jsx("span", {
33
- children: row.name
34
- }),
35
- /*#__PURE__*/ _jsx("p", {
36
- className: "text-muted-foreground text-sm",
37
- children: row.description
38
- })
39
- ]
40
- })
41
- },
42
- {
43
- id: "pluginId",
44
- label: t("list.pluginId")
45
- },
46
- {
47
- id: "module",
48
- label: t("list.module")
49
- },
50
- {
51
- id: "schedule",
52
- label: t("list.schedule")
53
- },
54
- {
55
- id: "lastRun",
56
- label: t("list.lastRun.title"),
57
- cell: ({ row })=>row.lastRun ? /*#__PURE__*/ _jsx(DateFormat, {
58
- date: row.lastRun
59
- }) : /*#__PURE__*/ _jsx("span", {
60
- className: "text-muted-foreground italic",
61
- children: t("list.lastRun.never")
62
- })
63
- },
64
- {
65
- id: "nextRun",
66
- label: t("list.nextRun.title"),
67
- cell: ({ row })=>row.nextRun ? /*#__PURE__*/ _jsx(DateFormat, {
68
- date: row.nextRun,
69
- showFullDate: true
70
- }) : /*#__PURE__*/ _jsx("span", {
71
- className: "text-muted-foreground italic",
72
- children: t("list.nextRun.never")
73
- })
74
- },
75
- {
76
- id: "actions",
77
- label: "",
78
- cell: ({ row })=>/*#__PURE__*/ _jsx(RunActionCronTable, {
79
- id: row.id
80
- })
81
- }
82
- ],
83
- edges: data.edges,
84
- order: {
85
- columns: [
86
- "lastRun",
87
- "createdAt",
88
- "nextRun"
89
- ],
90
- defaultOrder: {
91
- column: "lastRun",
92
- order: "desc"
93
- }
94
- },
95
- pageInfo: data.pageInfo
96
- });
97
- };
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{getTranslations}from"next-intl/server";import{cronAdminModule}from"../../../../../../api/modules/admin/advanced/cron/cron.admin.module.js";import{DateFormat}from"../../../../../../components/date-format.js";import{DataTable}from"../../../../../../components/table/data-table.js";import{fetcher}from"../../../../../../lib/fetcher.js";import{RunActionCronTable}from"./run-action/run-action.js";export const CronTableView=async({searchParams})=>{const query=await searchParams;const res=await fetcher(cronAdminModule,{path:"/",method:"get",module:"cron",prefixPath:"/admin/advanced",args:{query},withPagination:true});const[data,t]=await Promise.all([res.json(),getTranslations("admin.advanced.cron")]);return _jsx(DataTable,{columns:[{id:"name",label:t("list.name"),cell:({row})=>_jsxs("div",{className:"flex max-w-sm flex-col",children:[_jsx("span",{children:row.name}),_jsx("p",{className:"text-muted-foreground text-sm",children:row.description})]})},{id:"pluginId",label:t("list.pluginId")},{id:"module",label:t("list.module")},{id:"schedule",label:t("list.schedule")},{id:"lastRun",label:t("list.lastRun.title"),cell:({row})=>row.lastRun?_jsx(DateFormat,{date:row.lastRun}):_jsx("span",{className:"text-muted-foreground italic",children:t("list.lastRun.never")})},{id:"nextRun",label:t("list.nextRun.title"),cell:({row})=>row.nextRun?_jsx(DateFormat,{date:row.nextRun,showFullDate:true}):_jsx("span",{className:"text-muted-foreground italic",children:t("list.nextRun.never")})},{id:"actions",label:"",cell:({row})=>_jsx(RunActionCronTable,{id:row.id})}],edges:data.edges,order:{columns:["lastRun","createdAt","nextRun"],defaultOrder:{column:"lastRun",order:"desc"}},pageInfo:data.pageInfo})};
@@ -1,23 +1 @@
1
- "use server";
2
- import { revalidatePath } from "next/cache";
3
- import { cronAdminModule } from "../../../../../../../api/modules/admin/advanced/cron/cron.admin.module.js";
4
- import { fetcher } from "../../../../../../../lib/fetcher.js";
5
- export const mutationApi = async (id)=>{
6
- const res = await fetcher(cronAdminModule, {
7
- path: "/{id}",
8
- method: "post",
9
- module: "cron",
10
- prefixPath: "/admin/advanced",
11
- args: {
12
- params: {
13
- id: id.toString()
14
- }
15
- }
16
- });
17
- if (!res.ok) {
18
- return {
19
- error: "Failed to run cron job"
20
- };
21
- }
22
- revalidatePath("[locale]/admin/(auth)/(plugins)/(vitnode-core)/core/advanced/cron");
23
- };
1
+ "use server";import{revalidatePath}from"next/cache";import{cronAdminModule}from"../../../../../../../api/modules/admin/advanced/cron/cron.admin.module.js";import{fetcher}from"../../../../../../../lib/fetcher.js";export const mutationApi=async id=>{const res=await fetcher(cronAdminModule,{path:"/{id}",method:"post",module:"cron",prefixPath:"/admin/advanced",args:{params:{id:id.toString()}}});if(!res.ok){return{error:"Failed to run cron job"}}revalidatePath("[locale]/admin/(auth)/(plugins)/(vitnode-core)/core/advanced/cron")};
@@ -1,38 +1 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { PlayIcon } from "lucide-react";
4
- import { useTranslations } from "next-intl";
5
- import { useActionState } from "react";
6
- import { toast } from "sonner";
7
- import { Button } from "../../../../../../../components/ui/button.js";
8
- import { TooltipWithContent } from "../../../../../../../components/ui/tooltip.js";
9
- import { mutationApi } from "./mutation-api.js";
10
- export const RunActionCronTable = ({ id })=>{
11
- const t = useTranslations("admin.advanced.cron.list.actions.runNow");
12
- const tError = useTranslations("core.global.errors");
13
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
- const [_, formAction, isPending] = useActionState(async ()=>{
15
- const mutation = await mutationApi(id);
16
- if (mutation?.error) {
17
- toast.error(tError("title"), {
18
- description: tError("internal_server_error")
19
- });
20
- return;
21
- }
22
- toast.success(t("success"));
23
- }, null);
24
- return /*#__PURE__*/ _jsx("form", {
25
- action: formAction,
26
- children: /*#__PURE__*/ _jsx(TooltipWithContent, {
27
- text: t("label"),
28
- children: /*#__PURE__*/ _jsx(Button, {
29
- "aria-label": t("label"),
30
- isLoading: isPending,
31
- size: "icon",
32
- type: "submit",
33
- variant: "ghost",
34
- children: /*#__PURE__*/ _jsx(PlayIcon, {})
35
- })
36
- })
37
- });
38
- };
1
+ "use client";import{jsx as _jsx}from"react/jsx-runtime";import{PlayIcon}from"lucide-react";import{useTranslations}from"next-intl";import{useActionState}from"react";import{toast}from"sonner";import{Button}from"../../../../../../../components/ui/button.js";import{TooltipWithContent}from"../../../../../../../components/ui/tooltip.js";import{mutationApi}from"./mutation-api.js";export const RunActionCronTable=({id})=>{const t=useTranslations("admin.advanced.cron.list.actions.runNow");const tError=useTranslations("core.global.errors");const[_,formAction,isPending]=useActionState(async()=>{const mutation=await mutationApi(id);if(mutation?.error){toast.error(tError("title"),{description:tError("internal_server_error")});return}toast.success(t("success"))},null);return _jsx("form",{action:formAction,children:_jsx(TooltipWithContent,{text:t("label"),children:_jsx(Button,{"aria-label":t("label"),isLoading:isPending,size:"icon",type:"submit",variant:"ghost",children:_jsx(PlayIcon,{})})})})};
@@ -1,44 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { AlertTriangleIcon } from "lucide-react";
3
- import { getTranslations } from "next-intl/server";
4
- import { Badge } from "../../../../../components/ui/badge.js";
5
- import { HeaderContent } from "../../../../../components/ui/header-content.js";
6
- import { getSessionAdminApi } from "../../../../../lib/api/get-session-admin-api.js";
7
- import { CONFIG } from "../../../../../lib/config.js";
8
- export const DashboardAdminView = async ()=>{
9
- const session = await getSessionAdminApi();
10
- const t = await getTranslations("admin.dashboard");
11
- if (!session) return null;
12
- const { vitnode_version } = session;
13
- return /*#__PURE__*/ _jsxs("div", {
14
- className: "p-4",
15
- children: [
16
- /*#__PURE__*/ _jsx(HeaderContent, {
17
- desc: t("version", {
18
- version: vitnode_version
19
- }),
20
- h1: /*#__PURE__*/ _jsxs(_Fragment, {
21
- children: [
22
- /*#__PURE__*/ _jsx("span", {
23
- children: "VitNode"
24
- }),
25
- CONFIG.node_development && /*#__PURE__*/ _jsxs(Badge, {
26
- className: "ml-2 bg-yellow-500 text-black hover:bg-yellow-500 dark:bg-yellow-500 dark:hover:bg-yellow-500",
27
- variant: "destructive",
28
- children: [
29
- /*#__PURE__*/ _jsx(AlertTriangleIcon, {
30
- className: "size-4"
31
- }),
32
- " ",
33
- t("dev_mode")
34
- ]
35
- })
36
- ]
37
- })
38
- }),
39
- /*#__PURE__*/ _jsx("div", {
40
- children: "Dashboard Admin"
41
- })
42
- ]
43
- });
44
- };
1
+ import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{AlertTriangleIcon}from"lucide-react";import{getTranslations}from"next-intl/server";import{Badge}from"../../../../../components/ui/badge.js";import{HeaderContent}from"../../../../../components/ui/header-content.js";import{getSessionAdminApi}from"../../../../../lib/api/get-session-admin-api.js";import{CONFIG}from"../../../../../lib/config.js";export const DashboardAdminView=async()=>{const session=await getSessionAdminApi();const t=await getTranslations("admin.dashboard");if(!session)return null;const{vitnode_version}=session;return _jsxs("div",{className:"p-4",children:[_jsx(HeaderContent,{desc:t("version",{version:vitnode_version}),h1:_jsxs(_Fragment,{children:[_jsx("span",{children:"VitNode"}),CONFIG.node_development&&_jsxs(Badge,{className:"ml-2 bg-yellow-500 text-black hover:bg-yellow-500 dark:bg-yellow-500 dark:hover:bg-yellow-500",variant:"destructive",children:[_jsx(AlertTriangleIcon,{className:"size-4"})," ",t("dev_mode")]})]})}),_jsx("div",{children:"Dashboard Admin"})]})};
@@ -1,35 +1 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { BrushCleaningIcon } from "lucide-react";
4
- import { useTranslations } from "next-intl";
5
- import { toast } from "sonner";
6
- import { ConfirmActionAlertDialog } from "../../../../../../../components/confirm-action/confirm-action-alert-dialog.js";
7
- import { Button } from "../../../../../../../components/ui/button.js";
8
- import { clearCacheMutation } from "./mutation-api.js";
9
- export const ClearCacheAction = ()=>{
10
- const t = useTranslations("admin.debug.actions.clear_cache");
11
- const tErrors = useTranslations("core.global.errors");
12
- return /*#__PURE__*/ _jsx(ConfirmActionAlertDialog, {
13
- description: t("desc"),
14
- onSubmit: async ({ onClose })=>{
15
- try {
16
- await clearCacheMutation();
17
- } catch {
18
- toast.error(tErrors("title"), {
19
- description: tErrors("internal_server_error")
20
- });
21
- return;
22
- }
23
- onClose();
24
- toast.success(t("success"));
25
- },
26
- textSubmit: t("confirm"),
27
- title: t("title"),
28
- children: /*#__PURE__*/ _jsxs(Button, {
29
- children: [
30
- /*#__PURE__*/ _jsx(BrushCleaningIcon, {}),
31
- t("label")
32
- ]
33
- })
34
- });
35
- };
1
+ "use client";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{BrushCleaningIcon}from"lucide-react";import{useTranslations}from"next-intl";import{toast}from"sonner";import{ConfirmActionAlertDialog}from"../../../../../../../components/confirm-action/confirm-action-alert-dialog.js";import{Button}from"../../../../../../../components/ui/button.js";import{clearCacheMutation}from"./mutation-api.js";export const ClearCacheAction=()=>{const t=useTranslations("admin.debug.actions.clear_cache");const tErrors=useTranslations("core.global.errors");return _jsx(ConfirmActionAlertDialog,{description:t("desc"),onSubmit:async({onClose})=>{try{await clearCacheMutation()}catch{toast.error(tErrors("title"),{description:tErrors("internal_server_error")});return}onClose();toast.success(t("success"))},textSubmit:t("confirm"),title:t("title"),children:_jsxs(Button,{children:[_jsx(BrushCleaningIcon,{}),t("label")]})})};
@@ -1,5 +1 @@
1
- "use server";
2
- import { revalidatePath } from "next/cache";
3
- export const clearCacheMutation = async ()=>{
4
- await Promise.resolve(revalidatePath("/", "layout"));
5
- };
1
+ "use server";import{revalidatePath}from"next/cache";export const clearCacheMutation=async()=>{await Promise.resolve(revalidatePath("/","layout"))};