studiocms 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +122 -0
- package/dist/cli/add/index.d.ts +2 -2
- package/dist/cli/add/index.js +4 -3
- package/dist/cli/add/npm-utils.d.ts +6 -6
- package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
- package/dist/cli/add/tryToInstallPlugins.js +6 -5
- package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
- package/dist/cli/add/updateStudioCMSConfig.js +3 -4
- package/dist/cli/add/validatePlugins.d.ts +1 -2
- package/dist/cli/add/validatePlugins.js +15 -9
- package/dist/cli/crypto/genJWT/index.d.ts +1 -1
- package/dist/cli/crypto/genJWT/index.js +8 -9
- package/dist/cli/crypto/index.d.ts +1 -1
- package/dist/cli/init/steps/env.js +14 -4
- package/dist/cli/init/steps/next.d.ts +1 -1
- package/dist/cli/init/steps/next.js +6 -5
- package/dist/cli/migrator/index.d.ts +1 -1
- package/dist/cli/migrator/index.js +2 -2
- package/dist/cli/users/index.d.ts +1 -1
- package/dist/cli/users/shared.js +2 -2
- package/dist/cli/users/steps/createUsers.js +7 -7
- package/dist/cli/users/steps/modifyUsers.js +2 -2
- package/dist/cli/users/steps/next.d.ts +1 -1
- package/dist/cli/utils/checkRequiredEnvVars.js +2 -2
- package/dist/cli/utils/context.d.ts +2 -4
- package/dist/cli/utils/context.js +1 -3
- package/dist/cli/utils/getCliDbClient.d.ts +1 -1
- package/dist/cli/utils/intro.d.ts +1 -1
- package/dist/cli/utils/loadConfig.d.ts +54 -49
- package/dist/cli/utils/loadConfig.js +5 -8
- package/dist/cli/utils/logger.js +3 -3
- package/dist/cli/utils/user-utils.d.ts +1 -1
- package/dist/cli/utils/user-utils.js +4 -3
- package/dist/client/apiClient.d.ts +4923 -0
- package/dist/client/apiClient.js +72 -0
- package/dist/config.d.ts +1734 -1
- package/dist/consts.d.ts +5 -5
- package/dist/consts.js +3 -2
- package/dist/db/plugins.d.ts +1 -1
- package/dist/db/plugins.js +5 -8
- package/dist/handlers/frontend/routes.d.ts +4 -18
- package/dist/handlers/frontend/routes.js +13 -152
- package/dist/handlers/frontend/types.d.ts +1 -1
- package/dist/handlers/frontend/utils.js +0 -18
- package/dist/handlers/pluginHandler.d.ts +34 -257
- package/dist/handlers/pluginHandler.js +92 -46
- package/dist/handlers/routeHandler.js +32 -11
- package/dist/handlers/setupDbStudio.d.ts +3 -1
- package/dist/handlers/setupDbStudio.js +19 -10
- package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
- package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
- package/dist/handlers/storage-manager/no-op.d.ts +2 -2
- package/dist/handlers/storage-manager/no-op.js +2 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -20
- package/dist/integrations/robots/index.d.ts +2 -2
- package/dist/integrations/robots/index.js +1 -3
- package/dist/integrations/robots/schema.d.ts +102 -273
- package/dist/integrations/robots/schema.js +220 -209
- package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
- package/dist/plugins/analytics/assets/schemas.js +25 -17
- package/dist/plugins/analytics/db-client.d.ts +1 -1
- package/dist/plugins/analytics/index.d.ts +823 -3
- package/dist/plugins/analytics/index.js +4 -5
- package/dist/plugins/analytics/schemas.d.ts +54 -62
- package/dist/plugins/analytics/schemas.js +64 -13
- package/dist/plugins/analytics/table.d.ts +1 -1
- package/dist/plugins.d.ts +0 -1
- package/dist/schemas/config/api.d.ts +17 -0
- package/dist/schemas/config/api.js +14 -0
- package/dist/schemas/config/auth.d.ts +55 -59
- package/dist/schemas/config/auth.js +34 -11
- package/dist/schemas/config/dashboard.d.ts +43 -79
- package/dist/schemas/config/dashboard.js +43 -12
- package/dist/schemas/config/db.d.ts +15 -17
- package/dist/schemas/config/db.js +13 -5
- package/dist/schemas/config/developer.d.ts +33 -45
- package/dist/schemas/config/developer.js +22 -5
- package/dist/schemas/config/index.d.ts +398 -521
- package/dist/schemas/config/index.js +115 -57
- package/dist/schemas/config/sdk.d.ts +50 -196
- package/dist/schemas/config/sdk.js +61 -73
- package/dist/schemas/custom.d.ts +40 -0
- package/dist/schemas/custom.js +41 -0
- package/dist/schemas/external-schemas.d.ts +171 -0
- package/dist/schemas/external-schemas.js +179 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/i18n.d.ts +59 -39
- package/dist/schemas/plugins/i18n.js +42 -5
- package/dist/schemas/plugins/index.d.ts +7126 -10296
- package/dist/schemas/plugins/index.js +260 -276
- package/dist/schemas/plugins/shared.d.ts +1293 -3718
- package/dist/schemas/plugins/shared.js +320 -329
- package/dist/test-utils.d.ts +15 -4
- package/dist/test-utils.js +27 -11
- package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
- package/dist/toolbar/db-viewer/studio/connection.d.ts +8 -4
- package/dist/toolbar/db-viewer/studio/connection.js +2 -28
- package/dist/toolbar/db-viewer/studio/env/libsql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/libsql.js +17 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.js +23 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.js +23 -0
- package/dist/toolbar/db-viewer/studio/index.js +20 -56
- package/dist/toolbar/db-viewer/studio/type.d.ts +1 -2
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.js +24 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.js +9 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.js +9 -0
- package/dist/toolbar/db-viewer/viewer.js +20 -21
- package/dist/types.d.ts +30 -0
- package/dist/utils/effects/smtp.d.ts +1 -1
- package/dist/utils/lang-helper.d.ts +10 -2
- package/dist/virtual.d.ts +35 -28
- package/dist/virtuals/auth/core.d.ts +5 -5
- package/dist/virtuals/auth/verify-email.d.ts +6 -6
- package/dist/virtuals/components/Generator.astro +2 -2
- package/dist/virtuals/components/Renderer.astro +9 -1
- package/dist/virtuals/components/renderFn.d.ts +3 -1
- package/dist/virtuals/components/renderFn.js +18 -0
- package/dist/virtuals/lib/headDefaults.d.ts +4 -2
- package/dist/virtuals/lib/headDefaults.js +0 -2
- package/dist/virtuals/lib/routeMap.d.ts +0 -12
- package/dist/virtuals/lib/routeMap.js +2 -14
- package/dist/virtuals/mailer/index.d.ts +3 -3
- package/dist/virtuals/notifier/index.d.ts +5 -5
- package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
- package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
- package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
- package/dist/virtuals/template-engine/index.d.ts +4 -4
- package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
- package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
- package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
- package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
- package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
- package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
- package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
- package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
- package/frontend/components/dashboard/profile/APITokens.astro +219 -158
- package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
- package/frontend/components/dashboard/profile/Notifications.astro +27 -18
- package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
- package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
- package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
- package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
- package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
- package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
- package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
- package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
- package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
- package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
- package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
- package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
- package/frontend/components/shared/Code.astro +1 -4
- package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
- package/frontend/components/shared/SSRUser.astro +2 -4
- package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
- package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
- package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
- package/frontend/layouts/DashboardLayout.astro +1 -10
- package/frontend/layouts/TaxonomyLayout.astro +0 -1
- package/frontend/middleware/index.ts +102 -61
- package/frontend/pages/404.astro +5 -9
- package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
- package/frontend/pages/[dashboard]/configuration.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
- package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
- package/frontend/pages/[dashboard]/index.astro +10 -1
- package/frontend/pages/[dashboard]/login.astro +86 -25
- package/frontend/pages/[dashboard]/password-reset.astro +22 -16
- package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
- package/frontend/pages/[dashboard]/profile.astro +10 -1
- package/frontend/pages/[dashboard]/signup.astro +153 -52
- package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
- package/frontend/pages/[dashboard]/system-management.astro +10 -1
- package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
- package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
- package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
- package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
- package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
- package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
- package/frontend/pages/studiocms_api/[...all].ts +106 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
- package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
- package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
- package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
- package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
- package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
- package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
- package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
- package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
- package/frontend/scripts/formdata.ts +219 -0
- package/frontend/setup-pages/3-done.astro +4 -20
- package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
- package/frontend/styles/dashboard-base.css +0 -1
- package/frontend/web-vitals/endpoint.ts +2 -1
- package/package.json +35 -31
- package/dist/global.d.ts +0 -9
- package/frontend/components/dashboard/LoginChecker.astro +0 -68
- package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
- package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
- package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
- package/frontend/middleware/_authmap.ts +0 -63
- package/frontend/pages/studiocms_api/auth/[path].ts +0 -390
- package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
- package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
- package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
- package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
- package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
- package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
- package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
- package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
- package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
- package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
- package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
- package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
- package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
- package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
- package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
- package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
- package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
- package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
- package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
- package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
- package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
- package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
- package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
- package/frontend/pages/studiocms_api/partials/render.astro +0 -39
- package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
- package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
- package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
- package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
- package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
- package/frontend/scripts/auth/formListener.ts +0 -81
- package/frontend/scripts/formdata-utils.ts +0 -116
- package/frontend/utils/build-partial-schema.ts +0 -46
- package/frontend/utils/errors.ts +0 -6
- package/frontend/utils/param-extractor.ts +0 -83
- package/frontend/utils/rest-router.ts +0 -444
|
@@ -13,6 +13,7 @@ import { Select } from 'studiocms:ui/components/select';
|
|
|
13
13
|
import { TabItem, Tabs } from 'studiocms:ui/components/tabs';
|
|
14
14
|
import { Toggle } from 'studiocms:ui/components/toggle';
|
|
15
15
|
import { Effect, genLogger, runEffect } from '@withstudiocms/effect';
|
|
16
|
+
import { setDataContext } from '@withstudiocms/effect/astro/data-middleware';
|
|
16
17
|
import PageHeader from '../../components/dashboard/PageHeader.astro';
|
|
17
18
|
import TemplateEditor from '../../components/dashboard/smtp-config/TemplateEditor.astro';
|
|
18
19
|
import Layout from '../../layouts/DashboardLayout.astro';
|
|
@@ -51,12 +52,20 @@ if (!mailerConfig) {
|
|
|
51
52
|
const notificationSettingKeys = Object.keys(notificationSettings.data).filter(
|
|
52
53
|
(key) => key !== '_config_version'
|
|
53
54
|
) as Array<keyof ConfigFinal<StudioCMSNotificationSettings>>;
|
|
55
|
+
|
|
56
|
+
setDataContext(Astro, {
|
|
57
|
+
key: 'x-required-role',
|
|
58
|
+
value: 'owner',
|
|
59
|
+
});
|
|
60
|
+
setDataContext(Astro, {
|
|
61
|
+
key: 'x-redirect-url',
|
|
62
|
+
value: Astro.locals.StudioCMS.routeMap.mainLinks.dashboardIndex,
|
|
63
|
+
});
|
|
54
64
|
---
|
|
55
65
|
|
|
56
66
|
<Layout
|
|
57
67
|
title={t("title")}
|
|
58
68
|
description={t("description")}
|
|
59
|
-
requiredPermission="owner"
|
|
60
69
|
{lang}
|
|
61
70
|
{config}
|
|
62
71
|
{currentUser}
|
|
@@ -390,7 +399,9 @@ const notificationSettingKeys = Object.keys(notificationSettings.data).filter(
|
|
|
390
399
|
|
|
391
400
|
<script>
|
|
392
401
|
import { toast } from "studiocms:ui/components/toaster/client";
|
|
393
|
-
import { DbStudioElement } from '#db-studio/viewer'
|
|
402
|
+
import { DbStudioElement } from '#db-studio/viewer';
|
|
403
|
+
import { dashboardClient, dashboardSharedCatchTags } from 'studiocms:client/apiClients';
|
|
404
|
+
import * as Effect from 'effect/Effect';
|
|
394
405
|
|
|
395
406
|
// Define the custom element if not already defined
|
|
396
407
|
if (!customElements.get('db-studio')) {
|
|
@@ -437,40 +448,45 @@ const notificationSettingKeys = Object.keys(notificationSettings.data).filter(
|
|
|
437
448
|
|
|
438
449
|
const createNewConfig = formData.get("create-new-config") as string;
|
|
439
450
|
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
451
|
+
const createEffect = dashboardClient.pipe(
|
|
452
|
+
Effect.flatMap((client) =>
|
|
453
|
+
client.mailer.setupMailerConfig({
|
|
454
|
+
payload: data,
|
|
455
|
+
})
|
|
456
|
+
)
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
const updateEffect = dashboardClient.pipe(
|
|
460
|
+
Effect.flatMap((client) =>
|
|
461
|
+
client.mailer.updateMailerConfig({
|
|
462
|
+
payload: data,
|
|
463
|
+
})
|
|
464
|
+
)
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
const effectToRun = createNewConfig === "true" ? createEffect : updateEffect;
|
|
468
|
+
|
|
469
|
+
const response = await effectToRun.pipe(
|
|
470
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
471
|
+
Effect.runPromise
|
|
472
|
+
);
|
|
447
473
|
|
|
448
|
-
if (
|
|
474
|
+
if ('error' in response) {
|
|
449
475
|
toast({
|
|
450
|
-
title:
|
|
451
|
-
description:
|
|
452
|
-
type:
|
|
476
|
+
title: 'Error',
|
|
477
|
+
description: response.error,
|
|
478
|
+
type: 'danger',
|
|
453
479
|
});
|
|
454
480
|
return;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const result = await response.json();
|
|
458
|
-
|
|
459
|
-
if (result.message) {
|
|
481
|
+
} else {
|
|
460
482
|
toast({
|
|
461
|
-
title:
|
|
462
|
-
description:
|
|
463
|
-
type:
|
|
483
|
+
title: 'Success',
|
|
484
|
+
description: response.message || 'SMTP configuration saved successfully.',
|
|
485
|
+
type: 'success',
|
|
464
486
|
});
|
|
465
487
|
setTimeout(() => {
|
|
466
488
|
window.location.reload();
|
|
467
489
|
}, 1000);
|
|
468
|
-
} else {
|
|
469
|
-
toast({
|
|
470
|
-
title: "Error",
|
|
471
|
-
description: result.error,
|
|
472
|
-
type: "danger",
|
|
473
|
-
});
|
|
474
490
|
}
|
|
475
491
|
});
|
|
476
492
|
|
|
@@ -483,37 +499,30 @@ const notificationSettingKeys = Object.keys(notificationSettings.data).filter(
|
|
|
483
499
|
test_email: formData.get("test_email") as string,
|
|
484
500
|
};
|
|
485
501
|
|
|
486
|
-
const response = await
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
502
|
+
const response = await dashboardClient.pipe(
|
|
503
|
+
Effect.flatMap((client) =>
|
|
504
|
+
client.mailer.testEmailService({
|
|
505
|
+
payload: data,
|
|
506
|
+
})
|
|
507
|
+
),
|
|
508
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
509
|
+
Effect.runPromise
|
|
510
|
+
);
|
|
493
511
|
|
|
494
|
-
if (
|
|
512
|
+
if ('error' in response) {
|
|
495
513
|
toast({
|
|
496
|
-
title:
|
|
497
|
-
description:
|
|
498
|
-
type:
|
|
514
|
+
title: 'Error',
|
|
515
|
+
description: response.error,
|
|
516
|
+
type: 'danger',
|
|
499
517
|
});
|
|
500
518
|
return;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
const result = await response.json();
|
|
504
|
-
|
|
505
|
-
if (result.message) {
|
|
506
|
-
toast({
|
|
507
|
-
title: "Success",
|
|
508
|
-
description: result.message,
|
|
509
|
-
type: "success",
|
|
510
|
-
});
|
|
511
519
|
} else {
|
|
512
520
|
toast({
|
|
513
|
-
title:
|
|
514
|
-
description:
|
|
515
|
-
type:
|
|
521
|
+
title: 'Success',
|
|
522
|
+
description: response.message || 'Test email sent successfully.',
|
|
523
|
+
type: 'success',
|
|
516
524
|
});
|
|
525
|
+
return;
|
|
517
526
|
}
|
|
518
527
|
});
|
|
519
528
|
|
|
@@ -531,37 +540,30 @@ const notificationSettingKeys = Object.keys(notificationSettings.data).filter(
|
|
|
531
540
|
oAuthBypassVerification: formData.get("oAuthBypassVerification") === "on",
|
|
532
541
|
};
|
|
533
542
|
|
|
534
|
-
const response = await
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
543
|
+
const response = await dashboardClient.pipe(
|
|
544
|
+
Effect.flatMap((client) =>
|
|
545
|
+
client.emailNotifications.updateEmailNotificationsSettings({
|
|
546
|
+
payload: data,
|
|
547
|
+
})
|
|
548
|
+
),
|
|
549
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
550
|
+
Effect.runPromise
|
|
551
|
+
);
|
|
541
552
|
|
|
542
|
-
if (
|
|
553
|
+
if ('error' in response) {
|
|
543
554
|
toast({
|
|
544
|
-
title:
|
|
545
|
-
description:
|
|
546
|
-
type:
|
|
555
|
+
title: 'Error',
|
|
556
|
+
description: response.error,
|
|
557
|
+
type: 'danger',
|
|
547
558
|
});
|
|
548
559
|
return;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
const result = await response.json();
|
|
552
|
-
|
|
553
|
-
if (result.message) {
|
|
554
|
-
toast({
|
|
555
|
-
title: "Success",
|
|
556
|
-
description: result.message,
|
|
557
|
-
type: "success",
|
|
558
|
-
});
|
|
559
560
|
} else {
|
|
560
561
|
toast({
|
|
561
|
-
title:
|
|
562
|
-
description:
|
|
563
|
-
type:
|
|
562
|
+
title: 'Success',
|
|
563
|
+
description: response.message || 'Email notification settings updated successfully.',
|
|
564
|
+
type: 'success',
|
|
564
565
|
});
|
|
566
|
+
return;
|
|
565
567
|
}
|
|
566
568
|
});
|
|
567
569
|
</script>
|
|
@@ -6,6 +6,7 @@ import { isDefaultManager } from 'studiocms:storage-manager/name';
|
|
|
6
6
|
import { Button } from 'studiocms:ui/components/button';
|
|
7
7
|
import { Card } from 'studiocms:ui/components/card';
|
|
8
8
|
import { Icon } from 'studiocms:ui/components/icon';
|
|
9
|
+
import { setDataContext } from '@withstudiocms/effect/astro/data-middleware';
|
|
9
10
|
import { getConfig } from '#db-studio/config';
|
|
10
11
|
import ComponentRegistryUI from '#frontend/components/shared/ComponentRegistryUI.astro';
|
|
11
12
|
import StorageFileBrowser from '#frontend/components/shared/storage-manager/StorageFileBrowser.astro';
|
|
@@ -21,12 +22,20 @@ const userConfig = getConfig();
|
|
|
21
22
|
|
|
22
23
|
// Get component registry data
|
|
23
24
|
const registryData = getRegistryComponents();
|
|
25
|
+
|
|
26
|
+
setDataContext(Astro, {
|
|
27
|
+
key: 'x-required-role',
|
|
28
|
+
value: 'owner',
|
|
29
|
+
});
|
|
30
|
+
setDataContext(Astro, {
|
|
31
|
+
key: 'x-redirect-url',
|
|
32
|
+
value: Astro.locals.StudioCMS.routeMap.mainLinks.dashboardIndex,
|
|
33
|
+
});
|
|
24
34
|
---
|
|
25
35
|
|
|
26
36
|
<Layout
|
|
27
37
|
title={t("title")}
|
|
28
38
|
description={t("description")}
|
|
29
|
-
requiredPermission="owner"
|
|
30
39
|
{lang}
|
|
31
40
|
{config}
|
|
32
41
|
{currentUser}
|
|
@@ -3,6 +3,7 @@ import { useTranslations } from 'studiocms:i18n';
|
|
|
3
3
|
import { runSDK, SDKCoreJs } from 'studiocms:sdk';
|
|
4
4
|
import { Input } from 'studiocms:ui/components/input';
|
|
5
5
|
import { Select } from 'studiocms:ui/components/select';
|
|
6
|
+
import { setDataContext } from '@withstudiocms/effect/astro/data-middleware';
|
|
6
7
|
import MetaContainer from '#frontend/components/dashboard/taxonomy/MetaContainer.astro';
|
|
7
8
|
import TaxonomyLayout from '#frontend/layouts/TaxonomyLayout.astro';
|
|
8
9
|
|
|
@@ -28,6 +29,15 @@ const filterCurrent = (categoryId: number | undefined) => {
|
|
|
28
29
|
}
|
|
29
30
|
return editId ? Number.parseInt(editId, 10) !== categoryId : true;
|
|
30
31
|
};
|
|
32
|
+
|
|
33
|
+
setDataContext(Astro, {
|
|
34
|
+
key: 'x-required-role',
|
|
35
|
+
value: 'editor',
|
|
36
|
+
});
|
|
37
|
+
setDataContext(Astro, {
|
|
38
|
+
key: 'x-redirect-url',
|
|
39
|
+
value: Astro.locals.StudioCMS.routeMap.mainLinks.dashboardIndex,
|
|
40
|
+
});
|
|
31
41
|
---
|
|
32
42
|
|
|
33
43
|
<TaxonomyLayout type="categories">
|
|
@@ -117,6 +127,8 @@ const filterCurrent = (categoryId: number | undefined) => {
|
|
|
117
127
|
parseFormDataToJson,
|
|
118
128
|
} from "./shared-client.js";
|
|
119
129
|
import { toast } from "studiocms:ui/components/toaster/client";
|
|
130
|
+
import { dashboardClient, dashboardSharedCatchTags } from 'studiocms:client/apiClients';
|
|
131
|
+
import * as Effect from 'effect/Effect';
|
|
120
132
|
|
|
121
133
|
const $ = <E extends HTMLElement>(
|
|
122
134
|
selector: string,
|
|
@@ -202,56 +214,33 @@ const filterCurrent = (categoryId: number | undefined) => {
|
|
|
202
214
|
const formData = new FormData(form);
|
|
203
215
|
const jsonData = parseFormDataToJson(formData, 'categories');
|
|
204
216
|
|
|
205
|
-
|
|
217
|
+
const response = await dashboardClient.pipe(
|
|
218
|
+
Effect.flatMap((client) =>
|
|
219
|
+
client.taxonomy.taxonomy({
|
|
220
|
+
payload: jsonData,
|
|
221
|
+
})
|
|
222
|
+
),
|
|
223
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
224
|
+
Effect.runPromise
|
|
225
|
+
);
|
|
206
226
|
|
|
207
|
-
|
|
208
|
-
response = await fetch(form.action, {
|
|
209
|
-
method: "POST",
|
|
210
|
-
headers: {
|
|
211
|
-
"Content-Type": "application/json",
|
|
212
|
-
},
|
|
213
|
-
body: JSON.stringify(jsonData),
|
|
214
|
-
});
|
|
215
|
-
} catch (error) {
|
|
227
|
+
if ("error" in response) {
|
|
216
228
|
toast({
|
|
217
229
|
title: "Error",
|
|
218
|
-
description:
|
|
219
|
-
"An error occurred while saving the category",
|
|
230
|
+
description: response.error,
|
|
220
231
|
type: "danger",
|
|
221
232
|
});
|
|
222
233
|
return;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (response.ok) {
|
|
226
|
-
const result: { message: string } =
|
|
227
|
-
await response.json();
|
|
228
|
-
if (response.status === 200) {
|
|
229
|
-
toast({
|
|
230
|
-
title: "Success",
|
|
231
|
-
description:
|
|
232
|
-
result.message || "Category saved successfully",
|
|
233
|
-
type: "success",
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
if (redirectUrl) {
|
|
237
|
-
window.location.href = redirectUrl;
|
|
238
|
-
}
|
|
239
|
-
} else {
|
|
240
|
-
toast({
|
|
241
|
-
title: "Error",
|
|
242
|
-
description:
|
|
243
|
-
result.message ||
|
|
244
|
-
"An error occurred while saving the category",
|
|
245
|
-
type: "danger",
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
234
|
} else {
|
|
249
235
|
toast({
|
|
250
|
-
title: "
|
|
251
|
-
description:
|
|
252
|
-
|
|
253
|
-
type: "danger",
|
|
236
|
+
title: "Success",
|
|
237
|
+
description: response.message || "Category saved successfully",
|
|
238
|
+
type: "success",
|
|
254
239
|
});
|
|
240
|
+
|
|
241
|
+
if (redirectUrl) {
|
|
242
|
+
window.location.href = redirectUrl;
|
|
243
|
+
}
|
|
255
244
|
}
|
|
256
245
|
});
|
|
257
246
|
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { useTranslations } from 'studiocms:i18n';
|
|
3
|
+
import { setDataContext } from '@withstudiocms/effect/astro/data-middleware';
|
|
3
4
|
import TaxonomyLayout from '#frontend/layouts/TaxonomyLayout.astro';
|
|
4
5
|
|
|
5
6
|
const { defaultLang: lang } = Astro.locals.StudioCMS;
|
|
6
7
|
|
|
7
8
|
const t = useTranslations(lang, '@studiocms/dashboard:taxonomy-index');
|
|
9
|
+
|
|
10
|
+
setDataContext(Astro, {
|
|
11
|
+
key: 'x-required-role',
|
|
12
|
+
value: 'editor',
|
|
13
|
+
});
|
|
14
|
+
setDataContext(Astro, {
|
|
15
|
+
key: 'x-redirect-url',
|
|
16
|
+
value: Astro.locals.StudioCMS.routeMap.mainLinks.dashboardIndex,
|
|
17
|
+
});
|
|
8
18
|
---
|
|
9
19
|
|
|
10
20
|
<TaxonomyLayout type='index'>
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { useTranslations } from 'studiocms:i18n';
|
|
3
3
|
import { Input } from 'studiocms:ui/components/input';
|
|
4
|
+
import { setDataContext } from '@withstudiocms/effect/astro/data-middleware';
|
|
4
5
|
import MetaContainer from '#frontend/components/dashboard/taxonomy/MetaContainer.astro';
|
|
5
6
|
import TaxonomyLayout from '#frontend/layouts/TaxonomyLayout.astro';
|
|
6
7
|
|
|
7
8
|
const { defaultLang: lang } = Astro.locals.StudioCMS;
|
|
8
9
|
|
|
9
10
|
const t = useTranslations(lang, '@studiocms/dashboard:taxonomy-index');
|
|
11
|
+
|
|
12
|
+
setDataContext(Astro, {
|
|
13
|
+
key: 'x-required-role',
|
|
14
|
+
value: 'editor',
|
|
15
|
+
});
|
|
16
|
+
setDataContext(Astro, {
|
|
17
|
+
key: 'x-redirect-url',
|
|
18
|
+
value: Astro.locals.StudioCMS.routeMap.mainLinks.dashboardIndex,
|
|
19
|
+
});
|
|
10
20
|
---
|
|
11
21
|
<TaxonomyLayout type='tags'>
|
|
12
22
|
<form
|
|
@@ -81,6 +91,8 @@ const t = useTranslations(lang, '@studiocms/dashboard:taxonomy-index');
|
|
|
81
91
|
<script>
|
|
82
92
|
import { getCurrentEntryData, parseFormDataToJson } from "./shared-client.js";
|
|
83
93
|
import { toast } from 'studiocms:ui/components/toaster/client';
|
|
94
|
+
import { dashboardClient, dashboardSharedCatchTags } from 'studiocms:client/apiClients';
|
|
95
|
+
import * as Effect from 'effect/Effect';
|
|
84
96
|
|
|
85
97
|
const $ = <E extends HTMLElement>(selector: string, context: Document | Element = document) =>
|
|
86
98
|
context.querySelector(selector) as E;
|
|
@@ -124,56 +136,34 @@ const t = useTranslations(lang, '@studiocms/dashboard:taxonomy-index');
|
|
|
124
136
|
const formData = new FormData(form);
|
|
125
137
|
const jsonData = parseFormDataToJson(formData, 'tags');
|
|
126
138
|
|
|
127
|
-
|
|
139
|
+
const response = await dashboardClient.pipe(
|
|
140
|
+
Effect.flatMap((client) =>
|
|
141
|
+
client.taxonomy.taxonomy({
|
|
142
|
+
payload: jsonData,
|
|
143
|
+
})
|
|
144
|
+
),
|
|
145
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
146
|
+
Effect.runPromise
|
|
147
|
+
);
|
|
128
148
|
|
|
129
|
-
|
|
130
|
-
response = await fetch(form.action, {
|
|
131
|
-
method: "POST",
|
|
132
|
-
headers: {
|
|
133
|
-
"Content-Type": "application/json",
|
|
134
|
-
},
|
|
135
|
-
body: JSON.stringify(jsonData),
|
|
136
|
-
});
|
|
137
|
-
} catch (error) {
|
|
149
|
+
if ('error' in response) {
|
|
138
150
|
toast({
|
|
139
|
-
title:
|
|
140
|
-
description:
|
|
141
|
-
|
|
142
|
-
type: "danger",
|
|
151
|
+
title: 'Error',
|
|
152
|
+
description: response.error,
|
|
153
|
+
type: 'danger',
|
|
143
154
|
});
|
|
144
155
|
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (response.ok) {
|
|
148
|
-
const result: { message: string } =
|
|
149
|
-
await response.json();
|
|
150
|
-
if (response.status === 200) {
|
|
151
|
-
toast({
|
|
152
|
-
title: "Success",
|
|
153
|
-
description:
|
|
154
|
-
result.message || "Tag saved successfully",
|
|
155
|
-
type: "success",
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
if (redirectUrl) {
|
|
159
|
-
window.location.href = redirectUrl;
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
toast({
|
|
163
|
-
title: "Error",
|
|
164
|
-
description:
|
|
165
|
-
result.message ||
|
|
166
|
-
"An error occurred while saving the tag",
|
|
167
|
-
type: "danger",
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
156
|
} else {
|
|
171
157
|
toast({
|
|
172
|
-
title:
|
|
173
|
-
description:
|
|
174
|
-
|
|
175
|
-
type: "danger",
|
|
158
|
+
title: 'Success',
|
|
159
|
+
description: response.message || 'Tag saved successfully.',
|
|
160
|
+
type: 'success',
|
|
176
161
|
});
|
|
162
|
+
|
|
163
|
+
if (redirectUrl) {
|
|
164
|
+
window.location.href = redirectUrl;
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
177
167
|
}
|
|
178
168
|
})
|
|
179
169
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import '../../styles/404.css';
|
|
3
3
|
import { useTranslations } from 'studiocms:i18n';
|
|
4
4
|
import { Button } from 'studiocms:ui/components/button';
|
|
5
|
+
import { setDataContext } from '@withstudiocms/effect/astro/data-middleware';
|
|
5
6
|
import Layout from '../../layouts/DashboardLayout.astro';
|
|
6
7
|
|
|
7
8
|
const { siteConfig: config, defaultLang: lang, security } = Astro.locals.StudioCMS;
|
|
@@ -15,13 +16,17 @@ const userId = currentUser?.user?.id;
|
|
|
15
16
|
if (!userId) {
|
|
16
17
|
return Astro.redirect(Astro.locals.StudioCMS.routeMap.authLinks.loginURL);
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
setDataContext(Astro, {
|
|
21
|
+
key: 'x-required-role',
|
|
22
|
+
value: 'none',
|
|
23
|
+
});
|
|
18
24
|
---
|
|
19
25
|
|
|
20
26
|
<Layout
|
|
21
27
|
title={t('title')}
|
|
22
28
|
description={t('description')}
|
|
23
29
|
sidebar={false}
|
|
24
|
-
requiredPermission="none"
|
|
25
30
|
{lang}
|
|
26
31
|
{config}
|
|
27
32
|
{currentUser}>
|
|
@@ -52,6 +57,8 @@ if (!userId) {
|
|
|
52
57
|
|
|
53
58
|
<script>
|
|
54
59
|
import { toast } from 'studiocms:ui/components/toaster/client';
|
|
60
|
+
import { dashboardClient, dashboardSharedCatchTags } from 'studiocms:client/apiClients';
|
|
61
|
+
import * as Effect from 'effect/Effect';
|
|
55
62
|
|
|
56
63
|
document.getElementById('back-button')!.addEventListener('click', () => {
|
|
57
64
|
window.location.href = '/';
|
|
@@ -61,34 +68,35 @@ if (!userId) {
|
|
|
61
68
|
|
|
62
69
|
resendButton.addEventListener('click', async () => {
|
|
63
70
|
const userId = resendButton.querySelector('div')!.dataset.userid;
|
|
64
|
-
const url = resendButton.querySelector('div')!.dataset.url;
|
|
65
71
|
|
|
66
|
-
if (!userId
|
|
72
|
+
if (!userId) {
|
|
67
73
|
return;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
|
-
const response = await
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const response = await dashboardClient.pipe(
|
|
77
|
+
Effect.flatMap((client) =>
|
|
78
|
+
client.verifyEndpoints.resendVerifyEmail({
|
|
79
|
+
payload: {
|
|
80
|
+
userId
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
),
|
|
84
|
+
Effect.catchTags(dashboardSharedCatchTags),
|
|
85
|
+
Effect.runPromise
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if ('error' in response) {
|
|
81
89
|
toast({
|
|
82
|
-
title: '
|
|
83
|
-
description:
|
|
84
|
-
type: '
|
|
85
|
-
})
|
|
90
|
+
title: 'Error',
|
|
91
|
+
description: response.error,
|
|
92
|
+
type: 'danger',
|
|
93
|
+
});
|
|
86
94
|
return;
|
|
87
95
|
} else {
|
|
88
96
|
toast({
|
|
89
|
-
title: '
|
|
90
|
-
description:
|
|
91
|
-
type: '
|
|
97
|
+
title: 'Success',
|
|
98
|
+
description: response.message || 'Verification email resent successfully.',
|
|
99
|
+
type: 'success',
|
|
92
100
|
});
|
|
93
101
|
return;
|
|
94
102
|
}
|