studiocms 0.1.0-beta.10
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 +501 -0
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/custom-renderers/index.ts +4 -0
- package/custom-renderers/markdocRenderers/markdocReact-components/MarkDocReactRenderer.tsx +8 -0
- package/custom-renderers/markdocRenderers/markdocReact-components/MarkDocReactWrapper.astro +13 -0
- package/custom-renderers/markdocRenderers/markdocReact.ts +56 -0
- package/dist/auth.d.js +0 -0
- package/dist/auth.d.ts +397 -0
- package/dist/cli/cmds/get-turso.d.ts +1 -0
- package/dist/cli/cmds/get-turso.js +10 -0
- package/dist/cli/cmds/init/index.d.ts +4 -0
- package/dist/cli/cmds/init/index.js +52 -0
- package/dist/cli/cmds/init/steps/data/studiocmsEnv.d.ts +3 -0
- package/dist/cli/cmds/init/steps/data/studiocmsEnv.js +71 -0
- package/dist/cli/cmds/init/steps/envBuilder.d.ts +21 -0
- package/dist/cli/cmds/init/steps/envBuilder.js +368 -0
- package/dist/cli/cmds/init/steps/nextSteps.d.ts +2 -0
- package/dist/cli/cmds/init/steps/nextSteps.js +38 -0
- package/dist/cli/cmds/init.d.ts +1 -0
- package/dist/cli/cmds/init.js +4 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/lib/commander.d.ts +39 -0
- package/dist/cli/lib/commander.js +87 -0
- package/dist/cli/lib/context.d.ts +28 -0
- package/dist/cli/lib/context.js +55 -0
- package/dist/cli/lib/pathUtil.d.ts +5 -0
- package/dist/cli/lib/pathUtil.js +14 -0
- package/dist/cli/lib/runExternal.d.ts +20 -0
- package/dist/cli/lib/runExternal.js +40 -0
- package/dist/cli/lib/seasonal.d.ts +5 -0
- package/dist/cli/lib/seasonal.js +88 -0
- package/dist/cli/lib/utils.d.ts +55 -0
- package/dist/cli/lib/utils.js +310 -0
- package/dist/cli/shared/intro.d.ts +2 -0
- package/dist/cli/shared/intro.js +24 -0
- package/dist/components/DefaultEditor.astro +138 -0
- package/dist/components/FormattedDate.astro +12 -0
- package/dist/components/Generator.astro +7 -0
- package/dist/components/Renderer.astro +13 -0
- package/dist/components/auth/OAuthButton.astro +21 -0
- package/dist/components/auth/OAuthButtonStack.astro +36 -0
- package/dist/components/auth/StaticAuthCheck.astro +20 -0
- package/dist/components/auth/StudioCMSLogoSVG.astro +13 -0
- package/dist/components/auth/oAuthButtonProviders.d.ts +8 -0
- package/dist/components/auth/oAuthButtonProviders.js +35 -0
- package/dist/components/dashboard/AstroCodeDiffsScript.astro +25 -0
- package/dist/components/dashboard/BaseHead.astro +41 -0
- package/dist/components/dashboard/Code.astro +23 -0
- package/dist/components/dashboard/DashboardPageHeader.astro +77 -0
- package/dist/components/dashboard/DoubleSidebar.astro +26 -0
- package/dist/components/dashboard/Footer.astro +16 -0
- package/dist/components/dashboard/MainSidebarContent.astro +317 -0
- package/dist/components/dashboard/PageHeader.astro +52 -0
- package/dist/components/dashboard/SidebarLink.astro +61 -0
- package/dist/components/dashboard/SidebarModals.astro +6 -0
- package/dist/components/dashboard/SidebarPluginLink.astro +45 -0
- package/dist/components/dashboard/SingleSidebar.astro +23 -0
- package/dist/components/dashboard/StudioCMSLogo.astro +12 -0
- package/dist/components/dashboard/ThemeManager.astro +53 -0
- package/dist/components/dashboard/component-scripts/TinyMDE.astro +6 -0
- package/dist/components/dashboard/component-scripts/dateTimeListener.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/dateTimeListener.js +14 -0
- package/dist/components/dashboard/component-scripts/dateWithTimeAndZone.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/dateWithTimeAndZone.js +12 -0
- package/dist/components/dashboard/component-scripts/makeClientRoutable.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/makeClientRoutable.js +9 -0
- package/dist/components/dashboard/component-scripts/timeAgo.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/timeAgo.js +21 -0
- package/dist/components/dashboard/islands/LoginChecker.astro +52 -0
- package/dist/components/dashboard/islands/configuration/ConfigForm.astro +317 -0
- package/dist/components/dashboard/islands/configuration/LightVsDark.astro +67 -0
- package/dist/components/dashboard/islands/content-mgmt/CreateFolder.astro +118 -0
- package/dist/components/dashboard/islands/content-mgmt/CreatePage.astro +380 -0
- package/dist/components/dashboard/islands/content-mgmt/EditFolder.astro +138 -0
- package/dist/components/dashboard/islands/content-mgmt/EditPage.astro +432 -0
- package/dist/components/dashboard/islands/content-mgmt/InnerSidebarElement.astro +299 -0
- package/dist/components/dashboard/islands/content-mgmt/PageHeader.astro +455 -0
- package/dist/components/dashboard/islands/content-mgmt/PageList.astro +49 -0
- package/dist/components/dashboard/islands/content-mgmt/PluginFields.astro +29 -0
- package/dist/components/dashboard/islands/content-mgmt/TreeRenderer.astro +75 -0
- package/dist/components/dashboard/islands/content-mgmt/TreeSidebarFolder.astro +53 -0
- package/dist/components/dashboard/islands/content-mgmt/TreeSidebarLink.astro +51 -0
- package/dist/components/dashboard/islands/content-mgmt/runtime.d.ts +10 -0
- package/dist/components/dashboard/islands/content-mgmt/runtime.js +33 -0
- package/dist/components/dashboard/islands/content-mgmt/shared.d.ts +27 -0
- package/dist/components/dashboard/islands/content-mgmt/shared.js +31 -0
- package/dist/components/dashboard/islands/dashboard/DashboardGrid.astro +39 -0
- package/dist/components/dashboard/islands/dashboard/DashboardGridItem.astro +34 -0
- package/dist/components/dashboard/islands/dashboard/Test.astro +5 -0
- package/dist/components/dashboard/islands/dashboard/UserName.astro +6 -0
- package/dist/components/dashboard/islands/dashboard/shared.d.ts +2 -0
- package/dist/components/dashboard/islands/dashboard/shared.js +0 -0
- package/dist/components/dashboard/islands/plugins/SettingsRenderer.astro +29 -0
- package/dist/components/dashboard/islands/profile/APITokens.astro +306 -0
- package/dist/components/dashboard/islands/profile/BasicInfo.astro +140 -0
- package/dist/components/dashboard/islands/profile/BasicInfoFallback.astro +43 -0
- package/dist/components/dashboard/islands/profile/SocialSignin.astro +181 -0
- package/dist/components/dashboard/islands/profile/SocialSigninFallback.astro +83 -0
- package/dist/components/dashboard/islands/profile/UpdatePassword.astro +166 -0
- package/dist/components/dashboard/islands/profile/UpdatePasswordFallback.astro +47 -0
- package/dist/components/dashboard/islands/profile/oAuthButtonProviders.d.ts +8 -0
- package/dist/components/dashboard/islands/profile/oAuthButtonProviders.js +35 -0
- package/dist/components/dashboard/islands/sidebar/UserAccount.astro +23 -0
- package/dist/components/dashboard/islands/sidebar/VersionCheck.astro +127 -0
- package/dist/components/dashboard/islands/sidebar/VersionCheckChangelog.astro +107 -0
- package/dist/components/dashboard/islands/user-mgmt/InnerSidebarElement.astro +348 -0
- package/dist/components/dashboard/islands/user-mgmt/RankCheck.astro +49 -0
- package/dist/components/dashboard/islands/user-mgmt/SocialSignin.astro +109 -0
- package/dist/components/dashboard/islands/user-mgmt/UserListItem.astro +60 -0
- package/dist/components/dashboard/sidebar-modals/UserManagementModals.astro +103 -0
- package/dist/components/dashboard/sidebar-modals/VersionModal.astro +267 -0
- package/dist/components/dashboard/sidebarConfig.d.ts +32 -0
- package/dist/components/dashboard/sidebarConfig.js +88 -0
- package/dist/components/default-grid-items/Recently-created-pages.astro +91 -0
- package/dist/components/default-grid-items/Recently-signed-up.astro +71 -0
- package/dist/components/default-grid-items/Recently-updated-pages.astro +96 -0
- package/dist/components/default-grid-items/Totals.astro +107 -0
- package/dist/components/default-grid-items/utils.d.ts +17 -0
- package/dist/components/default-grid-items/utils.js +26 -0
- package/dist/components/image/CustomImage.astro +90 -0
- package/dist/components/user-quick-tools.d.ts +42 -0
- package/dist/components/user-quick-tools.js +312 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +4 -0
- package/dist/consts.d.ts +61 -0
- package/dist/consts.js +39 -0
- package/dist/core.d.js +0 -0
- package/dist/core.d.ts +226 -0
- package/dist/db/config.d.ts +4 -0
- package/dist/db/config.js +6 -0
- package/dist/db/tables.js +168 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.js +11 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +1179 -0
- package/dist/layouts/auth/AuthLayout.astro +74 -0
- package/dist/layouts/auth/FallbackCanvas.astro +123 -0
- package/dist/layouts/auth/ThemeManager.astro +53 -0
- package/dist/layouts/auth/ThreeCanvasLoader.astro +18 -0
- package/dist/layouts/dashboard/Layout.astro +64 -0
- package/dist/lib/auth/encryption.d.ts +30 -0
- package/dist/lib/auth/encryption.js +39 -0
- package/dist/lib/auth/password.d.ts +27 -0
- package/dist/lib/auth/password.js +42 -0
- package/dist/lib/auth/rate-limit.d.ts +136 -0
- package/dist/lib/auth/rate-limit.js +214 -0
- package/dist/lib/auth/session.d.ts +85 -0
- package/dist/lib/auth/session.js +93 -0
- package/dist/lib/auth/types.d.ts +83 -0
- package/dist/lib/auth/types.js +0 -0
- package/dist/lib/auth/user.d.ts +148 -0
- package/dist/lib/auth/user.js +133 -0
- package/dist/lib/dashboardGrid.d.ts +119 -0
- package/dist/lib/dashboardGrid.js +0 -0
- package/dist/lib/dynamic-sitemap/index.d.ts +42 -0
- package/dist/lib/dynamic-sitemap/index.js +45 -0
- package/dist/lib/dynamic-sitemap/sitemap-index.xml.d.ts +8 -0
- package/dist/lib/dynamic-sitemap/sitemap-index.xml.js +20 -0
- package/dist/lib/dynamic-sitemap/sitemap-index.xml.ts +45 -0
- package/dist/lib/head.d.ts +9 -0
- package/dist/lib/head.js +65 -0
- package/dist/lib/headDefaults.d.ts +18 -0
- package/dist/lib/headDefaults.js +75 -0
- package/dist/lib/i18n/LanguageSelector.astro +114 -0
- package/dist/lib/i18n/client.d.ts +591 -0
- package/dist/lib/i18n/client.js +83 -0
- package/dist/lib/i18n/config.d.ts +16 -0
- package/dist/lib/i18n/config.js +8 -0
- package/dist/lib/i18n/index.d.ts +578 -0
- package/dist/lib/i18n/index.js +63 -0
- package/dist/lib/i18n/translations/de.json +64 -0
- package/dist/lib/i18n/translations/en-us.json +238 -0
- package/dist/lib/i18n/translations/es.json +64 -0
- package/dist/lib/i18n/translations/fr.json +64 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/jsonUtils.d.ts +2 -0
- package/dist/lib/jsonUtils.js +11 -0
- package/dist/lib/makeAPIRoute.d.ts +45 -0
- package/dist/lib/makeAPIRoute.js +16 -0
- package/dist/lib/makePublicRoute.d.ts +7 -0
- package/dist/lib/makePublicRoute.js +6 -0
- package/dist/lib/pathGenerators.d.ts +20 -0
- package/dist/lib/pathGenerators.js +66 -0
- package/dist/lib/plugins/dashboard-pages.d.ts +71 -0
- package/dist/lib/plugins/dashboard-pages.js +11 -0
- package/dist/lib/plugins/frontend-navigation.d.ts +18 -0
- package/dist/lib/plugins/frontend-navigation.js +39 -0
- package/dist/lib/plugins/index.d.ts +2 -0
- package/dist/lib/plugins/index.js +2 -0
- package/dist/lib/removeLeadingTrailingSlashes.d.ts +7 -0
- package/dist/lib/removeLeadingTrailingSlashes.js +13 -0
- package/dist/lib/renderer/astro-remark.d.ts +13 -0
- package/dist/lib/renderer/astro-remark.js +11 -0
- package/dist/lib/renderer/contentRenderer.d.ts +13 -0
- package/dist/lib/renderer/contentRenderer.js +31 -0
- package/dist/lib/renderer/errors.d.ts +5 -0
- package/dist/lib/renderer/errors.js +25 -0
- package/dist/lib/renderer/markdoc-renderers/markdocHTML.d.ts +3 -0
- package/dist/lib/renderer/markdoc-renderers/markdocHTML.js +14 -0
- package/dist/lib/renderer/markdoc-renderers/markdocReactStatic.d.ts +3 -0
- package/dist/lib/renderer/markdoc-renderers/markdocReactStatic.js +14 -0
- package/dist/lib/renderer/markdoc.d.ts +11 -0
- package/dist/lib/renderer/markdoc.js +28 -0
- package/dist/lib/renderer/mdx.d.ts +10 -0
- package/dist/lib/renderer/mdx.js +37 -0
- package/dist/lib/renderer/runtime.d.ts +8 -0
- package/dist/lib/renderer/runtime.js +30 -0
- package/dist/lib/renderer/shared.d.ts +15 -0
- package/dist/lib/renderer/shared.js +13 -0
- package/dist/lib/renderer/studiocms.d.ts +11 -0
- package/dist/lib/renderer/studiocms.js +22 -0
- package/dist/lib/renderer/types.d.ts +12 -0
- package/dist/lib/renderer/types.js +0 -0
- package/dist/lib/robots/core.d.ts +24 -0
- package/dist/lib/robots/core.js +187 -0
- package/dist/lib/robots/index.d.ts +11 -0
- package/dist/lib/robots/index.js +47 -0
- package/dist/lib/robots/types.d.ts +185 -0
- package/dist/lib/robots/types.js +0 -0
- package/dist/lib/robots/utils.d.ts +22 -0
- package/dist/lib/robots/utils.js +22 -0
- package/dist/lib/routeMap.d.ts +257 -0
- package/dist/lib/routeMap.js +249 -0
- package/dist/lib/urlGen.d.ts +11 -0
- package/dist/lib/urlGen.js +26 -0
- package/dist/lib/webVitals/checkForWebVitalsPlugin.d.ts +18 -0
- package/dist/lib/webVitals/checkForWebVitalsPlugin.js +82 -0
- package/dist/lib/webVitals/consts.d.ts +240 -0
- package/dist/lib/webVitals/consts.js +40 -0
- package/dist/lib/webVitals/dashboard-grid-items/CoreVitals.astro +66 -0
- package/dist/lib/webVitals/dashboard-grid-items/MetricCard.astro +24 -0
- package/dist/lib/webVitals/dashboard-grid-items/SummaryCard.astro +56 -0
- package/dist/lib/webVitals/dashboard-grid-items/metric.css +103 -0
- package/dist/lib/webVitals/dashboard-grid-items/shared.d.ts +29 -0
- package/dist/lib/webVitals/dashboard-grid-items/shared.js +35 -0
- package/dist/lib/webVitals/pages/analytics/body.astro +186 -0
- package/dist/lib/webVitals/pages/analytics/header.astro +42 -0
- package/dist/lib/webVitals/schemas.d.ts +78 -0
- package/dist/lib/webVitals/schemas.js +37 -0
- package/dist/lib/webVitals/types.d.ts +156 -0
- package/dist/lib/webVitals/types.js +0 -0
- package/dist/lib/webVitals/utils/buildDataObject.d.ts +8 -0
- package/dist/lib/webVitals/utils/buildDataObject.js +28 -0
- package/dist/lib/webVitals/utils/buildPageRouteDataObject.d.ts +15 -0
- package/dist/lib/webVitals/utils/buildPageRouteDataObject.js +70 -0
- package/dist/lib/webVitals/utils/buildPerPageDataObject.d.ts +23 -0
- package/dist/lib/webVitals/utils/buildPerPageDataObject.js +209 -0
- package/dist/lib/webVitals/utils/checkDate.d.ts +5 -0
- package/dist/lib/webVitals/utils/checkDate.js +19 -0
- package/dist/lib/webVitals/utils/webVitalsUtils.d.ts +24 -0
- package/dist/lib/webVitals/utils/webVitalsUtils.js +234 -0
- package/dist/lib/webVitals/webVital.d.ts +20 -0
- package/dist/lib/webVitals/webVital.js +40 -0
- package/dist/lib/webVitals/webVitalsRouteSummary.d.ts +19 -0
- package/dist/lib/webVitals/webVitalsRouteSummary.js +59 -0
- package/dist/lib/webVitals/webVitalsSummary.d.ts +19 -0
- package/dist/lib/webVitals/webVitalsSummary.js +49 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +6 -0
- package/dist/renderer.d.js +0 -0
- package/dist/renderer.d.ts +23 -0
- package/dist/routes/api/render.astro +25 -0
- package/dist/routes/auth/api/auth0/callback.d.ts +4 -0
- package/dist/routes/auth/api/auth0/callback.js +117 -0
- package/dist/routes/auth/api/auth0/index.d.ts +4 -0
- package/dist/routes/auth/api/auth0/index.js +36 -0
- package/dist/routes/auth/api/auth0/shared.d.ts +13 -0
- package/dist/routes/auth/api/auth0/shared.js +24 -0
- package/dist/routes/auth/api/discord/callback.d.ts +4 -0
- package/dist/routes/auth/api/discord/callback.js +112 -0
- package/dist/routes/auth/api/discord/index.d.ts +4 -0
- package/dist/routes/auth/api/discord/index.js +36 -0
- package/dist/routes/auth/api/discord/shared.d.ts +12 -0
- package/dist/routes/auth/api/discord/shared.js +17 -0
- package/dist/routes/auth/api/github/callback.d.ts +4 -0
- package/dist/routes/auth/api/github/callback.js +112 -0
- package/dist/routes/auth/api/github/index.d.ts +4 -0
- package/dist/routes/auth/api/github/index.js +36 -0
- package/dist/routes/auth/api/github/shared.d.ts +13 -0
- package/dist/routes/auth/api/github/shared.js +14 -0
- package/dist/routes/auth/api/google/callback.d.ts +4 -0
- package/dist/routes/auth/api/google/callback.js +115 -0
- package/dist/routes/auth/api/google/index.d.ts +4 -0
- package/dist/routes/auth/api/google/index.js +38 -0
- package/dist/routes/auth/api/google/shared.d.ts +12 -0
- package/dist/routes/auth/api/google/shared.js +19 -0
- package/dist/routes/auth/api/login.d.ts +4 -0
- package/dist/routes/auth/api/login.js +46 -0
- package/dist/routes/auth/api/logout.d.ts +5 -0
- package/dist/routes/auth/api/logout.js +55 -0
- package/dist/routes/auth/api/register.d.ts +4 -0
- package/dist/routes/auth/api/register.js +64 -0
- package/dist/routes/auth/api/shared.d.ts +2 -0
- package/dist/routes/auth/api/shared.js +21 -0
- package/dist/routes/auth/login.astro +118 -0
- package/dist/routes/auth/logout.astro +28 -0
- package/dist/routes/auth/signup.astro +124 -0
- package/dist/routes/dashboard/[...pluginPage].astro +88 -0
- package/dist/routes/dashboard/configuration.astro +61 -0
- package/dist/routes/dashboard/content-management/createfolder.astro +83 -0
- package/dist/routes/dashboard/content-management/createpage.astro +86 -0
- package/dist/routes/dashboard/content-management/diff.astro +135 -0
- package/dist/routes/dashboard/content-management/editfolder.astro +67 -0
- package/dist/routes/dashboard/content-management/editpage.astro +71 -0
- package/dist/routes/dashboard/content-management/index.astro +91 -0
- package/dist/routes/dashboard/index.astro +56 -0
- package/dist/routes/dashboard/password-reset.astro +206 -0
- package/dist/routes/dashboard/plugins/[plugin].astro +104 -0
- package/dist/routes/dashboard/profile.astro +87 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/api-tokens.d.ts +5 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/api-tokens.js +90 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/config.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/config.js +63 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/folder.d.ts +6 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/folder.js +121 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/page.d.ts +6 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/page.js +258 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-reset-link.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-reset-link.js +59 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user-invite.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user-invite.js +105 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user.js +100 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/partials/Editor.astro +61 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/partials/LiveRender.astro +30 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/partials/UserListItems.astro +39 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/plugins/[plugin].d.ts +2 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/plugins/[plugin].js +32 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/profile.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/profile.js +130 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/reset-password.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/reset-password.js +105 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/search-list.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/search-list.js +55 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/users.d.ts +5 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/users.js +92 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/verify-session.d.ts +2 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/verify-session.js +72 -0
- package/dist/routes/dashboard/user-management/edit.astro +631 -0
- package/dist/routes/dashboard/user-management/index.astro +103 -0
- package/dist/routes/error-pages/404.astro +66 -0
- package/dist/routes/firstTimeSetupRoutes/1-start.astro +253 -0
- package/dist/routes/firstTimeSetupRoutes/2-next.astro +208 -0
- package/dist/routes/firstTimeSetupRoutes/3-done.astro +95 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-1.d.ts +2 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-1.js +126 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-2.d.ts +2 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-2.js +110 -0
- package/dist/routes/firstTimeSetupRoutes/components/Layout.astro +41 -0
- package/dist/routes/firstTimeSetupRoutes/components/PageHeader.astro +60 -0
- package/dist/routes/firstTimeSetupRoutes/components/TabItem.astro +44 -0
- package/dist/routes/firstTimeSetupRoutes/components/Tabs.astro +170 -0
- package/dist/routes/firstTimeSetupRoutes/snippets/opt1-astro.config.diff +14 -0
- package/dist/routes/firstTimeSetupRoutes/snippets/opt2-astro.config.diff +9 -0
- package/dist/routes/firstTimeSetupRoutes/snippets/opt2-studiocms.config.diff +5 -0
- package/dist/routes/rest/utils/auth-token.d.ts +17 -0
- package/dist/routes/rest/utils/auth-token.js +31 -0
- package/dist/routes/rest/v1/folders/[id].d.ts +6 -0
- package/dist/routes/rest/v1/folders/[id].js +106 -0
- package/dist/routes/rest/v1/folders/index.d.ts +5 -0
- package/dist/routes/rest/v1/folders/index.js +88 -0
- package/dist/routes/rest/v1/pages/[id]/history/[diffid].d.ts +4 -0
- package/dist/routes/rest/v1/pages/[id]/history/[diffid].js +55 -0
- package/dist/routes/rest/v1/pages/[id]/history/index.d.ts +4 -0
- package/dist/routes/rest/v1/pages/[id]/history/index.js +61 -0
- package/dist/routes/rest/v1/pages/[id]/index.d.ts +6 -0
- package/dist/routes/rest/v1/pages/[id]/index.js +165 -0
- package/dist/routes/rest/v1/pages/index.d.ts +5 -0
- package/dist/routes/rest/v1/pages/index.js +113 -0
- package/dist/routes/rest/v1/public/folders/[id].d.ts +4 -0
- package/dist/routes/rest/v1/public/folders/[id].js +43 -0
- package/dist/routes/rest/v1/public/folders/index.d.ts +4 -0
- package/dist/routes/rest/v1/public/folders/index.js +49 -0
- package/dist/routes/rest/v1/public/pages/[id].d.ts +4 -0
- package/dist/routes/rest/v1/public/pages/[id].js +46 -0
- package/dist/routes/rest/v1/public/pages/index.d.ts +4 -0
- package/dist/routes/rest/v1/public/pages/index.js +61 -0
- package/dist/routes/rest/v1/settings/index.d.ts +5 -0
- package/dist/routes/rest/v1/settings/index.js +75 -0
- package/dist/routes/rest/v1/users/[id].d.ts +6 -0
- package/dist/routes/rest/v1/users/[id].js +212 -0
- package/dist/routes/rest/v1/users/index.d.ts +5 -0
- package/dist/routes/rest/v1/users/index.js +138 -0
- package/dist/routes/sdk/fallback-list-pages.json.d.ts +2 -0
- package/dist/routes/sdk/fallback-list-pages.json.js +19 -0
- package/dist/routes/sdk/fallback-list-pages.json.ts +22 -0
- package/dist/routes/sdk/full-changelog.json.d.ts +16 -0
- package/dist/routes/sdk/full-changelog.json.js +170 -0
- package/dist/routes/sdk/full-changelog.json.ts +224 -0
- package/dist/routes/sdk/list-pages.d.ts +4 -0
- package/dist/routes/sdk/list-pages.js +34 -0
- package/dist/routes/sdk/update-latest-version-cache.d.ts +4 -0
- package/dist/routes/sdk/update-latest-version-cache.js +41 -0
- package/dist/runtime/AstroComponentProxy.d.ts +29 -0
- package/dist/runtime/AstroComponentProxy.js +47 -0
- package/dist/runtime/decoder/decode-codepoint.d.ts +18 -0
- package/dist/runtime/decoder/decode-codepoint.js +58 -0
- package/dist/runtime/decoder/decode-data-html.d.ts +1 -0
- package/dist/runtime/decoder/decode-data-html.js +7 -0
- package/dist/runtime/decoder/decode-data-xml.d.ts +1 -0
- package/dist/runtime/decoder/decode-data-xml.js +7 -0
- package/dist/runtime/decoder/index.d.ts +34 -0
- package/dist/runtime/decoder/index.js +18 -0
- package/dist/runtime/decoder/util.d.ts +208 -0
- package/dist/runtime/decoder/util.js +415 -0
- package/dist/schemas/config/auth.d.ts +175 -0
- package/dist/schemas/config/auth.js +65 -0
- package/dist/schemas/config/componentoverrides.d.ts +17 -0
- package/dist/schemas/config/componentoverrides.js +14 -0
- package/dist/schemas/config/dashboard.d.ts +154 -0
- package/dist/schemas/config/dashboard.js +59 -0
- package/dist/schemas/config/defaultFrontend.d.ts +125 -0
- package/dist/schemas/config/defaultFrontend.js +57 -0
- package/dist/schemas/config/developer.d.ts +15 -0
- package/dist/schemas/config/developer.js +14 -0
- package/dist/schemas/config/imageService.d.ts +13 -0
- package/dist/schemas/config/imageService.js +12 -0
- package/dist/schemas/config/index.d.ts +1153 -0
- package/dist/schemas/config/index.js +95 -0
- package/dist/schemas/config/integrations.d.ts +14 -0
- package/dist/schemas/config/integrations.js +12 -0
- package/dist/schemas/config/markdoc.d.ts +172 -0
- package/dist/schemas/config/markdoc.js +68 -0
- package/dist/schemas/config/mdx.d.ts +455 -0
- package/dist/schemas/config/mdx.js +71 -0
- package/dist/schemas/config/rendererConfig.d.ts +659 -0
- package/dist/schemas/config/rendererConfig.js +51 -0
- package/dist/schemas/config/sdk.d.ts +167 -0
- package/dist/schemas/config/sdk.js +85 -0
- package/dist/schemas/config/studiocms-markdown-remark.d.ts +292 -0
- package/dist/schemas/config/studiocms-markdown-remark.js +63 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/index.d.ts +7373 -0
- package/dist/schemas/plugins/index.js +192 -0
- package/dist/schemas/plugins/shared.d.ts +1752 -0
- package/dist/schemas/plugins/shared.js +221 -0
- package/dist/scripts/formListener.d.ts +16 -0
- package/dist/scripts/formListener.js +46 -0
- package/dist/scripts/three.d.ts +1 -0
- package/dist/scripts/three.js +278 -0
- package/dist/scripts/utils/fitModelToViewport.d.ts +8 -0
- package/dist/scripts/utils/fitModelToViewport.js +19 -0
- package/dist/sdk/StudioCMSVirtualCache.d.ts +283 -0
- package/dist/sdk/StudioCMSVirtualCache.js +685 -0
- package/dist/sdk/cache.d.ts +11 -0
- package/dist/sdk/cache.js +12 -0
- package/dist/sdk/core.d.ts +865 -0
- package/dist/sdk/core.js +1966 -0
- package/dist/sdk/errors.d.ts +21 -0
- package/dist/sdk/errors.js +11 -0
- package/dist/sdk/index.d.ts +371 -0
- package/dist/sdk/index.js +8 -0
- package/dist/sdk/lib/foldertree.d.ts +50 -0
- package/dist/sdk/lib/foldertree.js +123 -0
- package/dist/sdk/lib/generators.d.ts +30 -0
- package/dist/sdk/lib/generators.js +25 -0
- package/dist/sdk/lib/packages.d.ts +8 -0
- package/dist/sdk/lib/packages.js +14 -0
- package/dist/sdk/lib/parsers.d.ts +14 -0
- package/dist/sdk/lib/parsers.js +10 -0
- package/dist/sdk/lib/users.d.ts +19 -0
- package/dist/sdk/lib/users.js +26 -0
- package/dist/sdk/tables.d.ts +1198 -0
- package/dist/sdk/tables.js +55 -0
- package/dist/sdk/types/index.d.ts +175 -0
- package/dist/sdk/types/index.js +0 -0
- package/dist/sdk/types/tableDefs.d.ts +75 -0
- package/dist/sdk/types/tableDefs.js +0 -0
- package/dist/sdk/types/tsAlias.d.ts +155 -0
- package/dist/sdk/types/tsAlias.js +0 -0
- package/dist/sdk/utils/db.d.ts +5 -0
- package/dist/sdk/utils/db.js +15 -0
- package/dist/stubs/auth-lib.d.ts +2 -0
- package/dist/stubs/auth-lib.js +519 -0
- package/dist/stubs/auth-scripts.d.ts +2 -0
- package/dist/stubs/auth-scripts.js +29 -0
- package/dist/stubs/auth-utils.d.ts +2 -0
- package/dist/stubs/auth-utils.js +36 -0
- package/dist/stubs/changelog.d.ts +2 -0
- package/dist/stubs/changelog.js +16 -0
- package/dist/stubs/components.d.ts +2 -0
- package/dist/stubs/components.js +67 -0
- package/dist/stubs/core.d.ts +2 -0
- package/dist/stubs/core.js +49 -0
- package/dist/stubs/i18n-dts.d.ts +2 -0
- package/dist/stubs/i18n-dts.js +117 -0
- package/dist/stubs/images.d.ts +1 -0
- package/dist/stubs/images.js +30 -0
- package/dist/stubs/index.d.ts +1 -0
- package/dist/stubs/index.js +40 -0
- package/dist/stubs/lib.d.ts +2 -0
- package/dist/stubs/lib.js +123 -0
- package/dist/stubs/plugins.d.ts +2 -0
- package/dist/stubs/plugins.js +60 -0
- package/dist/stubs/proxy.d.ts +2 -0
- package/dist/stubs/proxy.js +40 -0
- package/dist/stubs/renderer-config.d.ts +2 -0
- package/dist/stubs/renderer-config.js +18 -0
- package/dist/stubs/renderer-markdownConfig.d.ts +2 -0
- package/dist/stubs/renderer-markdownConfig.js +17 -0
- package/dist/stubs/renderer.d.ts +2 -0
- package/dist/stubs/renderer.js +44 -0
- package/dist/stubs/sdk.d.ts +2 -0
- package/dist/stubs/sdk.js +202 -0
- package/dist/stubs/webVitals.d.ts +2 -0
- package/dist/stubs/webVitals.js +40 -0
- package/dist/styles/404.css +47 -0
- package/dist/styles/SyntaxFont.woff2 +0 -0
- package/dist/styles/authlayout.css +138 -0
- package/dist/styles/dashboard-base.css +493 -0
- package/dist/styles/dashboard-code.css +33 -0
- package/dist/styles/dashboard-diff.css +389 -0
- package/dist/styles/dashboard-tiny-mde.css +224 -0
- package/dist/styles/md-remark-callouts/github.css +56 -0
- package/dist/styles/md-remark-callouts/obsidian.css +66 -0
- package/dist/styles/md-remark-callouts/vitepress.css +58 -0
- package/dist/styles/md-remark-headings.css +48 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.js +0 -0
- package/dist/utils/addAPIRoutes.d.ts +9 -0
- package/dist/utils/addAPIRoutes.js +33 -0
- package/dist/utils/addIntegrationArray.d.ts +24 -0
- package/dist/utils/addIntegrationArray.js +11 -0
- package/dist/utils/addIntegrationArrayWithCheck.d.ts +11 -0
- package/dist/utils/addIntegrationArrayWithCheck.js +24 -0
- package/dist/utils/astroConfigCheck.d.ts +8 -0
- package/dist/utils/astroConfigCheck.js +31 -0
- package/dist/utils/astroEnvConfig.d.ts +45 -0
- package/dist/utils/astroEnvConfig.js +9 -0
- package/dist/utils/authEnvCheck.d.ts +38 -0
- package/dist/utils/authEnvCheck.js +82 -0
- package/dist/utils/changelog.d.ts +1 -0
- package/dist/utils/changelog.js +53 -0
- package/dist/utils/changelogLoader.d.ts +15 -0
- package/dist/utils/changelogLoader.js +104 -0
- package/dist/utils/checkENV.d.ts +27 -0
- package/dist/utils/checkENV.js +115 -0
- package/dist/utils/configManager.d.ts +22 -0
- package/dist/utils/configManager.js +98 -0
- package/dist/utils/configResolver.d.ts +283 -0
- package/dist/utils/configResolver.js +105 -0
- package/dist/utils/defineStudioCMSConfig.d.ts +165 -0
- package/dist/utils/defineStudioCMSConfig.js +6 -0
- package/dist/utils/getLabelForPermissionLevel.d.ts +2 -0
- package/dist/utils/getLabelForPermissionLevel.js +17 -0
- package/dist/utils/injectRouteArray.d.ts +19 -0
- package/dist/utils/injectRouteArray.js +75 -0
- package/dist/utils/integrationLogger.d.ts +7 -0
- package/dist/utils/integrationLogger.js +18 -0
- package/dist/utils/integrations.d.ts +4 -0
- package/dist/utils/integrations.js +32 -0
- package/dist/utils/isDashboardRoute.d.ts +7 -0
- package/dist/utils/isDashboardRoute.js +10 -0
- package/dist/utils/loginBackgrounds/studiocms-blobs-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blobs-light.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blocks-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blocks-light.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-curves-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-curves-light.png +0 -0
- package/dist/utils/makePageTitle.d.ts +3 -0
- package/dist/utils/makePageTitle.js +7 -0
- package/dist/utils/pageListPackageLabel.d.ts +4 -0
- package/dist/utils/pageListPackageLabel.js +12 -0
- package/dist/utils/readJson.d.ts +1 -0
- package/dist/utils/readJson.js +7 -0
- package/dist/utils/routeBuilder.d.ts +18 -0
- package/dist/utils/routeBuilder.js +96 -0
- package/dist/utils/safeString.d.ts +1 -0
- package/dist/utils/safeString.js +6 -0
- package/dist/utils/simpleResponse.d.ts +1 -0
- package/dist/utils/simpleResponse.js +29 -0
- package/dist/utils/validImages.d.ts +13 -0
- package/dist/utils/validImages.js +39 -0
- package/dist/virtual.d.js +0 -0
- package/dist/virtual.d.ts +9 -0
- package/package.json +219 -0
- package/studiocms-cli.mjs +13 -0
- package/ui.d.ts +291 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
import 'studiocms:ui/global-css';
|
|
3
|
+
import '@fontsource-variable/onest/index.css';
|
|
4
|
+
import '../../styles/authlayout.css';
|
|
5
|
+
import { Generator } from 'studiocms:components';
|
|
6
|
+
import { Toaster } from 'studiocms:ui/components';
|
|
7
|
+
import onestWoff2 from '@fontsource-variable/onest/files/onest-latin-wght-normal.woff2?url';
|
|
8
|
+
import OAuthButtonStack from '../../components/auth/OAuthButtonStack.astro';
|
|
9
|
+
import StaticAuthCheck from '../../components/auth/StaticAuthCheck.astro';
|
|
10
|
+
import FallbackCanvas from './FallbackCanvas.astro';
|
|
11
|
+
import ThemeManager from './ThemeManager.astro';
|
|
12
|
+
import ThreeCanvasLoader from './ThreeCanvasLoader.astro';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
lang: string;
|
|
18
|
+
disableScreen?: boolean;
|
|
19
|
+
checkLogin?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { title, description, lang, disableScreen, checkLogin } = Astro.props;
|
|
23
|
+
---
|
|
24
|
+
<!doctype html>
|
|
25
|
+
<html {lang}>
|
|
26
|
+
<head>
|
|
27
|
+
{/* Global Metadata */}
|
|
28
|
+
<meta charset="utf-8" />
|
|
29
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
30
|
+
<Generator />
|
|
31
|
+
|
|
32
|
+
{/* Favicon */}
|
|
33
|
+
<link rel="icon" href="https://cdn.studiocms.dev/favicon.svg" type="image/svg+xml" />
|
|
34
|
+
<link rel="icon" href="https://cdn.studiocms.dev/favicon-light.png" type="image/svg+xml" media="(prefers-color-scheme: dark)" />
|
|
35
|
+
<link rel="icon" href="https://cdn.studiocms.dev/favicon-dark.png" type="image/png" media="(prefers-color-scheme: light)" />
|
|
36
|
+
|
|
37
|
+
{/* Primary Meta Tags */}
|
|
38
|
+
<title>{title}</title>
|
|
39
|
+
<meta name="title" content={title} />
|
|
40
|
+
<meta name="description" content={description} />
|
|
41
|
+
<meta name="theme-color" content="#a581f3" />
|
|
42
|
+
|
|
43
|
+
{/* Theme Manager */}
|
|
44
|
+
<ThemeManager />
|
|
45
|
+
|
|
46
|
+
{/* Fonts */}
|
|
47
|
+
<link rel="preload" as="font" type="font/woff2" crossorigin="anonymous" href={onestWoff2} />
|
|
48
|
+
</head>
|
|
49
|
+
<body>
|
|
50
|
+
<Toaster />
|
|
51
|
+
<main>
|
|
52
|
+
<div id="canvas-container">
|
|
53
|
+
<FallbackCanvas />
|
|
54
|
+
</div>
|
|
55
|
+
<div class="login-form-container">
|
|
56
|
+
|
|
57
|
+
<slot name="header" />
|
|
58
|
+
|
|
59
|
+
<slot />
|
|
60
|
+
|
|
61
|
+
{ !disableScreen && <OAuthButtonStack /> }
|
|
62
|
+
|
|
63
|
+
<div class="form-footer">
|
|
64
|
+
<slot name="footer" />
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
</div>
|
|
68
|
+
</main>
|
|
69
|
+
{ checkLogin && (
|
|
70
|
+
<StaticAuthCheck />
|
|
71
|
+
)}
|
|
72
|
+
<ThreeCanvasLoader />
|
|
73
|
+
</body>
|
|
74
|
+
</html>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Image } from 'astro:assets';
|
|
3
|
+
import { validImages } from 'studiocms:auth/utils/validImages';
|
|
4
|
+
import studioCMS_SDK_Cache from 'studiocms:sdk/cache';
|
|
5
|
+
import StudioCMSLogoSVG from '../../components/auth/StudioCMSLogoSVG.astro';
|
|
6
|
+
|
|
7
|
+
// Get the site config
|
|
8
|
+
const {
|
|
9
|
+
data: { loginPageBackground, loginPageCustomImage },
|
|
10
|
+
} = await studioCMS_SDK_Cache.GET.siteConfig();
|
|
11
|
+
|
|
12
|
+
const fallbackImageSrc =
|
|
13
|
+
loginPageBackground === 'custom'
|
|
14
|
+
? loginPageCustomImage
|
|
15
|
+
: validImages.find((x) => x.name !== 'custom' && x.name === loginPageBackground)?.dark;
|
|
16
|
+
---
|
|
17
|
+
<div class="fallback-container" id="fallback-config" data-config={JSON.stringify({ loginPageBackground, loginPageCustomImage })}>
|
|
18
|
+
<StudioCMSLogoSVG
|
|
19
|
+
class="static-logo"
|
|
20
|
+
/>
|
|
21
|
+
{typeof fallbackImageSrc === 'string' && (
|
|
22
|
+
<Image
|
|
23
|
+
src={fallbackImageSrc || ''}
|
|
24
|
+
inferSize
|
|
25
|
+
alt="A fallback image displaying because the interactive wallpaper couldn't be loaded."
|
|
26
|
+
class={'fallback-image'}
|
|
27
|
+
quality={100}
|
|
28
|
+
/>
|
|
29
|
+
)}
|
|
30
|
+
{typeof fallbackImageSrc !== 'string' && !!fallbackImageSrc && (
|
|
31
|
+
<Image
|
|
32
|
+
src={fallbackImageSrc}
|
|
33
|
+
alt="A fallback image displaying because the interactive wallpaper couldn't be loaded."
|
|
34
|
+
class={'fallback-image'}
|
|
35
|
+
quality={100}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import { validImages } from 'studiocms:auth/utils/validImages';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A valid image that can be used as a background for the StudioCMS Logo.
|
|
44
|
+
*/
|
|
45
|
+
type ValidImage = (typeof validImages)[number];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The parameters for the background image.
|
|
49
|
+
*/
|
|
50
|
+
type BackgroundParams = {
|
|
51
|
+
background: ValidImage['name'];
|
|
52
|
+
customImageHref: string;
|
|
53
|
+
mode: 'light' | 'dark';
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const imageHolder = document.querySelector('.fallback-image') as HTMLImageElement;
|
|
57
|
+
const currentMode = document.documentElement.dataset.theme || 'dark';
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Parses the background image config.
|
|
61
|
+
* @param imageName The name of the image to parse.
|
|
62
|
+
*/
|
|
63
|
+
function parseBackgroundImageConfig(imageName?: string | undefined): ValidImage['name'] {
|
|
64
|
+
// If the image name is not provided, use the default image
|
|
65
|
+
if (!imageName) {
|
|
66
|
+
return 'studiocms-curves';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Check if the image name is one of the valid images (built-in or custom)
|
|
70
|
+
if (imageName) {
|
|
71
|
+
return imageName as ValidImage['name'];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Use the default image if the image name is invalid
|
|
75
|
+
// (i.e. someone tampered with the actual database)
|
|
76
|
+
return 'studiocms-curves';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function parseToString(value: string | undefined | null): string {
|
|
80
|
+
return value || '';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const config: {
|
|
84
|
+
loginPageBackground: ValidImage['name'];
|
|
85
|
+
loginPageCustomImage: string;
|
|
86
|
+
} = JSON.parse((document.querySelector('#fallback-config') as HTMLDivElement).dataset.config ?? '{}');
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The parameters for the background image config.
|
|
90
|
+
*/
|
|
91
|
+
const backgroundConfig: BackgroundParams = {
|
|
92
|
+
background: parseBackgroundImageConfig(config.loginPageBackground),
|
|
93
|
+
customImageHref: parseToString(config.loginPageCustomImage),
|
|
94
|
+
mode: currentMode as 'light' | 'dark',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Gets the background config based on the parameters.
|
|
99
|
+
* @param config The config to get the background for.
|
|
100
|
+
*/
|
|
101
|
+
function getBackgroundConfig(config: BackgroundParams): ValidImage {
|
|
102
|
+
return validImages.find((image) => image.name === config.background) || validImages[0];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Selects the background based on the image.
|
|
107
|
+
* @param image The image to select the background for.
|
|
108
|
+
* @param params The parameters to select the background for.
|
|
109
|
+
*/
|
|
110
|
+
function bgSelector(image: ValidImage, params: BackgroundParams): string {
|
|
111
|
+
return (image.format === 'web'
|
|
112
|
+
? params.customImageHref
|
|
113
|
+
: params.mode === 'dark'
|
|
114
|
+
? image.dark?.src
|
|
115
|
+
: image.light?.src) ?? "";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const selectedBackground = getBackgroundConfig(backgroundConfig);
|
|
119
|
+
|
|
120
|
+
imageHolder.src = bgSelector(selectedBackground, backgroundConfig);
|
|
121
|
+
|
|
122
|
+
</script>
|
|
123
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script is:inline>
|
|
2
|
+
window.theme ??= (() => {
|
|
3
|
+
const defaultTheme = "system";
|
|
4
|
+
const storageKey = "studiocms-theme-preference";
|
|
5
|
+
const store =
|
|
6
|
+
typeof localStorage !== "undefined"
|
|
7
|
+
? localStorage
|
|
8
|
+
: { getItem: () => null, setItem: () => {} };
|
|
9
|
+
|
|
10
|
+
const mediaMatcher = window.matchMedia("(prefers-color-scheme: light)");
|
|
11
|
+
let systemTheme = mediaMatcher.matches ? "light" : "dark";
|
|
12
|
+
mediaMatcher.addEventListener("change", (event) => {
|
|
13
|
+
systemTheme = event.matches ? "light" : "dark";
|
|
14
|
+
applyTheme(theme.getTheme());
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
function applyTheme(theme) {
|
|
18
|
+
const resolvedTheme = theme === "system" ? systemTheme : theme;
|
|
19
|
+
document.documentElement.dataset.theme = resolvedTheme;
|
|
20
|
+
document.dispatchEvent(
|
|
21
|
+
new CustomEvent("theme-changed", {
|
|
22
|
+
detail: { theme, systemTheme, defaultTheme },
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function setTheme(theme = defaultTheme) {
|
|
28
|
+
store.setItem(storageKey, theme);
|
|
29
|
+
applyTheme(theme);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getTheme() {
|
|
33
|
+
return store.getItem(storageKey) || defaultTheme;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getSystemTheme() {
|
|
37
|
+
return systemTheme;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getDefaultTheme() {
|
|
41
|
+
return defaultTheme;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return { setTheme, getTheme, getSystemTheme, getDefaultTheme };
|
|
45
|
+
})();
|
|
46
|
+
theme.setTheme(theme.getTheme());
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
document.addEventListener("astro:after-swap", () =>
|
|
51
|
+
window.theme.setTheme(window.theme.getTheme()),
|
|
52
|
+
);
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import studioCMS_SDK_Cache from 'studiocms:sdk/cache';
|
|
3
|
+
|
|
4
|
+
// Get the site config
|
|
5
|
+
const {
|
|
6
|
+
data: { loginPageBackground, loginPageCustomImage },
|
|
7
|
+
} = await studioCMS_SDK_Cache.GET.siteConfig();
|
|
8
|
+
---
|
|
9
|
+
<div
|
|
10
|
+
style="display: none;"
|
|
11
|
+
id="auth-pages-config"
|
|
12
|
+
data-config_background={loginPageBackground}
|
|
13
|
+
data-config_custom_image={loginPageCustomImage}
|
|
14
|
+
/>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import "studiocms:auth/scripts/three";
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
import studioCMS_SDK_Cache from 'studiocms:sdk/cache';
|
|
3
|
+
import { Toaster } from 'studiocms:ui/components';
|
|
4
|
+
import BaseHead from '../../components/dashboard/BaseHead.astro';
|
|
5
|
+
import DoubleSidebar from '../../components/dashboard/DoubleSidebar.astro';
|
|
6
|
+
import SidebarModals from '../../components/dashboard/SidebarModals.astro';
|
|
7
|
+
import SingleSidebar from '../../components/dashboard/SingleSidebar.astro';
|
|
8
|
+
import LoginChecker from '../../components/dashboard/islands/LoginChecker.astro';
|
|
9
|
+
import { makePageTitle } from '../../utils/makePageTitle.js';
|
|
10
|
+
|
|
11
|
+
const { data: dbConfig } = await studioCMS_SDK_Cache.GET.siteConfig();
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
title: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
sidebar?: false | 'single' | 'double';
|
|
18
|
+
requiredPermission?: 'owner' | 'admin' | 'editor' | 'visitor' | 'unknown' | 'none';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
title: propTitle,
|
|
23
|
+
description: propDescription,
|
|
24
|
+
lang = 'en-us',
|
|
25
|
+
requiredPermission = 'unknown',
|
|
26
|
+
sidebar = 'single',
|
|
27
|
+
} = Astro.props;
|
|
28
|
+
|
|
29
|
+
const title = makePageTitle(propTitle, dbConfig);
|
|
30
|
+
const description = propDescription ?? dbConfig.description;
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<!DOCTYPE html>
|
|
34
|
+
<html {lang}>
|
|
35
|
+
<BaseHead {title} {description} />
|
|
36
|
+
<body>
|
|
37
|
+
<Toaster />
|
|
38
|
+
{ requiredPermission !== 'none' && (
|
|
39
|
+
<LoginChecker requiredPermission={requiredPermission} />
|
|
40
|
+
) }
|
|
41
|
+
<SidebarModals />
|
|
42
|
+
{ sidebar === 'single' && <SingleSidebar /> }
|
|
43
|
+
{ sidebar === 'double' && <DoubleSidebar><slot name="double-sidebar" /></DoubleSidebar> }
|
|
44
|
+
|
|
45
|
+
<main>
|
|
46
|
+
<div class="container">
|
|
47
|
+
|
|
48
|
+
<div class="page-header">
|
|
49
|
+
<slot name="header" />
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="container-content">
|
|
53
|
+
<slot />
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
</main>
|
|
58
|
+
<style>
|
|
59
|
+
.page-header {
|
|
60
|
+
margin-bottom: 1.5rem;
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
63
|
+
</body>
|
|
64
|
+
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encrypts the given data using AES-128-GCM encryption.
|
|
3
|
+
*
|
|
4
|
+
* @param data - The data to be encrypted as a Uint8Array.
|
|
5
|
+
* @returns The encrypted data as a Uint8Array, which includes the initialization vector (IV),
|
|
6
|
+
* the encrypted content, and the authentication tag.
|
|
7
|
+
*/
|
|
8
|
+
export declare function encrypt(data: Uint8Array): Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* Encrypts a given string and returns the encrypted data as a Uint8Array.
|
|
11
|
+
*
|
|
12
|
+
* @param data - The string to be encrypted.
|
|
13
|
+
* @returns The encrypted data as a Uint8Array.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encryptString(data: string): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Decrypts the given encrypted data using AES-128-GCM.
|
|
18
|
+
*
|
|
19
|
+
* @param encrypted - The encrypted data as a Uint8Array. The data must be at least 33 bytes long.
|
|
20
|
+
* @returns The decrypted data as a Uint8Array.
|
|
21
|
+
* @throws Will throw an error if the encrypted data is less than 33 bytes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function decrypt(encrypted: Uint8Array): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Decrypts the given Uint8Array data and returns the result as a string.
|
|
26
|
+
*
|
|
27
|
+
* @param data - The encrypted data as a Uint8Array.
|
|
28
|
+
* @returns The decrypted data as a string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function decryptToString(data: Uint8Array): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createCipheriv, createDecipheriv } from "node:crypto";
|
|
2
|
+
import { CMS_ENCRYPTION_KEY } from "astro:env/server";
|
|
3
|
+
import { DynamicBuffer } from "@oslojs/binary";
|
|
4
|
+
import { decodeBase64 } from "@oslojs/encoding";
|
|
5
|
+
const key = decodeBase64(CMS_ENCRYPTION_KEY);
|
|
6
|
+
function encrypt(data) {
|
|
7
|
+
const iv = new Uint8Array(16);
|
|
8
|
+
crypto.getRandomValues(iv);
|
|
9
|
+
const cipher = createCipheriv("aes-128-gcm", key, iv);
|
|
10
|
+
const encrypted = new DynamicBuffer(0);
|
|
11
|
+
encrypted.write(iv);
|
|
12
|
+
encrypted.write(cipher.update(data));
|
|
13
|
+
encrypted.write(cipher.final());
|
|
14
|
+
encrypted.write(cipher.getAuthTag());
|
|
15
|
+
return encrypted.bytes();
|
|
16
|
+
}
|
|
17
|
+
function encryptString(data) {
|
|
18
|
+
return encrypt(new TextEncoder().encode(data));
|
|
19
|
+
}
|
|
20
|
+
function decrypt(encrypted) {
|
|
21
|
+
if (encrypted.byteLength < 33) {
|
|
22
|
+
throw new Error("Invalid data");
|
|
23
|
+
}
|
|
24
|
+
const decipher = createDecipheriv("aes-128-gcm", key, encrypted.slice(0, 16));
|
|
25
|
+
decipher.setAuthTag(encrypted.slice(encrypted.byteLength - 16));
|
|
26
|
+
const decrypted = new DynamicBuffer(0);
|
|
27
|
+
decrypted.write(decipher.update(encrypted.slice(16, encrypted.byteLength - 16)));
|
|
28
|
+
decrypted.write(decipher.final());
|
|
29
|
+
return decrypted.bytes();
|
|
30
|
+
}
|
|
31
|
+
function decryptToString(data) {
|
|
32
|
+
return new TextDecoder().decode(decrypt(data));
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
decrypt,
|
|
36
|
+
decryptToString,
|
|
37
|
+
encrypt,
|
|
38
|
+
encryptString
|
|
39
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hashes a plain text password using bcrypt.
|
|
3
|
+
*
|
|
4
|
+
* @param password - The plain text password to hash.
|
|
5
|
+
* @returns A promise that resolves to the hashed password.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hashPassword(password: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Verifies if the provided password matches the hashed password.
|
|
10
|
+
*
|
|
11
|
+
* @param hash - The hashed password to compare against.
|
|
12
|
+
* @param password - The plain text password to verify.
|
|
13
|
+
* @returns A promise that resolves to a boolean indicating whether the password matches the hash.
|
|
14
|
+
*/
|
|
15
|
+
export declare function verifyPasswordHash(hash: string, password: string): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Verifies the strength of a given password.
|
|
18
|
+
*
|
|
19
|
+
* The password must meet the following criteria:
|
|
20
|
+
* - Be between 6 and 255 characters in length.
|
|
21
|
+
* - Not be a known unsafe password.
|
|
22
|
+
* - Not be found in the pwned password database.
|
|
23
|
+
*
|
|
24
|
+
* @param password - The password to verify.
|
|
25
|
+
* @returns A promise that resolves to `true` if the password is strong/secure enough, otherwise `false`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function verifyPasswordStrength(password: string): Promise<boolean>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { scrypt as nodeScrypt } from "node:crypto";
|
|
2
|
+
import { CMS_ENCRYPTION_KEY } from "astro:env/server";
|
|
3
|
+
import { sha1 } from "@oslojs/crypto/sha1";
|
|
4
|
+
import { encodeHexLowerCase } from "@oslojs/encoding";
|
|
5
|
+
function scrypt(...opts) {
|
|
6
|
+
return new Promise((res, rej) => {
|
|
7
|
+
nodeScrypt(...opts, (err, derivedKey) => {
|
|
8
|
+
if (err) rej(err);
|
|
9
|
+
else res(derivedKey);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async function hashPassword(password) {
|
|
14
|
+
const hashedPassword = await scrypt(password, CMS_ENCRYPTION_KEY, 64, {});
|
|
15
|
+
return hashedPassword.toString();
|
|
16
|
+
}
|
|
17
|
+
async function verifyPasswordHash(hash, password) {
|
|
18
|
+
const passwordHash = await hashPassword(password);
|
|
19
|
+
return passwordHash === hash;
|
|
20
|
+
}
|
|
21
|
+
async function verifyPasswordStrength(password) {
|
|
22
|
+
if (password.length < 6 || password.length > 255) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const hash = encodeHexLowerCase(sha1(new TextEncoder().encode(password)));
|
|
26
|
+
const hashPrefix = hash.slice(0, 5);
|
|
27
|
+
const response = await fetch(`https://api.pwnedpasswords.com/range/${hashPrefix}`);
|
|
28
|
+
const data = await response.text();
|
|
29
|
+
const lines = data.split("\n");
|
|
30
|
+
for (const line of lines) {
|
|
31
|
+
const hashSuffix = line.slice(0, 35).toLowerCase();
|
|
32
|
+
if (hash === hashPrefix + hashSuffix) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
hashPassword,
|
|
40
|
+
verifyPasswordHash,
|
|
41
|
+
verifyPasswordStrength
|
|
42
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a token bucket that refills tokens at a specified interval.
|
|
3
|
+
* Used to control access to resources by limiting the number of tokens
|
|
4
|
+
* that can be consumed over time.
|
|
5
|
+
*
|
|
6
|
+
* @template _Key - The type of key used to identify individual token buckets.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RefillingTokenBucket<_Key> {
|
|
9
|
+
/**
|
|
10
|
+
* The maximum number of tokens that the bucket can hold.
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
max: number;
|
|
14
|
+
/**
|
|
15
|
+
* The interval in seconds at which tokens are refilled.
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
refillIntervalSeconds: number;
|
|
19
|
+
/**
|
|
20
|
+
* Initializes a new instance of the RefillingTokenBucket class.
|
|
21
|
+
*
|
|
22
|
+
* @param {number} max - The maximum number of tokens the bucket can hold.
|
|
23
|
+
* @param {number} refillIntervalSeconds - The refill interval in seconds.
|
|
24
|
+
*/
|
|
25
|
+
constructor(max: number, refillIntervalSeconds: number);
|
|
26
|
+
/**
|
|
27
|
+
* A map storing individual token buckets associated with specific keys.
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private storage;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if there are enough tokens available in the bucket for the specified key and cost.
|
|
33
|
+
*
|
|
34
|
+
* @param {_Key} key - The key associated with the token bucket.
|
|
35
|
+
* @param {number} cost - The number of tokens required.
|
|
36
|
+
* @returns {boolean} - Returns `true` if there are enough tokens; otherwise, `false`.
|
|
37
|
+
*/
|
|
38
|
+
check(key: _Key, cost: number): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Consumes tokens from the bucket for the specified key and cost.
|
|
41
|
+
*
|
|
42
|
+
* @param {_Key} key - The key associated with the token bucket.
|
|
43
|
+
* @param {number} cost - The number of tokens to consume.
|
|
44
|
+
* @returns {boolean} - Returns `true` if tokens were successfully consumed; otherwise, `false`.
|
|
45
|
+
*/
|
|
46
|
+
consume(key: _Key, cost: number): boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a throttler that limits the frequency of actions performed with a specified key.
|
|
50
|
+
* Uses incremental timeouts to delay repeated actions.
|
|
51
|
+
*
|
|
52
|
+
* @template _Key - The type of key used to identify throttling counters.
|
|
53
|
+
*/
|
|
54
|
+
export declare class Throttler<_Key> {
|
|
55
|
+
/**
|
|
56
|
+
* Array of timeout durations (in seconds) for each consecutive attempt.
|
|
57
|
+
* @type {number[]}
|
|
58
|
+
*/
|
|
59
|
+
timeoutSeconds: number[];
|
|
60
|
+
/**
|
|
61
|
+
* A map storing individual throttling counters associated with specific keys.
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private storage;
|
|
65
|
+
/**
|
|
66
|
+
* Initializes a new instance of the Throttler class.
|
|
67
|
+
*
|
|
68
|
+
* @param {number[]} timeoutSeconds - Array of timeout durations in seconds for each consecutive attempt.
|
|
69
|
+
*/
|
|
70
|
+
constructor(timeoutSeconds: number[]);
|
|
71
|
+
/**
|
|
72
|
+
* Attempts to consume an action for the specified key.
|
|
73
|
+
*
|
|
74
|
+
* @param {_Key} key - The key associated with the throttling counter.
|
|
75
|
+
* @returns {boolean} - Returns `true` if the action is allowed; otherwise, `false`.
|
|
76
|
+
*/
|
|
77
|
+
consume(key: _Key): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Resets the throttling counter for a specified key.
|
|
80
|
+
*
|
|
81
|
+
* @param {_Key} key - The key associated with the throttling counter to reset.
|
|
82
|
+
*/
|
|
83
|
+
reset(key: _Key): void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Represents a token bucket with tokens that expire after a specified duration.
|
|
87
|
+
* Used to control access to resources with tokens that reset after expiration.
|
|
88
|
+
*
|
|
89
|
+
* @template _Key - The type of key used to identify individual token buckets.
|
|
90
|
+
*/
|
|
91
|
+
export declare class ExpiringTokenBucket<_Key> {
|
|
92
|
+
/**
|
|
93
|
+
* The maximum number of tokens the bucket can hold.
|
|
94
|
+
* @type {number}
|
|
95
|
+
*/
|
|
96
|
+
max: number;
|
|
97
|
+
/**
|
|
98
|
+
* The duration (in seconds) after which tokens in the bucket expire.
|
|
99
|
+
* @type {number}
|
|
100
|
+
*/
|
|
101
|
+
expiresInSeconds: number;
|
|
102
|
+
/**
|
|
103
|
+
* A map storing individual expiring token buckets associated with specific keys.
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
106
|
+
private storage;
|
|
107
|
+
/**
|
|
108
|
+
* Initializes a new instance of the ExpiringTokenBucket class.
|
|
109
|
+
*
|
|
110
|
+
* @param {number} max - The maximum number of tokens the bucket can hold.
|
|
111
|
+
* @param {number} expiresInSeconds - The duration in seconds after which tokens expire.
|
|
112
|
+
*/
|
|
113
|
+
constructor(max: number, expiresInSeconds: number);
|
|
114
|
+
/**
|
|
115
|
+
* Checks if there are enough tokens available in the bucket for the specified key and cost.
|
|
116
|
+
*
|
|
117
|
+
* @param {_Key} key - The key associated with the token bucket.
|
|
118
|
+
* @param {number} cost - The number of tokens required.
|
|
119
|
+
* @returns {boolean} - Returns `true` if there are enough tokens or if the tokens have expired; otherwise, `false`.
|
|
120
|
+
*/
|
|
121
|
+
check(key: _Key, cost: number): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Consumes tokens from the bucket for the specified key and cost.
|
|
124
|
+
*
|
|
125
|
+
* @param {_Key} key - The key associated with the token bucket.
|
|
126
|
+
* @param {number} cost - The number of tokens to consume.
|
|
127
|
+
* @returns {boolean} - Returns `true` if tokens were successfully consumed; otherwise, `false`.
|
|
128
|
+
*/
|
|
129
|
+
consume(key: _Key, cost: number): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Resets the token bucket for a specified key, removing all tokens.
|
|
132
|
+
*
|
|
133
|
+
* @param {_Key} key - The key associated with the token bucket to reset.
|
|
134
|
+
*/
|
|
135
|
+
reset(key: _Key): void;
|
|
136
|
+
}
|