@cossackframework/cms 0.0.0-stage → 0.9.1
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/LICENSE +21 -0
- package/README.md +147 -2
- package/agent-docs.json +259 -0
- package/app/README.md +78 -0
- package/app/cossack-recipe.json +43 -0
- package/app/src/auth-bot-check.ts +32 -0
- package/app/src/auth-bot-token.ts +11 -0
- package/app/src/auth-input.ts +35 -0
- package/app/src/auth-options.ts +18 -0
- package/app/src/auth-providers.ts +16 -0
- package/app/src/auth.ts +1082 -0
- package/app/src/brand.ts +68 -0
- package/app/src/cms/ai.ts +54 -0
- package/app/src/cms/analytics.ts +33 -0
- package/app/src/cms/block-errors.ts +55 -0
- package/app/src/cms/block-inserter.ts +111 -0
- package/app/src/cms/block-panel.ts +68 -0
- package/app/src/cms/block-rows.ts +44 -0
- package/app/src/cms/block-tree.ts +585 -0
- package/app/src/cms/blocks.css +708 -0
- package/app/src/cms/builder.ts +126 -0
- package/app/src/cms/cache.ts +44 -0
- package/app/src/cms/carousel.client.ts +52 -0
- package/app/src/cms/collab/presence.ts +69 -0
- package/app/src/cms/collab/rich-text-collab.client.ts +197 -0
- package/app/src/cms/collab/rich-text-notes.client.ts +138 -0
- package/app/src/cms/collab/room.ts +881 -0
- package/app/src/cms/compare.client.ts +47 -0
- package/app/src/cms/condition-control.ts +109 -0
- package/app/src/cms/content-api.ts +143 -0
- package/app/src/cms/content.ts +524 -0
- package/app/src/cms/countdown.client.ts +37 -0
- package/app/src/cms/editor-layout-editor.ts +260 -0
- package/app/src/cms/editor-layout-view.ts +37 -0
- package/app/src/cms/editor.ts +381 -0
- package/app/src/cms/entry.ts +26 -0
- package/app/src/cms/feeds.ts +145 -0
- package/app/src/cms/field-controls.ts +222 -0
- package/app/src/cms/field-group-editor.ts +105 -0
- package/app/src/cms/field-group-view.ts +211 -0
- package/app/src/cms/form-view.ts +203 -0
- package/app/src/cms/form.client.ts +203 -0
- package/app/src/cms/guards.ts +27 -0
- package/app/src/cms/handoff.ts +202 -0
- package/app/src/cms/headings.ts +51 -0
- package/app/src/cms/icons.ts +80 -0
- package/app/src/cms/import.client.ts +16 -0
- package/app/src/cms/index.ts +191 -0
- package/app/src/cms/lightbox.client.ts +109 -0
- package/app/src/cms/machine.ts +118 -0
- package/app/src/cms/maintenance.ts +97 -0
- package/app/src/cms/manage.ts +1236 -0
- package/app/src/cms/mcp-tools.ts +388 -0
- package/app/src/cms/mcp.ts +242 -0
- package/app/src/cms/media-chooser.ts +123 -0
- package/app/src/cms/media-usage.ts +57 -0
- package/app/src/cms/middleware.ts +199 -0
- package/app/src/cms/middlewares.ts +13 -0
- package/app/src/cms/network-ui.ts +36 -0
- package/app/src/cms/network-view.ts +38 -0
- package/app/src/cms/notes-announce.ts +65 -0
- package/app/src/cms/notes-rail.ts +207 -0
- package/app/src/cms/notification-rules.ts +66 -0
- package/app/src/cms/recovery.ts +82 -0
- package/app/src/cms/replace.ts +63 -0
- package/app/src/cms/reserved-paths.ts +19 -0
- package/app/src/cms/rich-text-field.ts +325 -0
- package/app/src/cms/rich-text-schema.ts +91 -0
- package/app/src/cms/rich-text.client.ts +255 -0
- package/app/src/cms/search.client.ts +116 -0
- package/app/src/cms/seo-head.ts +78 -0
- package/app/src/cms/seo.ts +241 -0
- package/app/src/cms/settings-draft.ts +218 -0
- package/app/src/cms/settings-file.ts +127 -0
- package/app/src/cms/settings-form.ts +180 -0
- package/app/src/cms/settings-languages.ts +125 -0
- package/app/src/cms/settings-nav.ts +102 -0
- package/app/src/cms/settings-network.ts +151 -0
- package/app/src/cms/settings-permalinks.ts +114 -0
- package/app/src/cms/settings-scroll.ts +10 -0
- package/app/src/cms/settings-search.ts +77 -0
- package/app/src/cms/settings-section.ts +38 -0
- package/app/src/cms/share.client.ts +27 -0
- package/app/src/cms/site-editing.ts +219 -0
- package/app/src/cms/site-editor.client.ts +1008 -0
- package/app/src/cms/site-editor.ts +99 -0
- package/app/src/cms/site-export.ts +60 -0
- package/app/src/cms/site-forms.ts +143 -0
- package/app/src/cms/site-import.ts +28 -0
- package/app/src/cms/site-session.ts +36 -0
- package/app/src/cms/site-taskbar.ts +77 -0
- package/app/src/cms/site-view.ts +1014 -0
- package/app/src/cms/site.ts +1322 -0
- package/app/src/cms/sitemaps.ts +131 -0
- package/app/src/cms/stat.client.ts +56 -0
- package/app/src/cms/style-controls.ts +252 -0
- package/app/src/cms/tabs.client.ts +36 -0
- package/app/src/cms/taskbar.ts +134 -0
- package/app/src/cms/term-icons.ts +10 -0
- package/app/src/cms/traffic.ts +26 -0
- package/app/src/cms/ui.ts +170 -0
- package/app/src/cms/updates.ts +124 -0
- package/app/src/cms/uploads.ts +26 -0
- package/app/src/cms/worker.ts +13 -0
- package/app/src/config/auth.ts +30 -0
- package/app/src/config/cms.ts +18 -0
- package/app/src/dashboard/access.ts +344 -0
- package/app/src/dashboard/agent-icons.ts +44 -0
- package/app/src/dashboard/app-passwords.ts +74 -0
- package/app/src/dashboard/avatar-field.ts +58 -0
- package/app/src/dashboard/bulk.ts +53 -0
- package/app/src/dashboard/head.ts +29 -0
- package/app/src/dashboard/icons.ts +15 -0
- package/app/src/dashboard/list-table.ts +120 -0
- package/app/src/dashboard/modules/roles.ts +15 -0
- package/app/src/dashboard/modules/sessions.ts +15 -0
- package/app/src/dashboard/modules/settings.ts +15 -0
- package/app/src/dashboard/modules/users.ts +18 -0
- package/app/src/dashboard/page.ts +67 -0
- package/app/src/dashboard/registry.ts +13 -0
- package/app/src/dashboard/session-list.ts +98 -0
- package/app/src/dashboard/tabs.ts +26 -0
- package/app/src/dashboard/time-ago.ts +16 -0
- package/app/src/dashboard/types.ts +40 -0
- package/app/src/dashboard/user-sections.ts +172 -0
- package/app/src/lib/permissions.ts +84 -0
- package/app/src/middlewares/auth.ts +117 -0
- package/app/src/pages/(site)/[...path]/index.ts +609 -0
- package/app/src/pages/(site)/feed/[...rest]/index.ts +13 -0
- package/app/src/pages/(site)/feed/index.ts +12 -0
- package/app/src/pages/(site)/index.ts +11 -0
- package/app/src/pages/(site)/indexnow/[file]/index.ts +18 -0
- package/app/src/pages/(site)/layout.ts +219 -0
- package/app/src/pages/(site)/llms.txt/index.ts +23 -0
- package/app/src/pages/(site)/manifest.webmanifest/index.ts +29 -0
- package/app/src/pages/(site)/media/[id]/[name]/index.ts +59 -0
- package/app/src/pages/(site)/preview/[collection]/[id]/index.ts +115 -0
- package/app/src/pages/(site)/robots.txt/index.ts +29 -0
- package/app/src/pages/(site)/search/index.ts +36 -0
- package/app/src/pages/(site)/sitemap.xml/index.ts +26 -0
- package/app/src/pages/(site)/sitemaps/[file]/index.ts +33 -0
- package/app/src/pages/api/auth/session.ts +48 -0
- package/app/src/pages/api/cms/appearance/areas/[name].ts +12 -0
- package/app/src/pages/api/cms/appearance/areas/index.ts +6 -0
- package/app/src/pages/api/cms/appearance/locations/[location].ts +6 -0
- package/app/src/pages/api/cms/appearance/locations/index.ts +6 -0
- package/app/src/pages/api/cms/appearance/menus/[id].ts +12 -0
- package/app/src/pages/api/cms/appearance/menus/index.ts +13 -0
- package/app/src/pages/api/cms/appearance/themes/[name]/activate.ts +6 -0
- package/app/src/pages/api/cms/appearance/themes/index.ts +6 -0
- package/app/src/pages/api/cms/cache/purge.ts +6 -0
- package/app/src/pages/api/cms/collections/index.ts +6 -0
- package/app/src/pages/api/cms/commands/[plugin]/[command].ts +26 -0
- package/app/src/pages/api/cms/comments/[id].ts +9 -0
- package/app/src/pages/api/cms/comments/index.ts +126 -0
- package/app/src/pages/api/cms/comments/queue.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/autosave.ts +27 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/blocks/[block].ts +16 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/notes.ts +18 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/publish.ts +11 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/[revision]/index.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/[revision]/restore.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/index.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/unpublish.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry].ts +42 -0
- package/app/src/pages/api/cms/content/[collection]/index.ts +24 -0
- package/app/src/pages/api/cms/export/[collection].ts +37 -0
- package/app/src/pages/api/cms/forms/[slug]/index.ts +173 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/[submission]/files/[file].ts +25 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/export.ts +34 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/index.ts +24 -0
- package/app/src/pages/api/cms/import/[collection].ts +23 -0
- package/app/src/pages/api/cms/mcp.ts +29 -0
- package/app/src/pages/api/cms/me/index.ts +6 -0
- package/app/src/pages/api/cms/me/recent-blocks.ts +37 -0
- package/app/src/pages/api/cms/me/tokens/[id].ts +6 -0
- package/app/src/pages/api/cms/me/tokens/index.ts +13 -0
- package/app/src/pages/api/cms/media/[id].ts +6 -0
- package/app/src/pages/api/cms/media.ts +26 -0
- package/app/src/pages/api/cms/menus/[location].ts +14 -0
- package/app/src/pages/api/cms/network/sites/[id]/export.ts +15 -0
- package/app/src/pages/api/cms/network/sites/[id]/index.ts +9 -0
- package/app/src/pages/api/cms/network/sites/index.ts +14 -0
- package/app/src/pages/api/cms/notes/[id].ts +13 -0
- package/app/src/pages/api/cms/notes/index.ts +6 -0
- package/app/src/pages/api/cms/payments/webhook.ts +28 -0
- package/app/src/pages/api/cms/plugins/[name]/grant.ts +6 -0
- package/app/src/pages/api/cms/plugins/[name]/revoke.ts +6 -0
- package/app/src/pages/api/cms/plugins/index.ts +6 -0
- package/app/src/pages/api/cms/recovery.ts +29 -0
- package/app/src/pages/api/cms/redirects/index.ts +9 -0
- package/app/src/pages/api/cms/roles/index.ts +6 -0
- package/app/src/pages/api/cms/schema/[collection].ts +13 -0
- package/app/src/pages/api/cms/search.ts +16 -0
- package/app/src/pages/api/cms/settings/[group].ts +9 -0
- package/app/src/pages/api/cms/settings/index.ts +9 -0
- package/app/src/pages/api/cms/site-export.ts +34 -0
- package/app/src/pages/api/cms/taxonomies/index.ts +6 -0
- package/app/src/pages/api/cms/terms/[taxonomy]/[id].ts +12 -0
- package/app/src/pages/api/cms/terms/[taxonomy]/index.ts +9 -0
- package/app/src/pages/api/cms/uploads/[id]/complete.ts +15 -0
- package/app/src/pages/api/cms/uploads/[id]/index.ts +15 -0
- package/app/src/pages/api/cms/uploads/index.ts +26 -0
- package/app/src/pages/api/cms/users/[id]/index.ts +12 -0
- package/app/src/pages/api/cms/users/[id]/meta.ts +40 -0
- package/app/src/pages/api/cms/users/index.ts +12 -0
- package/app/src/pages/api/cms/webhooks/[id].ts +6 -0
- package/app/src/pages/api/cms/webhooks/index.ts +9 -0
- package/app/src/pages/auth/[provider]/callback.ts +11 -0
- package/app/src/pages/auth/[provider]/redirect.ts +9 -0
- package/app/src/pages/auth/forgot-password/index.ts +75 -0
- package/app/src/pages/auth/layout.ts +32 -0
- package/app/src/pages/auth/login/index.ts +198 -0
- package/app/src/pages/auth/magic/index.ts +68 -0
- package/app/src/pages/auth/register/index.ts +117 -0
- package/app/src/pages/auth/reset-password/index.ts +65 -0
- package/app/src/pages/auth/setup/index.ts +194 -0
- package/app/src/pages/auth/two-factor/index.ts +67 -0
- package/app/src/pages/auth/verify/index.ts +62 -0
- package/app/src/pages/dashboard/(cms)/appearance/customize/index.ts +263 -0
- package/app/src/pages/dashboard/(cms)/appearance/dashboard-menu/index.ts +241 -0
- package/app/src/pages/dashboard/(cms)/appearance/index.ts +89 -0
- package/app/src/pages/dashboard/(cms)/appearance/menus/[id]/index.ts +697 -0
- package/app/src/pages/dashboard/(cms)/appearance/menus/index.ts +145 -0
- package/app/src/pages/dashboard/(cms)/appearance/widgets/index.ts +279 -0
- package/app/src/pages/dashboard/(cms)/blocks/index.ts +84 -0
- package/app/src/pages/dashboard/(cms)/calendar/index.ts +92 -0
- package/app/src/pages/dashboard/(cms)/collections/[name]/index.ts +525 -0
- package/app/src/pages/dashboard/(cms)/collections/index.ts +72 -0
- package/app/src/pages/dashboard/(cms)/collections/new/index.ts +66 -0
- package/app/src/pages/dashboard/(cms)/comments/index.ts +237 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/[id]/index.ts +2382 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/[id]/revisions/index.ts +126 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/index.ts +693 -0
- package/app/src/pages/dashboard/(cms)/field-groups/[id]/index.ts +193 -0
- package/app/src/pages/dashboard/(cms)/field-groups/index.ts +65 -0
- package/app/src/pages/dashboard/(cms)/forms/[id]/submissions/[submission]/index.ts +279 -0
- package/app/src/pages/dashboard/(cms)/forms/[id]/submissions/index.ts +170 -0
- package/app/src/pages/dashboard/(cms)/forms/index.ts +171 -0
- package/app/src/pages/dashboard/(cms)/media/[id]/index.ts +317 -0
- package/app/src/pages/dashboard/(cms)/media/index.ts +156 -0
- package/app/src/pages/dashboard/(cms)/media/new/index.ts +9 -0
- package/app/src/pages/dashboard/(cms)/media/summary/index.ts +74 -0
- package/app/src/pages/dashboard/(cms)/my-sites/index.ts +63 -0
- package/app/src/pages/dashboard/(cms)/network/index.ts +53 -0
- package/app/src/pages/dashboard/(cms)/network/plugins/index.ts +110 -0
- package/app/src/pages/dashboard/(cms)/network/sites/[id]/index.ts +243 -0
- package/app/src/pages/dashboard/(cms)/network/sites/index.ts +186 -0
- package/app/src/pages/dashboard/(cms)/network/sites/new/index.ts +77 -0
- package/app/src/pages/dashboard/(cms)/network/themes/index.ts +82 -0
- package/app/src/pages/dashboard/(cms)/network/updates/index.ts +48 -0
- package/app/src/pages/dashboard/(cms)/network/users/[id]/index.ts +176 -0
- package/app/src/pages/dashboard/(cms)/network/users/index.ts +174 -0
- package/app/src/pages/dashboard/(cms)/network/users/new/index.ts +66 -0
- package/app/src/pages/dashboard/(cms)/plugins/index.ts +172 -0
- package/app/src/pages/dashboard/(cms)/profile/public/index.ts +105 -0
- package/app/src/pages/dashboard/(cms)/registrations/index.ts +70 -0
- package/app/src/pages/dashboard/(cms)/settings/index.ts +359 -0
- package/app/src/pages/dashboard/(cms)/settings/json/index.ts +202 -0
- package/app/src/pages/dashboard/(cms)/settings/layout.ts +67 -0
- package/app/src/pages/dashboard/(cms)/taxonomies/[name]/index.ts +85 -0
- package/app/src/pages/dashboard/(cms)/taxonomies/index.ts +98 -0
- package/app/src/pages/dashboard/(cms)/terms/[taxonomy]/[id]/index.ts +244 -0
- package/app/src/pages/dashboard/(cms)/terms/[taxonomy]/index.ts +148 -0
- package/app/src/pages/dashboard/(cms)/tools/activity/index.ts +94 -0
- package/app/src/pages/dashboard/(cms)/tools/automations/index.ts +131 -0
- package/app/src/pages/dashboard/(cms)/tools/cache/index.ts +92 -0
- package/app/src/pages/dashboard/(cms)/tools/export/index.ts +99 -0
- package/app/src/pages/dashboard/(cms)/tools/health/index.ts +189 -0
- package/app/src/pages/dashboard/(cms)/tools/jobs/index.ts +93 -0
- package/app/src/pages/dashboard/(cms)/tools/links/index.ts +115 -0
- package/app/src/pages/dashboard/(cms)/tools/redirects/index.ts +161 -0
- package/app/src/pages/dashboard/(cms)/tools/replace/index.ts +124 -0
- package/app/src/pages/dashboard/(cms)/tools/schema/index.ts +54 -0
- package/app/src/pages/dashboard/(cms)/tools/seo/index.ts +156 -0
- package/app/src/pages/dashboard/(cms)/tools/updates/index.ts +114 -0
- package/app/src/pages/dashboard/(cms)/tools/webhooks/index.ts +182 -0
- package/app/src/pages/dashboard/index.ts +214 -0
- package/app/src/pages/dashboard/layout.ts +320 -0
- package/app/src/pages/dashboard/profile/index.ts +211 -0
- package/app/src/pages/dashboard/profile/security/index.ts +255 -0
- package/app/src/pages/dashboard/roles/[id]/index.ts +116 -0
- package/app/src/pages/dashboard/roles/index.ts +134 -0
- package/app/src/pages/dashboard/roles/new/index.ts +95 -0
- package/app/src/pages/dashboard/sessions/index.ts +105 -0
- package/app/src/pages/dashboard/users/[id]/index.ts +472 -0
- package/app/src/pages/dashboard/users/index.ts +299 -0
- package/app/src/pages/dashboard/users/new/index.ts +123 -0
- package/app/src/passkeys.client.ts +18 -0
- package/app/src/plugins/default-theme/assets/cover.svg +31 -0
- package/app/src/plugins/default-theme/assets/logo.svg +8 -0
- package/app/src/plugins/default-theme/parts/comments.ts +66 -0
- package/app/src/plugins/default-theme/parts/list.ts +38 -0
- package/app/src/plugins/default-theme/parts/media.ts +15 -0
- package/app/src/plugins/default-theme/parts/options.ts +45 -0
- package/app/src/plugins/default-theme/plugin.json +275 -0
- package/app/src/plugins/default-theme/templates/archive.ts +14 -0
- package/app/src/plugins/default-theme/templates/entry-blank.ts +13 -0
- package/app/src/plugins/default-theme/templates/entry.ts +27 -0
- package/app/src/plugins/default-theme/templates/home.ts +8 -0
- package/app/src/plugins/default-theme/templates/layout.ts +40 -0
- package/app/src/plugins/default-theme/templates/not-found.ts +10 -0
- package/app/src/plugins/default-theme/templates/search.ts +32 -0
- package/app/src/services/rbac.ts +65 -0
- package/app/src/services/roles.ts +89 -0
- package/app/src/services/users.ts +173 -0
- package/package.json +123 -3
- package/src/automations.ts +95 -0
- package/src/bindings.ts +138 -0
- package/src/block-references.ts +239 -0
- package/src/block-shape.ts +155 -0
- package/src/blocks.ts +1157 -0
- package/src/cache.ts +54 -0
- package/src/checks.ts +198 -0
- package/src/cloudflare-workers.d.ts +13 -0
- package/src/cloudflare.ts +61 -0
- package/src/collab.ts +372 -0
- package/src/collections.ts +421 -0
- package/src/comments.ts +46 -0
- package/src/cron.ts +95 -0
- package/src/dashboard-menu.ts +105 -0
- package/src/diff.ts +113 -0
- package/src/editor-layout.ts +316 -0
- package/src/errors.ts +50 -0
- package/src/field-groups.ts +498 -0
- package/src/fields.ts +411 -0
- package/src/form-builder.ts +1053 -0
- package/src/forms.ts +109 -0
- package/src/highlight.ts +134 -0
- package/src/hooks.ts +510 -0
- package/src/icon-catalog.ts +55 -0
- package/src/icons.ts +128 -0
- package/src/images.ts +149 -0
- package/src/index.ts +100 -0
- package/src/isolate-core.ts +245 -0
- package/src/isolate.ts +19 -0
- package/src/isolation.ts +69 -0
- package/src/mail.ts +182 -0
- package/src/manifest.ts +476 -0
- package/src/media.ts +193 -0
- package/src/menus.ts +287 -0
- package/src/module.ts +32 -0
- package/src/modules/content.ts +64 -0
- package/src/modules/forms.ts +35 -0
- package/src/node.ts +66 -0
- package/src/notes.ts +237 -0
- package/src/permissions.ts +139 -0
- package/src/plugin-settings.ts +114 -0
- package/src/records.ts +56 -0
- package/src/redirects.ts +59 -0
- package/src/resource.ts +245 -0
- package/src/richtext.ts +402 -0
- package/src/schema-json.ts +112 -0
- package/src/search.ts +89 -0
- package/src/seo.ts +477 -0
- package/src/server/accounts.ts +418 -0
- package/src/server/ai.ts +33 -0
- package/src/server/api-tokens.ts +91 -0
- package/src/server/areas.ts +116 -0
- package/src/server/audit.ts +94 -0
- package/src/server/auth.ts +89 -0
- package/src/server/automations.ts +190 -0
- package/src/server/autosaves.ts +69 -0
- package/src/server/brand-icons.ts +50 -0
- package/src/server/brands.ts +86 -0
- package/src/server/budget.ts +97 -0
- package/src/server/cache.ts +104 -0
- package/src/server/capabilities.ts +333 -0
- package/src/server/cloudflare.ts +92 -0
- package/src/server/comments.ts +237 -0
- package/src/server/drafts.ts +176 -0
- package/src/server/field-groups.ts +88 -0
- package/src/server/files.ts +780 -0
- package/src/server/forms.ts +726 -0
- package/src/server/handoffs.ts +107 -0
- package/src/server/host-schema.ts +312 -0
- package/src/server/host.ts +2892 -0
- package/src/server/images.ts +34 -0
- package/src/server/index.ts +59 -0
- package/src/server/indexnow.ts +91 -0
- package/src/server/isolation.ts +183 -0
- package/src/server/locked.ts +45 -0
- package/src/server/mail.ts +93 -0
- package/src/server/markdown.ts +24 -0
- package/src/server/menus.ts +286 -0
- package/src/server/network-policy.ts +60 -0
- package/src/server/network.ts +665 -0
- package/src/server/notes.ts +275 -0
- package/src/server/outbox.ts +213 -0
- package/src/server/path-moves.ts +33 -0
- package/src/server/payments.ts +59 -0
- package/src/server/previews.ts +62 -0
- package/src/server/purge.ts +140 -0
- package/src/server/reconcile.ts +38 -0
- package/src/server/redirects.ts +183 -0
- package/src/server/repository.ts +1107 -0
- package/src/server/schedules.ts +105 -0
- package/src/server/schema.ts +562 -0
- package/src/server/security.ts +391 -0
- package/src/server/seed.ts +52 -0
- package/src/server/shared-fields.ts +34 -0
- package/src/server/site-export.ts +151 -0
- package/src/server/site-import.ts +482 -0
- package/src/server/site-search.ts +289 -0
- package/src/server/site-settings.ts +286 -0
- package/src/server/sites.ts +243 -0
- package/src/server/stores.ts +314 -0
- package/src/server/stripe.ts +173 -0
- package/src/server/taxonomies.ts +415 -0
- package/src/server/tokens.ts +25 -0
- package/src/server/traffic.ts +118 -0
- package/src/server/users.ts +653 -0
- package/src/server/webhooks.ts +245 -0
- package/src/settings-controls.ts +54 -0
- package/src/settings-document.ts +111 -0
- package/src/settings.ts +426 -0
- package/src/storage/cloudflare.ts +94 -0
- package/src/storage/index.ts +30 -0
- package/src/storage/node.ts +114 -0
- package/src/taxonomy.ts +51 -0
- package/src/theme.ts +1135 -0
- package/src/to-markdown.ts +179 -0
- package/src/updates.ts +126 -0
- package/src/version.ts +2 -0
- package/src/vite.d.ts +25 -0
- package/src/vite.js +199 -0
- package/src/webhooks.ts +107 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Cossack, Page, State, flash, flashed, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Card, CardBody, Checkbox } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { isCmsError, isSameOriginPost } from '@cossackframework/cms';
|
|
5
|
+
import { notice, pageHeader } from '#app/cms/ui';
|
|
6
|
+
import { requireNetworkAdmin } from '#app/cms/guards';
|
|
7
|
+
import { network } from '#app/cms/network-ui';
|
|
8
|
+
import { field, submitButton } from '#app/cms/network-view';
|
|
9
|
+
|
|
10
|
+
interface NewSiteForm { name: string; host: string; language: string; admin: string; starter: boolean }
|
|
11
|
+
|
|
12
|
+
/** Add site: a name, an address under the network, a language, the first administrator and starter content. */
|
|
13
|
+
@Page({ transport: 'http', middlewares: [requireNetworkAdmin()] })
|
|
14
|
+
export default class NewNetworkSite extends Cossack {
|
|
15
|
+
@State() form: NewSiteForm = { name: '', host: '', language: 'en', admin: '', starter: true };
|
|
16
|
+
@State() suffix = '';
|
|
17
|
+
@State() canAdd = false;
|
|
18
|
+
@State() error = '';
|
|
19
|
+
|
|
20
|
+
head(): HeadValue {
|
|
21
|
+
return { title: 'Add site' };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async init() {
|
|
25
|
+
const net = network(this.c);
|
|
26
|
+
const settings = await net.settings();
|
|
27
|
+
this.suffix = settings.subdomainSuffix || net.subdomainSuffix;
|
|
28
|
+
this.canAdd = net.canAddSites;
|
|
29
|
+
// A failed attempt comes back with what was typed.
|
|
30
|
+
this.form = flashed<NewSiteForm>('network.site') ?? { ...this.form, language: settings.defaultLanguage || 'en' };
|
|
31
|
+
this.error = flashed<string>('network.error') ?? '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async post() {
|
|
35
|
+
if (!isSameOriginPost(this.c.req.raw)) return this.c.text('Forbidden', 403);
|
|
36
|
+
const data = await this.c.req.formData();
|
|
37
|
+
const value = (name: string) => String(data.get(name) ?? '').trim();
|
|
38
|
+
const form: NewSiteForm = { name: value('name'), host: value('host'), language: value('language').toLowerCase(), admin: value('admin'), starter: data.get('starter') === 'on' };
|
|
39
|
+
const net = network(this.c);
|
|
40
|
+
const principal = this.c.get('principal');
|
|
41
|
+
try {
|
|
42
|
+
const admin = form.admin ? await net.main.accounts.findByEmail(form.admin) : await net.main.accounts.get(principal.kind === 'user' ? principal.id : '');
|
|
43
|
+
if (!admin) throw new Error(__('No account has that email. Add the person under Network → Users first.'));
|
|
44
|
+
const site = await net.createSite({ name: form.name, host: form.host, admin: admin.id, ...(value('id') ? { id: value('id') } : {}), ...(form.language ? { language: form.language } : {}), starter: form.starter }, { principal });
|
|
45
|
+
flash('network.message', `${site.name} ${__('is ready.')}`);
|
|
46
|
+
return this.redirect(`/dashboard/network/sites/${site.id}`);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
flash('network.error', isCmsError(error) || error instanceof Error ? (error as Error).message : __('The site could not be added.'));
|
|
49
|
+
flash('network.site', form);
|
|
50
|
+
return this.redirect('/dashboard/network/sites/new');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
render() {
|
|
55
|
+
return html`<div class="space-y-6">
|
|
56
|
+
${pageHeader(__('Add site'), {
|
|
57
|
+
description: __('A site with its own database, address and members. Its first administrator signs in with their network account.'),
|
|
58
|
+
actions: html`<a href="/dashboard/network/sites" class="text-sm text-muted-foreground hover:text-foreground">← ${__('Sites')}</a>`,
|
|
59
|
+
})}
|
|
60
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
61
|
+
${this.canAdd ? component(Card, { class: 'max-w-xl' }, component(CardBody, {}, html`
|
|
62
|
+
<form method="post" class="space-y-4">
|
|
63
|
+
${field('name', __('Name'), { value: this.form.name, required: true })}
|
|
64
|
+
${field('host', __('Address'), { value: this.form.host, required: true, placeholder: this.suffix ? `blog.${this.suffix}` : 'blog.example.com',
|
|
65
|
+
hint: this.suffix ? `${__('A subdomain of')} ${this.suffix}. ${__('Add its own domain once it exists.')}` : '' })}
|
|
66
|
+
${field('language', __('Language'), { value: this.form.language, hint: __('A language code, such as en, fr or pt-br.') })}
|
|
67
|
+
${field('admin', __('First administrator'), { type: 'email', value: this.form.admin, placeholder: __('Your account when empty'), hint: __('The email of an existing account.') })}
|
|
68
|
+
<div class="[&_.cs-checkbox]:items-start [&_.cs-checkbox>input]:mt-0.5">${component(Checkbox, { name: 'starter', checked: this.form.starter },
|
|
69
|
+
html`<span>${__('Add starter content')}<span class="block text-xs text-muted-foreground">${__('Leave it off to fill the site from another site\'s export: its page offers the import while the site is empty.')}</span></span>`)}</div>
|
|
70
|
+
<div class="flex items-center gap-2">
|
|
71
|
+
${submitButton(__('Add site'))}
|
|
72
|
+
<a href="/dashboard/network/sites" class="inline-flex items-center justify-center rounded-md border border-border px-4 py-2 text-sm font-medium text-foreground no-underline hover:bg-muted">${__('Cancel')}</a>
|
|
73
|
+
</div>
|
|
74
|
+
</form>`)) : notice(__('This network cannot add sites yet: give it a provider for site databases (see Settings → Network).'))}
|
|
75
|
+
</div>`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Cossack, Page, State, flash, flashed, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Badge, Card, CardBody } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { isCmsError, isSameOriginPost } from '@cossackframework/cms';
|
|
5
|
+
import { artwork, notice, pageHeader } from '#app/cms/ui';
|
|
6
|
+
import { requireNetworkAdmin } from '#app/cms/guards';
|
|
7
|
+
import { network } from '#app/cms/network-ui';
|
|
8
|
+
import { actionButton } from '#app/cms/network-view';
|
|
9
|
+
|
|
10
|
+
interface NetworkThemeRow {
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
version: string;
|
|
14
|
+
description: string;
|
|
15
|
+
logo: string | null;
|
|
16
|
+
hidden: boolean;
|
|
17
|
+
problems: string[];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Network → Themes: which themes sites may choose under Appearance. */
|
|
21
|
+
@Page({ transport: 'http', middlewares: [requireNetworkAdmin()] })
|
|
22
|
+
export default class NetworkThemes extends Cossack {
|
|
23
|
+
@State() themes: NetworkThemeRow[] = [];
|
|
24
|
+
@State() message = '';
|
|
25
|
+
@State() error = '';
|
|
26
|
+
|
|
27
|
+
head(): HeadValue {
|
|
28
|
+
return { title: 'Network themes' };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async init() {
|
|
32
|
+
const net = network(this.c);
|
|
33
|
+
const hidden = (await net.policy()).hiddenThemes;
|
|
34
|
+
this.themes = net.main.themes().map(theme => ({
|
|
35
|
+
name: theme.name, label: theme.label, version: theme.version, description: theme.description, logo: theme.logo, hidden: hidden.has(theme.name), problems: [...theme.problems],
|
|
36
|
+
}));
|
|
37
|
+
this.message = flashed<string>('network.message') ?? '';
|
|
38
|
+
this.error = flashed<string>('network.error') ?? '';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async post() {
|
|
42
|
+
if (!isSameOriginPost(this.c.req.raw)) return this.c.text('Forbidden', 403);
|
|
43
|
+
const form = await this.c.req.formData();
|
|
44
|
+
const name = String(form.get('theme') ?? '');
|
|
45
|
+
const state = (['available', 'hidden'] as const).find(entry => entry === form.get('action'));
|
|
46
|
+
try {
|
|
47
|
+
if (!state) throw new Error('Choose a state.');
|
|
48
|
+
await network(this.c).setThemeState(name, state, { principal: this.c.get('principal') });
|
|
49
|
+
flash('network.message', state === 'hidden' ? `${name}: ${__('hidden from every site.')}` : `${name}: ${__('available to every site.')}`);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
flash('network.error', isCmsError(error) ? error.message : `${name} could not be changed.`);
|
|
52
|
+
}
|
|
53
|
+
return this.redirect('/dashboard/network/themes');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
render() {
|
|
57
|
+
const th = 'px-3 py-2 font-medium';
|
|
58
|
+
return html`<div class="max-w-5xl space-y-6">
|
|
59
|
+
${pageHeader(__('Network themes'), { description: __('Sites choose their theme under Appearance from the themes available here. A site whose theme is hidden falls back to another.') })}
|
|
60
|
+
${this.message ? notice(this.message, 'success') : null}
|
|
61
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
62
|
+
${this.themes.length ? component(Card, {}, component(CardBody, { class: 'p-0' }, html`<div class="overflow-x-auto"><table class="w-full text-sm">
|
|
63
|
+
<thead><tr class="border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground">
|
|
64
|
+
<th class=${th}>${__('Theme')}</th><th class=${th}>${__('State')}</th><th class=${`${th} text-right`}>${__('Actions')}</th>
|
|
65
|
+
</tr></thead>
|
|
66
|
+
<tbody>${this.themes.map(theme => html`<tr data-theme=${theme.name} data-state=${theme.hidden ? 'hidden' : 'available'} class="border-b border-border last:border-0 align-top">
|
|
67
|
+
<td class="px-3 py-3"><div class="flex min-w-[12rem] items-center gap-3">
|
|
68
|
+
${artwork('logo', theme.logo, theme.label, theme.name)}
|
|
69
|
+
<div class="min-w-0">
|
|
70
|
+
<p class="truncate font-semibold text-foreground">${theme.label}</p>
|
|
71
|
+
<p class="text-xs text-muted-foreground">${theme.name} · ${__('version')} ${theme.version}</p>
|
|
72
|
+
${theme.problems.length ? html`<p class="mt-1 text-xs text-destructive">${theme.problems.join(' ')}</p>` : null}
|
|
73
|
+
</div>
|
|
74
|
+
</div></td>
|
|
75
|
+
<td class="px-3 py-3">${component(Badge, { variant: theme.hidden ? 'outline' : 'secondary' }, theme.hidden ? __('Hidden') : __('Available'))}</td>
|
|
76
|
+
<td class="px-3 py-3"><div class="flex justify-end gap-2">
|
|
77
|
+
${theme.hidden ? actionButton('available', __('Make available'), { theme: theme.name }) : actionButton('hidden', __('Hide'), { theme: theme.name }, { danger: true })}
|
|
78
|
+
</div></td>
|
|
79
|
+
</tr>`)}</tbody></table></div>`)) : html`<p class="text-sm text-muted-foreground">${__('No themes. Copy src/plugins/default-theme to start one.')}</p>`}
|
|
80
|
+
</div>`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Cossack, Page, State, flash, flashed, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { html } from '@cossackframework/renderer';
|
|
3
|
+
import { isSameOriginPost } from '@cossackframework/cms';
|
|
4
|
+
import { notice, pageHeader } from '#app/cms/ui';
|
|
5
|
+
import { requireNetworkAdmin } from '#app/cms/guards';
|
|
6
|
+
import { network } from '#app/cms/network-ui';
|
|
7
|
+
import { submitButton } from '#app/cms/network-view';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Network → Updates: sites whose schema has host steps to apply after a deploy. Each site
|
|
11
|
+
* applies its own when it next loads; this applies them now, ten sites at a time.
|
|
12
|
+
*/
|
|
13
|
+
@Page({ transport: 'http', middlewares: [requireNetworkAdmin()] })
|
|
14
|
+
export default class NetworkUpdates extends Cossack {
|
|
15
|
+
@State() pending: { id: string; name: string; steps: number }[] = [];
|
|
16
|
+
@State() message = '';
|
|
17
|
+
@State() error = '';
|
|
18
|
+
|
|
19
|
+
head(): HeadValue {
|
|
20
|
+
return { title: 'Network updates' };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async init() {
|
|
24
|
+
this.pending = (await network(this.c).updates()).map(entry => ({ id: entry.site.id, name: entry.name, steps: entry.pending }));
|
|
25
|
+
this.message = flashed<string>('network.message') ?? '';
|
|
26
|
+
this.error = flashed<string>('network.error') ?? '';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async post() {
|
|
30
|
+
if (!isSameOriginPost(this.c.req.raw)) return this.c.text('Forbidden', 403);
|
|
31
|
+
const report = await network(this.c).upgrade({ principal: this.c.get('principal'), limit: 10 });
|
|
32
|
+
if (report.upgraded.length) flash('network.message', `${__('Upgraded')} ${report.upgraded.length} ${report.upgraded.length === 1 ? __('site') : __('sites')}.`);
|
|
33
|
+
if (report.failed.length) flash('network.error', report.failed.map(failure => `${failure.site}: ${failure.message}`).join(' '));
|
|
34
|
+
return this.redirect('/dashboard/network/updates');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
render() {
|
|
38
|
+
return html`<div class="max-w-3xl space-y-6">
|
|
39
|
+
${pageHeader(__('Updates'), { description: __('Sites upgrade their own schema when they next load after a deploy. Upgrade them here to avoid the wait.') })}
|
|
40
|
+
${this.message ? notice(this.message, 'success') : null}
|
|
41
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
42
|
+
${this.pending.length ? html`<ul class="divide-y divide-border rounded-lg border border-border">${this.pending.map(site => html`<li class="flex justify-between px-3 py-2 text-sm">
|
|
43
|
+
<span class="font-medium text-foreground">${site.name}</span><span class="text-muted-foreground">${site.steps} ${site.steps === 1 ? __('step pending') : __('steps pending')}</span></li>`)}</ul>
|
|
44
|
+
<form method="post">${submitButton(__('Upgrade up to 10 sites'))}</form>`
|
|
45
|
+
: notice(__('Every site is up to date.'), 'success')}
|
|
46
|
+
</div>`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Cossack, Page, State, flash, flashed, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Badge, Card, CardBody, CardHeader, Field, NativeSelect } from '@cossackframework/ui';
|
|
3
|
+
import { html, component, type TemplateResult } from '@cossackframework/renderer';
|
|
4
|
+
import { DEFAULT_ROLES, isCmsError, isSameOriginPost, MAIN_SITE, NETWORK_ADMIN } from '@cossackframework/cms';
|
|
5
|
+
import { networkSite, type CmsHost } from '@cossackframework/cms/server';
|
|
6
|
+
import { notice, pageHeader, shortDate } from '#app/cms/ui';
|
|
7
|
+
import { requireNetworkAdmin } from '#app/cms/guards';
|
|
8
|
+
import { network, siteLinks, siteNames } from '#app/cms/network-ui';
|
|
9
|
+
import { actionButton, field, submitButton } from '#app/cms/network-view';
|
|
10
|
+
import { listTable } from '#app/dashboard/list-table';
|
|
11
|
+
|
|
12
|
+
interface Membership { id: string; name: string; roles: string; dashboard: string }
|
|
13
|
+
|
|
14
|
+
/** One account: its profile and password, network role, suspension, the sites it belongs to with their roles, and deletion. */
|
|
15
|
+
@Page({ transport: 'http', middlewares: [requireNetworkAdmin()] })
|
|
16
|
+
export default class NetworkUser extends Cossack {
|
|
17
|
+
@State() id = '';
|
|
18
|
+
@State() name = '';
|
|
19
|
+
@State() email = '';
|
|
20
|
+
@State() status: 'active' | 'disabled' = 'active';
|
|
21
|
+
@State() admin = false;
|
|
22
|
+
@State() self = false;
|
|
23
|
+
@State() createdAt = 0;
|
|
24
|
+
@State() lastSignInAt: number | null = null;
|
|
25
|
+
@State() memberships: Membership[] = [];
|
|
26
|
+
/** Sites the account can join: the main site and active or archived sites it is not a member of. */
|
|
27
|
+
@State() joinable: { id: string; name: string }[] = [];
|
|
28
|
+
@State() message = '';
|
|
29
|
+
@State() error = '';
|
|
30
|
+
|
|
31
|
+
head(): HeadValue {
|
|
32
|
+
return { title: this.name || 'Account' };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async init() {
|
|
36
|
+
const net = network(this.c);
|
|
37
|
+
const account = await net.main.accounts.get(this.c.req.param('id') ?? '');
|
|
38
|
+
if (!account) { this.error = __('There is no such account.'); this.c.status(404); return; }
|
|
39
|
+
const principal = this.c.get('principal');
|
|
40
|
+
Object.assign(this, {
|
|
41
|
+
id: account.id, name: account.name, email: account.email, status: account.status, admin: account.networkRole === NETWORK_ADMIN,
|
|
42
|
+
self: principal.kind === 'user' && principal.id === account.id, createdAt: account.createdAt, lastSignInAt: account.lastSignInAt,
|
|
43
|
+
});
|
|
44
|
+
const ids = (await net.main.accounts.memberships([account.id])).get(account.id) ?? [];
|
|
45
|
+
const names = await siteNames(this.c, ids);
|
|
46
|
+
const memberships: Membership[] = [];
|
|
47
|
+
for (const site of ids) {
|
|
48
|
+
const host = await this.hostOf(site);
|
|
49
|
+
if (!host) continue;
|
|
50
|
+
const member = await host.users.get(account.id);
|
|
51
|
+
const record = site === MAIN_SITE ? null : await net.sites.get(site);
|
|
52
|
+
memberships.push({ id: site, name: names.get(site) ?? site, roles: member?.assignments.map(role => role.name).join(', ') || __('No role'),
|
|
53
|
+
dashboard: siteLinks(this.c, { host: record?.domains.find(domain => domain.primary)?.host ?? null }).dashboard });
|
|
54
|
+
}
|
|
55
|
+
this.memberships = memberships;
|
|
56
|
+
const open = [...(await net.sites.list({ status: 'active', limit: 100 })).items, ...(await net.sites.list({ status: 'archived', limit: 100 })).items];
|
|
57
|
+
const others = await siteNames(this.c, [MAIN_SITE]);
|
|
58
|
+
this.joinable = [{ id: MAIN_SITE, name: others.get(MAIN_SITE)! }, ...open.map(site => ({ id: site.id, name: site.name }))].filter(site => !ids.includes(site.id));
|
|
59
|
+
this.message = flashed<string>('network.message') ?? '';
|
|
60
|
+
this.error = flashed<string>('network.error') ?? '';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** A site's host, for the main site or an added site that is not being created. */
|
|
64
|
+
private async hostOf(site: string): Promise<CmsHost | null> {
|
|
65
|
+
const net = network(this.c);
|
|
66
|
+
if (site === MAIN_SITE) return net.main;
|
|
67
|
+
const record = await net.sites.get(site);
|
|
68
|
+
return record && record.status !== 'creating' ? net.hostOf(networkSite(record)) : null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async post() {
|
|
72
|
+
if (!isSameOriginPost(this.c.req.raw)) return this.c.text('Forbidden', 403);
|
|
73
|
+
const id = this.c.req.param('id') ?? '';
|
|
74
|
+
const form = await this.c.req.formData();
|
|
75
|
+
const value = (name: string) => String(form.get(name) ?? '').trim();
|
|
76
|
+
const net = network(this.c);
|
|
77
|
+
const principal = this.c.get('principal');
|
|
78
|
+
const accounts = net.main.accounts;
|
|
79
|
+
try {
|
|
80
|
+
const account = await accounts.get(id);
|
|
81
|
+
if (!account) throw new Error(__('There is no such account.'));
|
|
82
|
+
const self = principal.kind === 'user' && principal.id === id;
|
|
83
|
+
const action = value('action');
|
|
84
|
+
if (self && action !== 'profile') throw new Error(__('Change your own account from your profile.'));
|
|
85
|
+
if (action === 'profile') {
|
|
86
|
+
await accounts.update(id, { name: value('name'), email: value('email') });
|
|
87
|
+
// Sites keep a copy of the name and email in their member rows.
|
|
88
|
+
for (const site of (await accounts.memberships([id])).get(id) ?? []) await (await this.hostOf(site))?.users.update(id, { name: value('name'), email: value('email') });
|
|
89
|
+
if (value('password')) await accounts.setPassword(id, value('password'));
|
|
90
|
+
flash('network.message', __('Saved.'));
|
|
91
|
+
} else if (action === 'make-admin' || action === 'remove-admin') {
|
|
92
|
+
await accounts.setNetworkRole(id, action === 'make-admin' ? NETWORK_ADMIN : null);
|
|
93
|
+
flash('network.message', __('Saved.'));
|
|
94
|
+
} else if (action === 'suspend' || action === 'activate') {
|
|
95
|
+
await accounts.setStatus(id, action === 'suspend' ? 'disabled' : 'active');
|
|
96
|
+
flash('network.message', action === 'suspend' ? __('Suspended and signed out everywhere.') : __('Active again.'));
|
|
97
|
+
} else if (action === 'add-site') {
|
|
98
|
+
const host = await this.hostOf(value('site'));
|
|
99
|
+
if (!host) throw new Error(__('There is no such site.'));
|
|
100
|
+
const role = value('role');
|
|
101
|
+
if (role && !(await host.users.roles()).some(entry => entry.id === role)) throw new Error(__('That site has no such role.'));
|
|
102
|
+
await host.users.addMember(id);
|
|
103
|
+
await host.users.setRoles(id, role ? [role] : []);
|
|
104
|
+
flash('network.message', `${account.name} ${__('is a member now.')}`);
|
|
105
|
+
} else if (action === 'remove-site') {
|
|
106
|
+
await (await this.hostOf(value('site')))?.users.delete(id);
|
|
107
|
+
flash('network.message', __('Removed from the site.'));
|
|
108
|
+
} else if (action === 'delete') {
|
|
109
|
+
await net.deleteAccount(id, { principal });
|
|
110
|
+
flash('network.message', __('Deleted from every site.'));
|
|
111
|
+
return this.redirect('/dashboard/network/users');
|
|
112
|
+
}
|
|
113
|
+
} catch (error) {
|
|
114
|
+
flash('network.error', isCmsError(error) || error instanceof Error ? (error as Error).message : __('The account could not be changed.'));
|
|
115
|
+
}
|
|
116
|
+
return this.redirect(`/dashboard/network/users/${id}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
render() {
|
|
120
|
+
if (!this.id) return html`<div class="max-w-3xl space-y-4">${notice(this.error, 'error')}<a href="/dashboard/network/users" class="text-sm text-primary">← ${__('Users')}</a></div>`;
|
|
121
|
+
const card = (title: string, body: TemplateResult, description = '') => component(Card, {}, html`
|
|
122
|
+
${component(CardHeader, {}, html`<h2 class="text-base font-semibold text-foreground">${title}</h2>${description ? html`<p class="mt-1 text-sm text-muted-foreground">${description}</p>` : null}`)}
|
|
123
|
+
${component(CardBody, { class: 'space-y-4' }, body)}`);
|
|
124
|
+
return html`<div class="max-w-4xl space-y-6">
|
|
125
|
+
${pageHeader(this.name, {
|
|
126
|
+
titleActions: html`${this.self ? component(Badge, { variant: 'secondary' }, __('You')) : null}
|
|
127
|
+
${this.admin ? component(Badge, { variant: 'default' }, __('Network admin')) : null}
|
|
128
|
+
${this.status === 'disabled' ? component(Badge, { variant: 'destructive' }, __('Suspended')) : null}`,
|
|
129
|
+
description: `${this.email} · ${__('Created')} ${shortDate(this.createdAt)} · ${__('Last sign-in')} ${this.lastSignInAt ? shortDate(this.lastSignInAt) : __('never')}`,
|
|
130
|
+
actions: html`<a href="/dashboard/network/users" class="text-sm text-muted-foreground hover:text-foreground">← ${__('Users')}</a>`,
|
|
131
|
+
})}
|
|
132
|
+
${this.message ? notice(this.message, 'success') : null}
|
|
133
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
134
|
+
${card(__('Profile'), html`<form method="post" class="max-w-xl space-y-4">
|
|
135
|
+
<input type="hidden" name="action" value="profile">
|
|
136
|
+
${field('name', __('Name'), { value: this.name, required: true })}
|
|
137
|
+
${field('email', __('Email'), { type: 'email', value: this.email, required: true })}
|
|
138
|
+
${field('password', __('New password'), { type: 'password', placeholder: __('Unchanged when empty'), hint: __('At least 8 characters.') })}
|
|
139
|
+
${submitButton(__('Save'))}
|
|
140
|
+
</form>`, __('The account signs in to every site with this email and password.'))}
|
|
141
|
+
${html`<section class="space-y-3">
|
|
142
|
+
<h2 class="text-base font-semibold text-foreground">${__('Sites')}</h2>
|
|
143
|
+
${listTable<Membership>({
|
|
144
|
+
rows: this.memberships, key: site => site.id, rowAttribute: 'data-membership', empty: __('This account belongs to no site.'),
|
|
145
|
+
columns: [
|
|
146
|
+
{ label: __('Site'), cell: site => html`${site.id === MAIN_SITE ? html`<span class="font-medium text-foreground">${site.name}</span>`
|
|
147
|
+
: html`<a href=${`/dashboard/network/sites/${site.id}`} class="font-medium text-foreground no-underline hover:text-primary">${site.name}</a>`}
|
|
148
|
+
<a href=${site.dashboard} class="block text-xs text-primary">${__('Dashboard')}</a>` },
|
|
149
|
+
{ label: __('Roles'), class: 'text-muted-foreground', cell: site => site.roles },
|
|
150
|
+
{ label: '', class: 'text-right', cell: site => this.self ? null : actionButton('remove-site', __('Remove from site'), { site: site.id }, { danger: true }) },
|
|
151
|
+
],
|
|
152
|
+
})}
|
|
153
|
+
${this.self || !this.joinable.length ? null : html`<form method="post" class="flex max-w-xl flex-wrap items-end gap-3">
|
|
154
|
+
<input type="hidden" name="action" value="add-site">
|
|
155
|
+
<div class="flex-1">${component(Field, { label: __('Add to a site'), for: 'network-site', control: attributes => component(NativeSelect, { ...attributes, name: 'site' },
|
|
156
|
+
html`${this.joinable.map(site => html`<option value=${site.id}>${site.name}</option>`)}`) })}</div>
|
|
157
|
+
${component(NativeSelect, { name: 'role', inline: true, 'aria-label': __('Role') }, html`
|
|
158
|
+
<option value="">${__('No role')}</option>
|
|
159
|
+
${DEFAULT_ROLES.map(role => html`<option value=${role.id} ?selected=${role.id === 'editor'}>${role.name}</option>`)}`)}
|
|
160
|
+
${submitButton(__('Add'))}
|
|
161
|
+
</form>`}
|
|
162
|
+
</section>`}
|
|
163
|
+
${this.self ? null : card(__('Network access'), html`<div class="flex flex-wrap gap-2">
|
|
164
|
+
${this.admin ? actionButton('remove-admin', __('Remove network admin')) : actionButton('make-admin', __('Make network admin'))}
|
|
165
|
+
${this.status === 'active' ? actionButton('suspend', __('Suspend'), {}, { danger: true }) : actionButton('activate', __('Activate'))}
|
|
166
|
+
</div>
|
|
167
|
+
<details class="rounded-md border border-destructive/30 p-3">
|
|
168
|
+
<summary class="cursor-pointer text-sm font-medium text-destructive">${__('Delete account…')}</summary>
|
|
169
|
+
<div class="mt-3 space-y-3">
|
|
170
|
+
<p class="text-sm text-muted-foreground">${this.name} ${__('is removed from every site and can no longer sign in. This cannot be undone; content keeps its author ID.')}</p>
|
|
171
|
+
${actionButton('delete', __('Delete for good'), {}, { danger: true })}
|
|
172
|
+
</div>
|
|
173
|
+
</details>`, __('Network admins run every site and this dashboard. Suspension signs the account out everywhere until it is activated again.'))}
|
|
174
|
+
</div>`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Client, Cossack, Page, Server, State, flashed, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { AlertDialog, Badge } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { isCmsError, NETWORK_ADMIN } from '@cossackframework/cms';
|
|
5
|
+
import { linkButton, notice, pageHeader, shortDate } from '#app/cms/ui';
|
|
6
|
+
import { requireNetworkAdmin } from '#app/cms/guards';
|
|
7
|
+
import { network, siteNames } from '#app/cms/network-ui';
|
|
8
|
+
import { listFilters, listFooter, listTable, rowActions } from '#app/dashboard/list-table';
|
|
9
|
+
|
|
10
|
+
const PAGE_SIZE = 20;
|
|
11
|
+
|
|
12
|
+
interface AccountRow { id: string; name: string; email: string; status: 'active' | 'disabled'; admin: boolean; sites: string[]; lastSignInAt: number | null; createdAt: number; self: boolean }
|
|
13
|
+
type AccountAction = 'make-admin' | 'remove-admin' | 'suspend' | 'activate' | 'delete';
|
|
14
|
+
|
|
15
|
+
/** Network → Users: every account as a list table, with the sites it belongs to, network admins and suspension. */
|
|
16
|
+
@Page({ transport: 'http', middlewares: [requireNetworkAdmin()] })
|
|
17
|
+
export default class NetworkUsers extends Cossack {
|
|
18
|
+
@State() rows: AccountRow[] = [];
|
|
19
|
+
@State() total = 0;
|
|
20
|
+
@State() page = 1;
|
|
21
|
+
@State() search = '';
|
|
22
|
+
@State() admins = false;
|
|
23
|
+
/** All accounts and network admins, for the links above the list. */
|
|
24
|
+
@State() counts = { all: 0, admins: 0 };
|
|
25
|
+
@State() message = '';
|
|
26
|
+
@State() error = '';
|
|
27
|
+
/** The account waiting for the delete confirmation. */
|
|
28
|
+
@State() pendingDelete: AccountRow | null = null;
|
|
29
|
+
|
|
30
|
+
head(): HeadValue {
|
|
31
|
+
return { title: 'Network users' };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async init() {
|
|
35
|
+
const query = this.c.req.query();
|
|
36
|
+
this.search = query.q?.trim() ?? '';
|
|
37
|
+
this.admins = query.admins === '1';
|
|
38
|
+
const page = Number(query.page);
|
|
39
|
+
this.page = page >= 1 ? Math.floor(page) : 1;
|
|
40
|
+
this.message = flashed<string>('network.message') ?? '';
|
|
41
|
+
await this.load();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private async load() {
|
|
45
|
+
const net = network(this.c);
|
|
46
|
+
const search = this.search ? { search: this.search } : {};
|
|
47
|
+
const [found, all, admins] = await Promise.all([
|
|
48
|
+
net.main.accounts.list({ ...search, networkAdmins: this.admins, limit: PAGE_SIZE, offset: (this.page - 1) * PAGE_SIZE }),
|
|
49
|
+
net.main.accounts.list({ ...search, limit: 1 }),
|
|
50
|
+
net.main.accounts.list({ ...search, networkAdmins: true, limit: 1 }),
|
|
51
|
+
]);
|
|
52
|
+
const memberships = await net.main.accounts.memberships(found.items.map(account => account.id));
|
|
53
|
+
const names = await siteNames(this.c, [...memberships.values()].flat());
|
|
54
|
+
const principal = this.c.get('principal');
|
|
55
|
+
this.counts = { all: all.total, admins: admins.total };
|
|
56
|
+
this.total = found.total;
|
|
57
|
+
this.rows = found.items.map(account => ({
|
|
58
|
+
id: account.id, name: account.name, email: account.email, status: account.status, admin: account.networkRole === NETWORK_ADMIN,
|
|
59
|
+
sites: (memberships.get(account.id) ?? []).map(id => names.get(id) ?? id), lastSignInAt: account.lastSignInAt, createdAt: account.createdAt,
|
|
60
|
+
self: principal.kind === 'user' && principal.id === account.id,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Change an account; your own stays as it is, so the network keeps an admin who can act. */
|
|
65
|
+
@Server()
|
|
66
|
+
async change(id: string, action: AccountAction) {
|
|
67
|
+
this.message = '';
|
|
68
|
+
this.error = '';
|
|
69
|
+
const net = network(this.c);
|
|
70
|
+
const principal = this.c.get('principal');
|
|
71
|
+
try {
|
|
72
|
+
if (principal.kind === 'user' && principal.id === id) throw new Error(__('Change your own account from your profile.'));
|
|
73
|
+
if (action === 'make-admin' || action === 'remove-admin') {
|
|
74
|
+
await net.main.accounts.setNetworkRole(id, action === 'make-admin' ? NETWORK_ADMIN : null);
|
|
75
|
+
this.message = __('Saved.');
|
|
76
|
+
} else if (action === 'suspend' || action === 'activate') {
|
|
77
|
+
// Suspension signs the account out of every site.
|
|
78
|
+
await net.main.accounts.setStatus(id, action === 'suspend' ? 'disabled' : 'active');
|
|
79
|
+
this.message = action === 'suspend' ? __('Suspended and signed out everywhere.') : __('Active again.');
|
|
80
|
+
} else if (action === 'delete') {
|
|
81
|
+
await net.deleteAccount(id, { principal });
|
|
82
|
+
this.message = __('Deleted from every site.');
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
this.error = isCmsError(error) || error instanceof Error ? (error as Error).message : __('The account could not be changed.');
|
|
86
|
+
}
|
|
87
|
+
await this.load();
|
|
88
|
+
const pages = Math.max(1, Math.ceil(this.total / PAGE_SIZE));
|
|
89
|
+
if (this.page > pages) { this.page = pages; await this.load(); }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@Client()
|
|
93
|
+
async act(row: AccountRow, action: AccountAction) {
|
|
94
|
+
await this.change(row.id, action);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@Client()
|
|
98
|
+
requestDelete(row: AccountRow) {
|
|
99
|
+
this.pendingDelete = row;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Client()
|
|
103
|
+
async confirmDelete() {
|
|
104
|
+
const row = this.pendingDelete;
|
|
105
|
+
this.pendingDelete = null;
|
|
106
|
+
if (row) await this.change(row.id, 'delete');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private href(options: { admins?: boolean; page?: number } = {}): string {
|
|
110
|
+
const params = new URLSearchParams();
|
|
111
|
+
if (this.search) params.set('q', this.search);
|
|
112
|
+
if (options.admins ?? this.admins) params.set('admins', '1');
|
|
113
|
+
if ((options.page ?? 1) > 1) params.set('page', String(options.page));
|
|
114
|
+
const query = params.toString();
|
|
115
|
+
return query ? `/dashboard/network/users?${query}` : '/dashboard/network/users';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
render() {
|
|
119
|
+
const tabs = [{ admins: false, label: __('All'), count: this.counts.all }, { admins: true, label: __('Network admins'), count: this.counts.admins }];
|
|
120
|
+
return html`<div class="space-y-6">
|
|
121
|
+
${pageHeader(__('Users'), {
|
|
122
|
+
description: __('Accounts sign in once, on this host, and reach the sites they are members of. Roles are set per site.'),
|
|
123
|
+
titleActions: linkButton(__('Add account'), '/dashboard/network/users/new', 'primary', { size: 'sm' }),
|
|
124
|
+
})}
|
|
125
|
+
${this.message && !this.error ? notice(this.message, 'success') : null}
|
|
126
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
127
|
+
<div class="space-y-3">
|
|
128
|
+
<nav aria-label=${__('Filter accounts')} class="flex flex-wrap gap-x-3 gap-y-1 text-sm">
|
|
129
|
+
${tabs.map((tab, index) => html`${index ? html`<span class="text-muted-foreground" aria-hidden="true">|</span>` : null}
|
|
130
|
+
<a href=${this.href({ admins: tab.admins })} class=${tab.admins === this.admins ? 'font-semibold text-foreground no-underline' : 'text-primary no-underline hover:underline'}
|
|
131
|
+
aria-current=${tab.admins === this.admins ? 'page' : 'false'}>${tab.label} <span class="text-muted-foreground">(${tab.count})</span></a>`)}
|
|
132
|
+
</nav>
|
|
133
|
+
${listFilters({ action: '/dashboard/network/users', hidden: { admins: this.admins ? '1' : '' }, search: { name: 'q', value: this.search, placeholder: __('Search names and emails') } })}
|
|
134
|
+
</div>
|
|
135
|
+
${listTable<AccountRow>({
|
|
136
|
+
rows: this.rows, key: row => row.id, rowAttribute: 'data-account', empty: __('No accounts match.'),
|
|
137
|
+
columns: [
|
|
138
|
+
{ label: __('Account'), cell: row => html`<div class="min-w-0">
|
|
139
|
+
<a href=${`/dashboard/network/users/${row.id}`} class="font-medium text-foreground no-underline hover:text-primary">${row.name}</a>
|
|
140
|
+
${row.self ? html` ${component(Badge, { variant: 'secondary' }, __('You'))}` : null}
|
|
141
|
+
${row.admin ? html` ${component(Badge, { variant: 'default' }, __('Network admin'))}` : null}
|
|
142
|
+
${row.status === 'disabled' ? html` ${component(Badge, { variant: 'destructive' }, __('Suspended'))}` : null}
|
|
143
|
+
<span class="block text-xs text-muted-foreground">${row.email}</span>
|
|
144
|
+
${rowActions([
|
|
145
|
+
{ id: `account-${row.id}-edit`, label: __('Edit'), href: `/dashboard/network/users/${row.id}` },
|
|
146
|
+
...(row.self ? [] : [
|
|
147
|
+
row.admin ? { id: `account-${row.id}-remove-admin`, label: __('Remove network admin'), run: () => this.act(row, 'remove-admin') }
|
|
148
|
+
: { id: `account-${row.id}-make-admin`, label: __('Make network admin'), run: () => this.act(row, 'make-admin') },
|
|
149
|
+
row.status === 'active' ? { id: `account-${row.id}-suspend`, label: __('Suspend'), danger: true, run: () => this.act(row, 'suspend') }
|
|
150
|
+
: { id: `account-${row.id}-activate`, label: __('Activate'), run: () => this.act(row, 'activate') },
|
|
151
|
+
{ id: `account-${row.id}-delete`, label: __('Delete'), danger: true, run: () => this.requestDelete(row) },
|
|
152
|
+
]),
|
|
153
|
+
])}
|
|
154
|
+
</div>` },
|
|
155
|
+
{ label: __('Sites'), cell: row => html`<div class="flex flex-wrap gap-1">${row.sites.length ? row.sites.map(site => component(Badge, { variant: 'outline' }, site)) : html`<span class="text-xs text-muted-foreground">—</span>`}</div>` },
|
|
156
|
+
{ label: __('Last sign-in'), class: 'text-muted-foreground', cell: row => row.lastSignInAt ? shortDate(row.lastSignInAt) : __('Never') },
|
|
157
|
+
{ label: __('Created'), class: 'text-muted-foreground', cell: row => shortDate(row.createdAt) },
|
|
158
|
+
],
|
|
159
|
+
})}
|
|
160
|
+
${listFooter({ total: this.total, page: this.page, totalPages: Math.max(1, Math.ceil(this.total / PAGE_SIZE)), href: page => this.href({ page }) })}
|
|
161
|
+
${component(AlertDialog, {
|
|
162
|
+
id: 'delete-account-dialog',
|
|
163
|
+
open: this.pendingDelete !== null,
|
|
164
|
+
title: __('Delete account?'),
|
|
165
|
+
description: this.pendingDelete ? `${this.pendingDelete.name} ${__('is removed from every site and can no longer sign in. This cannot be undone.')}` : '',
|
|
166
|
+
cancelLabel: __('Cancel'),
|
|
167
|
+
actionLabel: __('Delete'),
|
|
168
|
+
actionVariant: 'destructive',
|
|
169
|
+
onAction: () => this.confirmDelete(),
|
|
170
|
+
onOpenChange: () => { this.pendingDelete = null; },
|
|
171
|
+
})}
|
|
172
|
+
</div>`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Cossack, Page, State, flash, flashed, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Card, CardBody } from '@cossackframework/ui';
|
|
3
|
+
import { html, component } from '@cossackframework/renderer';
|
|
4
|
+
import { isCmsError, isSameOriginPost, NETWORK_ADMIN } from '@cossackframework/cms';
|
|
5
|
+
import { notice, pageHeader } from '#app/cms/ui';
|
|
6
|
+
import { requireNetworkAdmin } from '#app/cms/guards';
|
|
7
|
+
import { network } from '#app/cms/network-ui';
|
|
8
|
+
import { field, submitButton } from '#app/cms/network-view';
|
|
9
|
+
|
|
10
|
+
interface NewAccountForm { name: string; email: string; admin: boolean }
|
|
11
|
+
|
|
12
|
+
/** Add account: a person who signs in to the network. Sites are added on the account's page. */
|
|
13
|
+
@Page({ transport: 'http', middlewares: [requireNetworkAdmin()] })
|
|
14
|
+
export default class NewNetworkUser extends Cossack {
|
|
15
|
+
@State() form: NewAccountForm = { name: '', email: '', admin: false };
|
|
16
|
+
@State() error = '';
|
|
17
|
+
|
|
18
|
+
head(): HeadValue {
|
|
19
|
+
return { title: 'Add account' };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async init() {
|
|
23
|
+
// A failed attempt comes back with what was typed, except the password.
|
|
24
|
+
this.form = flashed<NewAccountForm>('network.account') ?? this.form;
|
|
25
|
+
this.error = flashed<string>('network.error') ?? '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async post() {
|
|
29
|
+
if (!isSameOriginPost(this.c.req.raw)) return this.c.text('Forbidden', 403);
|
|
30
|
+
const data = await this.c.req.formData();
|
|
31
|
+
const value = (name: string) => String(data.get(name) ?? '').trim();
|
|
32
|
+
const form: NewAccountForm = { name: value('name'), email: value('email'), admin: data.get('admin') === 'on' };
|
|
33
|
+
try {
|
|
34
|
+
const account = await network(this.c).main.accounts.create({ email: form.email, name: form.name || form.email.split('@')[0]!, password: String(data.get('password') ?? ''),
|
|
35
|
+
...(form.admin ? { networkRole: NETWORK_ADMIN } : {}) });
|
|
36
|
+
flash('network.message', `${account.name} ${__('can sign in now. Add them to sites below.')}`);
|
|
37
|
+
return this.redirect(`/dashboard/network/users/${account.id}`);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
flash('network.error', isCmsError(error) ? error.message : __('The account could not be added.'));
|
|
40
|
+
flash('network.account', form);
|
|
41
|
+
return this.redirect('/dashboard/network/users/new');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
return html`<div class="space-y-6">
|
|
47
|
+
${pageHeader(__('Add account'), {
|
|
48
|
+
description: __('A person who signs in once, on this host, for every site they are a member of.'),
|
|
49
|
+
actions: html`<a href="/dashboard/network/users" class="text-sm text-muted-foreground hover:text-foreground">← ${__('Users')}</a>`,
|
|
50
|
+
})}
|
|
51
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
52
|
+
${component(Card, { class: 'max-w-xl' }, component(CardBody, {}, html`
|
|
53
|
+
<form method="post" class="space-y-4">
|
|
54
|
+
${field('name', __('Name'), { value: this.form.name })}
|
|
55
|
+
${field('email', __('Email'), { type: 'email', value: this.form.email, required: true })}
|
|
56
|
+
${field('password', __('Password'), { type: 'password', required: true, hint: __('At least 8 characters.') })}
|
|
57
|
+
<label class="flex items-start gap-2 text-sm text-foreground"><input type="checkbox" name="admin" class="mt-0.5 size-4 accent-primary" ?checked=${this.form.admin}>
|
|
58
|
+
<span><span class="font-medium">${__('Network admin')}</span><span class="block text-xs text-muted-foreground">${__('Runs every site and the network dashboard.')}</span></span></label>
|
|
59
|
+
<div class="flex items-center gap-2">
|
|
60
|
+
${submitButton(__('Add account'))}
|
|
61
|
+
<a href="/dashboard/network/users" class="inline-flex items-center justify-center rounded-md border border-border px-4 py-2 text-sm font-medium text-foreground no-underline hover:bg-muted">${__('Cancel')}</a>
|
|
62
|
+
</div>
|
|
63
|
+
</form>`))}
|
|
64
|
+
</div>`;
|
|
65
|
+
}
|
|
66
|
+
}
|