@aphexcms/cms-core 11.3.0 → 12.0.0-next.20261109083516
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/dist/admin/client-auth.svelte.d.ts +120 -0
- package/dist/admin/client-auth.svelte.d.ts.map +1 -0
- package/dist/admin/client-auth.svelte.js +14 -0
- package/dist/admin/client-config.d.ts +72 -0
- package/dist/admin/client-config.d.ts.map +1 -0
- package/dist/admin/client-config.js +1 -0
- package/dist/admin/settings-header-actions.d.ts +12 -0
- package/dist/admin/settings-header-actions.d.ts.map +1 -0
- package/dist/admin/settings-header-actions.js +1 -0
- package/dist/admin/view-data.d.ts +189 -0
- package/dist/admin/view-data.d.ts.map +1 -0
- package/dist/admin/view-data.js +1 -0
- package/dist/admin.css +6 -0
- package/dist/api/invitations.d.ts +2 -2
- package/dist/api/invitations.d.ts.map +1 -1
- package/dist/api/organizations.d.ts +5 -4
- package/dist/api/organizations.d.ts.map +1 -1
- package/dist/api/organizations.js +2 -3
- package/dist/api/user.d.ts +6 -1
- package/dist/api/user.d.ts.map +1 -1
- package/dist/api/user.js +7 -0
- package/dist/app-augment.d.ts +2 -3
- package/dist/app-augment.d.ts.map +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/auth/auth-errors.d.ts +6 -0
- package/dist/auth/auth-errors.d.ts.map +1 -1
- package/dist/auth/auth-errors.js +8 -0
- package/dist/auth/auth-hooks.d.ts.map +1 -1
- package/dist/auth/auth-hooks.js +36 -17
- package/dist/auth/invitation-email.d.ts +9 -0
- package/dist/auth/invitation-email.d.ts.map +1 -0
- package/dist/auth/invitation-email.js +49 -0
- package/dist/auth/pages.d.ts +16 -0
- package/dist/auth/pages.d.ts.map +1 -0
- package/dist/auth/pages.js +23 -0
- package/dist/auth/provider.d.ts +31 -1
- package/dist/auth/provider.d.ts.map +1 -1
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +9 -0
- package/dist/client/ui.d.ts +16 -0
- package/dist/client/ui.d.ts.map +1 -1
- package/dist/client/ui.js +26 -1
- package/dist/components/AphexStudio.svelte +268 -0
- package/dist/components/AphexStudio.svelte.d.ts +16 -0
- package/dist/components/AphexStudio.svelte.d.ts.map +1 -0
- package/dist/components/admin/AccountSettings.svelte +339 -0
- package/dist/components/admin/AccountSettings.svelte.d.ts +8 -0
- package/dist/components/admin/AccountSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/AccountSettingsView.svelte +61 -0
- package/dist/components/admin/AccountSettingsView.svelte.d.ts +19 -0
- package/dist/components/admin/AccountSettingsView.svelte.d.ts.map +1 -0
- package/dist/components/admin/ApiKeysSettings.svelte +435 -0
- package/dist/components/admin/ApiKeysSettings.svelte.d.ts +15 -0
- package/dist/components/admin/ApiKeysSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/AuthPageShell.svelte +32 -0
- package/dist/components/admin/AuthPageShell.svelte.d.ts +16 -0
- package/dist/components/admin/AuthPageShell.svelte.d.ts.map +1 -0
- package/dist/components/admin/CreateOrganization.svelte +158 -0
- package/dist/components/admin/CreateOrganization.svelte.d.ts +11 -0
- package/dist/components/admin/CreateOrganization.svelte.d.ts.map +1 -0
- package/dist/components/admin/DeleteAccountSettings.svelte +124 -0
- package/dist/components/admin/DeleteAccountSettings.svelte.d.ts +7 -0
- package/dist/components/admin/DeleteAccountSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/DeleteOrganizationSettings.svelte +123 -0
- package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts +11 -0
- package/dist/components/admin/DeleteOrganizationSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/DocumentEditor.svelte +92 -22
- package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
- package/dist/components/admin/GeneralSettings.svelte +45 -0
- package/dist/components/admin/GeneralSettings.svelte.d.ts +10 -0
- package/dist/components/admin/GeneralSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/GodModeView.svelte +112 -0
- package/dist/components/admin/GodModeView.svelte.d.ts +9 -0
- package/dist/components/admin/GodModeView.svelte.d.ts.map +1 -0
- package/dist/components/admin/InvitationsView.svelte +277 -0
- package/dist/components/admin/InvitationsView.svelte.d.ts +11 -0
- package/dist/components/admin/InvitationsView.svelte.d.ts.map +1 -0
- package/dist/components/admin/InviteView.svelte +98 -0
- package/dist/components/admin/InviteView.svelte.d.ts +9 -0
- package/dist/components/admin/InviteView.svelte.d.ts.map +1 -0
- package/dist/components/admin/LoginView.svelte +478 -0
- package/dist/components/admin/LoginView.svelte.d.ts +5 -0
- package/dist/components/admin/LoginView.svelte.d.ts.map +1 -0
- package/dist/components/admin/MembersSettings.svelte +25 -3
- package/dist/components/admin/MembersSettings.svelte.d.ts +5 -1
- package/dist/components/admin/MembersSettings.svelte.d.ts.map +1 -1
- package/dist/components/admin/OrganizationSettings.svelte +367 -0
- package/dist/components/admin/OrganizationSettings.svelte.d.ts +9 -0
- package/dist/components/admin/OrganizationSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/OrganizationsList.svelte +92 -0
- package/dist/components/admin/OrganizationsList.svelte.d.ts +8 -0
- package/dist/components/admin/OrganizationsList.svelte.d.ts.map +1 -0
- package/dist/components/admin/OrganizationsView.svelte +31 -0
- package/dist/components/admin/OrganizationsView.svelte.d.ts +9 -0
- package/dist/components/admin/OrganizationsView.svelte.d.ts.map +1 -0
- package/dist/components/admin/PasswordInput.svelte +43 -0
- package/dist/components/admin/PasswordInput.svelte.d.ts +8 -0
- package/dist/components/admin/PasswordInput.svelte.d.ts.map +1 -0
- package/dist/components/admin/PasswordSettings.svelte +179 -0
- package/dist/components/admin/PasswordSettings.svelte.d.ts +4 -0
- package/dist/components/admin/PasswordSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/PreferencesSettings.svelte +80 -0
- package/dist/components/admin/PreferencesSettings.svelte.d.ts +20 -0
- package/dist/components/admin/PreferencesSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/ResetPasswordView.svelte +117 -0
- package/dist/components/admin/ResetPasswordView.svelte.d.ts +9 -0
- package/dist/components/admin/ResetPasswordView.svelte.d.ts.map +1 -0
- package/dist/components/admin/RolesSettings.svelte +360 -0
- package/dist/components/admin/RolesSettings.svelte.d.ts +11 -0
- package/dist/components/admin/RolesSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/SchemaField.svelte +2 -1
- package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
- package/dist/components/admin/SettingsHeaderActions.svelte +25 -0
- package/dist/components/admin/SettingsHeaderActions.svelte.d.ts +8 -0
- package/dist/components/admin/SettingsHeaderActions.svelte.d.ts.map +1 -0
- package/dist/components/admin/SettingsShell.svelte +136 -0
- package/dist/components/admin/SettingsShell.svelte.d.ts +9 -0
- package/dist/components/admin/SettingsShell.svelte.d.ts.map +1 -0
- package/dist/components/admin/TwoFactorChallengeView.svelte +377 -0
- package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts +11 -0
- package/dist/components/admin/TwoFactorChallengeView.svelte.d.ts.map +1 -0
- package/dist/components/admin/TwoFactorSettings.svelte +436 -0
- package/dist/components/admin/TwoFactorSettings.svelte.d.ts +7 -0
- package/dist/components/admin/TwoFactorSettings.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/ImageField.svelte +4 -2
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +3 -2
- package/dist/components/admin/fields/richtext/RichtextField.svelte +48 -6
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
- package/dist/components/layout/sidebar/NavUser.svelte +2 -2
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/email/index.d.ts +1 -0
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +2 -0
- package/dist/email/interfaces/email.d.ts +2 -0
- package/dist/email/interfaces/email.d.ts.map +1 -1
- package/dist/email/link-email.d.ts +15 -0
- package/dist/email/link-email.d.ts.map +1 -0
- package/dist/email/link-email.js +30 -0
- package/dist/field-validation/utils.d.ts +29 -0
- package/dist/field-validation/utils.d.ts.map +1 -1
- package/dist/field-validation/utils.js +138 -5
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/hooks.d.ts +6 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +53 -17
- package/dist/jobs/recurring.d.ts +4 -1
- package/dist/jobs/recurring.d.ts.map +1 -1
- package/dist/jobs/recurring.js +28 -0
- package/dist/local-api/auth-helpers.d.ts +4 -4
- package/dist/local-api/auth-helpers.js +4 -4
- package/dist/local-api/collection-api.d.ts +10 -1
- package/dist/local-api/collection-api.d.ts.map +1 -1
- package/dist/local-api/collection-api.js +25 -7
- package/dist/local-api/index.d.ts +1 -1
- package/dist/local-api/index.d.ts.map +1 -1
- package/dist/local-api/index.js +7 -5
- package/dist/local-api/types.d.ts +1 -1
- package/dist/preview/perspective.d.ts +1 -1
- package/dist/preview/perspective.js +1 -1
- package/dist/resolve-config.d.ts +22 -0
- package/dist/resolve-config.d.ts.map +1 -0
- package/dist/resolve-config.js +106 -0
- package/dist/routes/assets-cdn.d.ts +7 -2
- package/dist/routes/assets-cdn.d.ts.map +1 -1
- package/dist/routes/assets-cdn.js +1 -1
- package/dist/server/api/index.d.ts +1 -2
- package/dist/server/api/index.d.ts.map +1 -1
- package/dist/server/api/index.js +10 -3
- package/dist/server/api/openapi/registry.d.ts.map +1 -1
- package/dist/server/api/openapi/registry.js +62 -0
- package/dist/server/api/routes/api-keys.d.ts +4 -0
- package/dist/server/api/routes/api-keys.d.ts.map +1 -0
- package/dist/server/api/routes/api-keys.js +88 -0
- package/dist/server/api/routes/documents-by-id.d.ts.map +1 -1
- package/dist/server/api/routes/documents-by-id.js +16 -1
- package/dist/server/api/routes/documents-publish.d.ts.map +1 -1
- package/dist/server/api/routes/documents-publish.js +11 -1
- package/dist/server/api/routes/documents.d.ts.map +1 -1
- package/dist/server/api/routes/documents.js +16 -2
- package/dist/server/api/routes/instance-settings.d.ts +4 -0
- package/dist/server/api/routes/instance-settings.d.ts.map +1 -0
- package/dist/server/api/routes/instance-settings.js +47 -0
- package/dist/server/api/routes/invitations.d.ts +9 -0
- package/dist/server/api/routes/invitations.d.ts.map +1 -0
- package/dist/server/api/routes/invitations.js +79 -0
- package/dist/server/api/routes/organizations-invitations.d.ts +0 -6
- package/dist/server/api/routes/organizations-invitations.d.ts.map +1 -1
- package/dist/server/api/routes/organizations-invitations.js +6 -7
- package/dist/server/api/routes/organizations-team.d.ts.map +1 -1
- package/dist/server/api/routes/organizations-team.js +2 -52
- package/dist/server/api/routes/organizations.d.ts.map +1 -1
- package/dist/server/api/routes/organizations.js +35 -9
- package/dist/server/core-routes.d.ts +8 -0
- package/dist/server/core-routes.d.ts.map +1 -0
- package/dist/server/core-routes.js +67 -0
- package/dist/server/index.d.ts +5 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +7 -1
- package/dist/server/pages/admin.d.ts +24 -0
- package/dist/server/pages/admin.d.ts.map +1 -0
- package/dist/server/pages/admin.js +468 -0
- package/dist/server/queries/organization-team.d.ts +14 -0
- package/dist/server/queries/organization-team.d.ts.map +1 -0
- package/dist/server/queries/organization-team.js +65 -0
- package/dist/server/queries/pending-invitations.d.ts +8 -0
- package/dist/server/queries/pending-invitations.d.ts.map +1 -0
- package/dist/server/queries/pending-invitations.js +24 -0
- package/dist/types/api-key.d.ts +18 -0
- package/dist/types/api-key.d.ts.map +1 -0
- package/dist/types/api-key.js +1 -0
- package/dist/types/auth.d.ts +35 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/capabilities.d.ts +1 -2
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/config.d.ts +124 -4
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/filters.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/organization.d.ts +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +46 -39
- package/package.json +19 -29
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button } from '@aphexcms/ui/shadcn/button';
|
|
3
|
+
import PasswordInput from './PasswordInput.svelte';
|
|
4
|
+
import { Label } from '@aphexcms/ui/shadcn/label';
|
|
5
|
+
import { Badge } from '@aphexcms/ui/shadcn/badge';
|
|
6
|
+
import * as Card from '@aphexcms/ui/shadcn/card';
|
|
7
|
+
import * as InputOTP from '@aphexcms/ui/shadcn/input-otp';
|
|
8
|
+
import { ShieldCheck, ShieldOff, Copy, Download } from '@lucide/svelte';
|
|
9
|
+
import { toast } from 'svelte-sonner';
|
|
10
|
+
import { readable } from 'svelte/store';
|
|
11
|
+
import { useAdminAuthClient, type AdminSessionState } from '../../admin/client-auth.svelte';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Opt-in TOTP enrolment for the signed-in user.
|
|
15
|
+
*
|
|
16
|
+
* The enrol → verify split is the auth provider's, and it's the right one:
|
|
17
|
+
* `enable` hands back a secret and backup codes but leaves `twoFactorEnabled`
|
|
18
|
+
* false until a real code from the authenticator comes back. So a user who
|
|
19
|
+
* closes this panel halfway through — or scans the QR into an app that never
|
|
20
|
+
* syncs — is not locked out of their own account.
|
|
21
|
+
*
|
|
22
|
+
* Auth operations go through the host-provided admin auth client (the
|
|
23
|
+
* provider-agnostic client-side seam), not a hard Better Auth dependency.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether this instance offers the authenticator app at all. Drives enrolment:
|
|
28
|
+
* with it off, turning 2FA on is a single password confirmation and codes
|
|
29
|
+
* arrive by email instead of from a scanned QR.
|
|
30
|
+
*/
|
|
31
|
+
let { totpAvailable = true }: { totpAvailable?: boolean } = $props();
|
|
32
|
+
|
|
33
|
+
const auth = useAdminAuthClient();
|
|
34
|
+
// A still, empty session when no client is provided, so the panel renders a
|
|
35
|
+
// disabled state instead of subscribing to a store that doesn't exist.
|
|
36
|
+
const session = auth ? auth.useSession() : readable<AdminSessionState>({ data: null });
|
|
37
|
+
|
|
38
|
+
// `undefined` while the session is still loading, so the panel can show a
|
|
39
|
+
// placeholder instead of flashing "not enabled" at someone who has it on.
|
|
40
|
+
const enabled = $derived($session.data?.user?.twoFactorEnabled ?? undefined);
|
|
41
|
+
|
|
42
|
+
type Step = 'idle' | 'password' | 'verify' | 'disable' | 'regenerate';
|
|
43
|
+
|
|
44
|
+
let step: Step = $state('idle');
|
|
45
|
+
let password = $state('');
|
|
46
|
+
let code = $state('');
|
|
47
|
+
let busy = $state(false);
|
|
48
|
+
|
|
49
|
+
// Enrolment material, held only for the length of the flow — the secret is
|
|
50
|
+
// never retrievable again without the password, and the backup codes are
|
|
51
|
+
// shown once.
|
|
52
|
+
let qrDataUrl = $state('');
|
|
53
|
+
let totpSecret = $state('');
|
|
54
|
+
let backupCodes: string[] = $state([]);
|
|
55
|
+
|
|
56
|
+
function reset() {
|
|
57
|
+
step = 'idle';
|
|
58
|
+
password = '';
|
|
59
|
+
code = '';
|
|
60
|
+
qrDataUrl = '';
|
|
61
|
+
totpSecret = '';
|
|
62
|
+
backupCodes = [];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function errorMessage(error: { message?: string } | null | undefined, fallback: string) {
|
|
66
|
+
return error?.message || fallback;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Pull the session again, bypassing the cookie cache.
|
|
71
|
+
*
|
|
72
|
+
* The client already refetches after any `/two-factor/*` call, but that request
|
|
73
|
+
* is served from the signed session cookie, which is cached for ~60s and isn't
|
|
74
|
+
* rewritten when 2FA is enabled or disabled. So the "refreshed" session still
|
|
75
|
+
* says what it said before, and this panel goes on claiming 2FA is on for a
|
|
76
|
+
* minute after it was switched off. Asking for an uncached read is what
|
|
77
|
+
* actually moves `twoFactorEnabled`.
|
|
78
|
+
*/
|
|
79
|
+
async function refreshSession() {
|
|
80
|
+
await $session.refetch?.({ query: { disableCookieCache: true } });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function startEnrolment(e: SubmitEvent) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
if (!auth) return;
|
|
86
|
+
busy = true;
|
|
87
|
+
try {
|
|
88
|
+
const result = await auth.twoFactor.enable({ password });
|
|
89
|
+
|
|
90
|
+
if (result.error || !result.data) {
|
|
91
|
+
toast.error(errorMessage(result.error, 'Could not start setup'));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
backupCodes = result.data.backupCodes;
|
|
96
|
+
password = '';
|
|
97
|
+
|
|
98
|
+
// With TOTP switched off there is no authenticator to scan into and
|
|
99
|
+
// nothing to prove, so the server enables on the spot
|
|
100
|
+
// (`skipVerificationOnEnable`) and the QR step would be a dead end.
|
|
101
|
+
// Codes arrive by email from here on; the backup codes still matter.
|
|
102
|
+
if (!totpAvailable) {
|
|
103
|
+
await refreshSession();
|
|
104
|
+
step = 'idle';
|
|
105
|
+
toast.success('Two-factor authentication is on — codes will be emailed to you');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Imported here rather than at the top so it lands in its own lazy chunk
|
|
110
|
+
// (~23KB) instead of the admin's shared one — this is the only place in
|
|
111
|
+
// the app that ever draws a QR code, and only after a click.
|
|
112
|
+
const QRCode = (await import('qrcode')).default;
|
|
113
|
+
qrDataUrl = await QRCode.toDataURL(result.data.totpURI, { margin: 1, width: 240 });
|
|
114
|
+
// Shown as text for authenticator apps that can't use a camera.
|
|
115
|
+
totpSecret = new URL(result.data.totpURI).searchParams.get('secret') ?? '';
|
|
116
|
+
|
|
117
|
+
step = 'verify';
|
|
118
|
+
} catch (error) {
|
|
119
|
+
toast.error(error instanceof Error ? error.message : 'Could not start setup');
|
|
120
|
+
} finally {
|
|
121
|
+
busy = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function handleConfirm(e: SubmitEvent) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
confirmEnrolment();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function confirmEnrolment() {
|
|
131
|
+
// `onComplete` fires as soon as the sixth digit lands, so guard against
|
|
132
|
+
// re-entry while the previous attempt is still in flight.
|
|
133
|
+
if (busy || !auth || code.trim().length !== 6) return;
|
|
134
|
+
|
|
135
|
+
busy = true;
|
|
136
|
+
try {
|
|
137
|
+
const result = await auth.twoFactor.verifyTotp({ code: code.trim() });
|
|
138
|
+
|
|
139
|
+
if (result.error) {
|
|
140
|
+
toast.error(
|
|
141
|
+
errorMessage(
|
|
142
|
+
result.error,
|
|
143
|
+
'That code is not valid. Codes expire every 30 seconds — try the current one.'
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
code = '';
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
await refreshSession();
|
|
151
|
+
toast.success('Two-factor authentication is on');
|
|
152
|
+
reset();
|
|
153
|
+
} catch (error) {
|
|
154
|
+
toast.error(error instanceof Error ? error.message : 'Could not verify the code');
|
|
155
|
+
} finally {
|
|
156
|
+
busy = false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function disable(e: SubmitEvent) {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
if (!auth) return;
|
|
163
|
+
busy = true;
|
|
164
|
+
try {
|
|
165
|
+
const result = await auth.twoFactor.disable({ password });
|
|
166
|
+
|
|
167
|
+
if (result.error) {
|
|
168
|
+
toast.error(errorMessage(result.error, 'Could not turn off two-factor'));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
await refreshSession();
|
|
173
|
+
toast.success('Two-factor authentication is off');
|
|
174
|
+
reset();
|
|
175
|
+
} catch (error) {
|
|
176
|
+
toast.error(error instanceof Error ? error.message : 'Could not turn off two-factor');
|
|
177
|
+
} finally {
|
|
178
|
+
busy = false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function regenerate(e: SubmitEvent) {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
if (!auth) return;
|
|
185
|
+
busy = true;
|
|
186
|
+
try {
|
|
187
|
+
const result = await auth.twoFactor.generateBackupCodes({ password });
|
|
188
|
+
|
|
189
|
+
if (result.error || !result.data) {
|
|
190
|
+
toast.error(errorMessage(result.error, 'Could not generate new backup codes'));
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
backupCodes = result.data.backupCodes;
|
|
195
|
+
password = '';
|
|
196
|
+
// Back to the resting state, but keep `backupCodes` — the panel above the
|
|
197
|
+
// buttons is the only place the new set is ever shown.
|
|
198
|
+
step = 'idle';
|
|
199
|
+
toast.success('New backup codes generated — the old ones no longer work');
|
|
200
|
+
} catch (error) {
|
|
201
|
+
toast.error(error instanceof Error ? error.message : 'Could not generate new backup codes');
|
|
202
|
+
} finally {
|
|
203
|
+
busy = false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async function copyBackupCodes() {
|
|
208
|
+
try {
|
|
209
|
+
await navigator.clipboard.writeText(backupCodes.join('\n'));
|
|
210
|
+
toast.success('Backup codes copied');
|
|
211
|
+
} catch {
|
|
212
|
+
toast.error('Could not copy — select and copy them manually');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function downloadBackupCodes() {
|
|
217
|
+
const blob = new Blob([`${backupCodes.join('\n')}\n`], { type: 'text/plain' });
|
|
218
|
+
const url = URL.createObjectURL(blob);
|
|
219
|
+
const link = document.createElement('a');
|
|
220
|
+
link.href = url;
|
|
221
|
+
link.download = 'aphex-backup-codes.txt';
|
|
222
|
+
link.click();
|
|
223
|
+
URL.revokeObjectURL(url);
|
|
224
|
+
}
|
|
225
|
+
</script>
|
|
226
|
+
|
|
227
|
+
<Card.Root>
|
|
228
|
+
<Card.Header class="flex flex-row items-start justify-between gap-4">
|
|
229
|
+
<div class="space-y-1.5">
|
|
230
|
+
<Card.Title>Two-Factor Authentication</Card.Title>
|
|
231
|
+
<Card.Description>
|
|
232
|
+
Ask for a code from an authenticator app on top of your password.
|
|
233
|
+
</Card.Description>
|
|
234
|
+
</div>
|
|
235
|
+
{#if enabled !== undefined}
|
|
236
|
+
<Badge variant={enabled ? 'default' : 'outline'} class="shrink-0 px-2.5 py-1 text-xs">
|
|
237
|
+
{enabled ? 'On' : 'Off'}
|
|
238
|
+
</Badge>
|
|
239
|
+
{/if}
|
|
240
|
+
</Card.Header>
|
|
241
|
+
|
|
242
|
+
<Card.Content>
|
|
243
|
+
{#if !auth}
|
|
244
|
+
<p class="text-muted-foreground text-sm">
|
|
245
|
+
Two-factor management isn't available in this deployment.
|
|
246
|
+
</p>
|
|
247
|
+
{:else if enabled === undefined}
|
|
248
|
+
<div class="bg-muted/40 h-10 animate-pulse rounded-md"></div>
|
|
249
|
+
{:else if enabled}
|
|
250
|
+
<div class="space-y-4">
|
|
251
|
+
<div class="flex items-start gap-3">
|
|
252
|
+
<ShieldCheck class="mt-0.5 h-5 w-5 shrink-0 text-green-600 dark:text-green-500" />
|
|
253
|
+
<p class="text-muted-foreground text-sm">
|
|
254
|
+
Signing in on a new device asks for a six-digit code from your authenticator app.
|
|
255
|
+
</p>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
{#if backupCodes.length}
|
|
259
|
+
{@render codesPanel()}
|
|
260
|
+
{/if}
|
|
261
|
+
|
|
262
|
+
{#if step === 'disable' || step === 'regenerate'}
|
|
263
|
+
<form onsubmit={step === 'disable' ? disable : regenerate} class="space-y-3">
|
|
264
|
+
<div class="space-y-2">
|
|
265
|
+
<Label for="tf-password">Confirm your password</Label>
|
|
266
|
+
<PasswordInput
|
|
267
|
+
id="tf-password"
|
|
268
|
+
bind:value={password}
|
|
269
|
+
required
|
|
270
|
+
autocomplete="current-password"
|
|
271
|
+
disabled={busy}
|
|
272
|
+
/>
|
|
273
|
+
<p class="text-muted-foreground text-xs">
|
|
274
|
+
{step === 'disable'
|
|
275
|
+
? 'Turning this off removes your authenticator and all backup codes.'
|
|
276
|
+
: 'Generating new codes immediately invalidates the previous set.'}
|
|
277
|
+
</p>
|
|
278
|
+
</div>
|
|
279
|
+
<div class="flex gap-2">
|
|
280
|
+
<Button
|
|
281
|
+
type="submit"
|
|
282
|
+
variant={step === 'disable' ? 'destructive' : 'default'}
|
|
283
|
+
disabled={busy || !password}
|
|
284
|
+
>
|
|
285
|
+
{#if busy}
|
|
286
|
+
Working…
|
|
287
|
+
{:else if step === 'disable'}
|
|
288
|
+
Turn off two-factor
|
|
289
|
+
{:else}
|
|
290
|
+
Generate new codes
|
|
291
|
+
{/if}
|
|
292
|
+
</Button>
|
|
293
|
+
<Button type="button" variant="ghost" disabled={busy} onclick={reset}>Cancel</Button>
|
|
294
|
+
</div>
|
|
295
|
+
</form>
|
|
296
|
+
{:else}
|
|
297
|
+
<div class="flex flex-wrap gap-2">
|
|
298
|
+
<Button
|
|
299
|
+
type="button"
|
|
300
|
+
variant="outline"
|
|
301
|
+
onclick={() => {
|
|
302
|
+
backupCodes = [];
|
|
303
|
+
step = 'regenerate';
|
|
304
|
+
}}
|
|
305
|
+
>
|
|
306
|
+
Generate new backup codes
|
|
307
|
+
</Button>
|
|
308
|
+
<Button
|
|
309
|
+
type="button"
|
|
310
|
+
variant="ghost"
|
|
311
|
+
class="text-destructive hover:text-destructive"
|
|
312
|
+
onclick={() => {
|
|
313
|
+
backupCodes = [];
|
|
314
|
+
step = 'disable';
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<ShieldOff class="mr-2 h-4 w-4" />
|
|
318
|
+
Turn off
|
|
319
|
+
</Button>
|
|
320
|
+
</div>
|
|
321
|
+
{/if}
|
|
322
|
+
</div>
|
|
323
|
+
{:else if step === 'idle'}
|
|
324
|
+
<div class="space-y-4">
|
|
325
|
+
<p class="text-muted-foreground text-sm">
|
|
326
|
+
You'll scan a QR code with an authenticator app — 1Password, Bitwarden, Google
|
|
327
|
+
Authenticator, or any other — and enter a six-digit code to confirm it works.
|
|
328
|
+
</p>
|
|
329
|
+
<Button type="button" onclick={() => (step = 'password')}>
|
|
330
|
+
<ShieldCheck class="mr-2 h-4 w-4" />
|
|
331
|
+
Set up two-factor
|
|
332
|
+
</Button>
|
|
333
|
+
</div>
|
|
334
|
+
{:else if step === 'password'}
|
|
335
|
+
<form onsubmit={startEnrolment} class="space-y-3">
|
|
336
|
+
<div class="space-y-2">
|
|
337
|
+
<Label for="tf-password">Confirm your password</Label>
|
|
338
|
+
<PasswordInput
|
|
339
|
+
id="tf-password"
|
|
340
|
+
bind:value={password}
|
|
341
|
+
required
|
|
342
|
+
autocomplete="current-password"
|
|
343
|
+
disabled={busy}
|
|
344
|
+
/>
|
|
345
|
+
</div>
|
|
346
|
+
<div class="flex gap-2">
|
|
347
|
+
<Button type="submit" disabled={busy || !password}>
|
|
348
|
+
{busy ? 'Working…' : 'Continue'}
|
|
349
|
+
</Button>
|
|
350
|
+
<Button type="button" variant="ghost" disabled={busy} onclick={reset}>Cancel</Button>
|
|
351
|
+
</div>
|
|
352
|
+
</form>
|
|
353
|
+
{:else if step === 'verify'}
|
|
354
|
+
<div class="space-y-5">
|
|
355
|
+
<div class="flex flex-col gap-4 sm:flex-row sm:items-start">
|
|
356
|
+
{#if qrDataUrl}
|
|
357
|
+
<img
|
|
358
|
+
src={qrDataUrl}
|
|
359
|
+
alt="QR code for your authenticator app"
|
|
360
|
+
class="bg-background h-[180px] w-[180px] shrink-0 rounded-lg border p-2"
|
|
361
|
+
/>
|
|
362
|
+
{/if}
|
|
363
|
+
<div class="min-w-0 flex-1 space-y-2">
|
|
364
|
+
<p class="text-sm font-medium">1. Scan this with your authenticator app</p>
|
|
365
|
+
{#if totpSecret}
|
|
366
|
+
<p class="text-muted-foreground text-xs">Can't scan? Enter this key manually:</p>
|
|
367
|
+
<code class="bg-muted block rounded px-2 py-1.5 font-mono text-xs break-all">
|
|
368
|
+
{totpSecret}
|
|
369
|
+
</code>
|
|
370
|
+
{/if}
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<div class="space-y-2">
|
|
375
|
+
<p class="text-sm font-medium">2. Save your backup codes</p>
|
|
376
|
+
{@render codesPanel()}
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<form onsubmit={handleConfirm} class="space-y-3">
|
|
380
|
+
<div class="space-y-2">
|
|
381
|
+
<Label for="tf-code">3. Enter the six-digit code to finish</Label>
|
|
382
|
+
<InputOTP.Root
|
|
383
|
+
inputId="tf-code"
|
|
384
|
+
maxlength={6}
|
|
385
|
+
value={code}
|
|
386
|
+
onValueChange={(next) => (code = next.replace(/\D/g, ''))}
|
|
387
|
+
onComplete={confirmEnrolment}
|
|
388
|
+
pasteTransformer={(text) => text.replace(/\D/g, '')}
|
|
389
|
+
disabled={busy}
|
|
390
|
+
inputmode="numeric"
|
|
391
|
+
autocomplete="one-time-code"
|
|
392
|
+
>
|
|
393
|
+
{#snippet children({ cells })}
|
|
394
|
+
<InputOTP.Group>
|
|
395
|
+
{#each cells as cell, i (i)}
|
|
396
|
+
<InputOTP.Slot {cell} />
|
|
397
|
+
{/each}
|
|
398
|
+
</InputOTP.Group>
|
|
399
|
+
{/snippet}
|
|
400
|
+
</InputOTP.Root>
|
|
401
|
+
</div>
|
|
402
|
+
<div class="flex gap-2">
|
|
403
|
+
<Button type="submit" disabled={busy || code.trim().length !== 6}>
|
|
404
|
+
{busy ? 'Verifying…' : 'Turn on two-factor'}
|
|
405
|
+
</Button>
|
|
406
|
+
<Button type="button" variant="ghost" disabled={busy} onclick={reset}>Cancel</Button>
|
|
407
|
+
</div>
|
|
408
|
+
</form>
|
|
409
|
+
</div>
|
|
410
|
+
{/if}
|
|
411
|
+
</Card.Content>
|
|
412
|
+
</Card.Root>
|
|
413
|
+
|
|
414
|
+
{#snippet codesPanel()}
|
|
415
|
+
<div class="bg-muted/40 space-y-3 rounded-lg border p-4">
|
|
416
|
+
<p class="text-muted-foreground text-xs">
|
|
417
|
+
Each code works once, and they're shown only now. Keep them somewhere you can reach without
|
|
418
|
+
your phone.
|
|
419
|
+
</p>
|
|
420
|
+
<ul class="grid grid-cols-2 gap-1.5 font-mono text-sm sm:grid-cols-3">
|
|
421
|
+
{#each backupCodes as backupCode (backupCode)}
|
|
422
|
+
<li class="bg-background rounded border px-2 py-1 text-center">{backupCode}</li>
|
|
423
|
+
{/each}
|
|
424
|
+
</ul>
|
|
425
|
+
<div class="flex flex-wrap gap-2">
|
|
426
|
+
<Button type="button" variant="outline" size="sm" onclick={copyBackupCodes}>
|
|
427
|
+
<Copy class="mr-2 h-3.5 w-3.5" />
|
|
428
|
+
Copy
|
|
429
|
+
</Button>
|
|
430
|
+
<Button type="button" variant="outline" size="sm" onclick={downloadBackupCodes}>
|
|
431
|
+
<Download class="mr-2 h-3.5 w-3.5" />
|
|
432
|
+
Download
|
|
433
|
+
</Button>
|
|
434
|
+
</div>
|
|
435
|
+
</div>
|
|
436
|
+
{/snippet}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
totpAvailable?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const TwoFactorSettings: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type TwoFactorSettings = ReturnType<typeof TwoFactorSettings>;
|
|
6
|
+
export default TwoFactorSettings;
|
|
7
|
+
//# sourceMappingURL=TwoFactorSettings.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TwoFactorSettings.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/TwoFactorSettings.svelte.ts"],"names":[],"mappings":"AAgBC,KAAK,gBAAgB,GAAI;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AA0YtD,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -447,8 +447,10 @@
|
|
|
447
447
|
<!-- Image preview with controls -->
|
|
448
448
|
<div class="border-border overflow-hidden rounded-md border {validationClasses}">
|
|
449
449
|
<div class="group relative">
|
|
450
|
-
<!-- Image preview
|
|
451
|
-
|
|
450
|
+
<!-- Image preview: a fixed height rather than an aspect ratio, so a small
|
|
451
|
+
or square image (a logo, an icon) isn't stretched into a huge, mostly
|
|
452
|
+
empty box on a wide panel. -->
|
|
453
|
+
<div class="bg-muted flex items-center justify-center" style="height: 260px;">
|
|
452
454
|
{#if loadingAsset}
|
|
453
455
|
<div class="text-muted-foreground flex flex-col items-center gap-2">
|
|
454
456
|
<div class="border-primary h-8 w-8 animate-spin rounded-full border-b-2"></div>
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
.image-block-view {
|
|
71
71
|
position: relative;
|
|
72
72
|
width: 100%;
|
|
73
|
+
height: 260px;
|
|
73
74
|
display: flex;
|
|
74
75
|
align-items: center;
|
|
75
76
|
justify-content: center;
|
|
@@ -92,8 +93,8 @@
|
|
|
92
93
|
matches nothing. Namespaced enough not to collide. */
|
|
93
94
|
:global(.image-block-img) {
|
|
94
95
|
display: block;
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
width: 100%;
|
|
97
|
+
height: 100%;
|
|
97
98
|
object-fit: contain;
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount, onDestroy } from 'svelte';
|
|
3
|
-
import { Editor } from '@tiptap/core';
|
|
3
|
+
import { Editor, getSchema } from '@tiptap/core';
|
|
4
4
|
import { StarterKit } from '@tiptap/starter-kit';
|
|
5
5
|
import Link from '@tiptap/extension-link';
|
|
6
6
|
import Underline from '@tiptap/extension-underline';
|
|
@@ -76,6 +76,15 @@
|
|
|
76
76
|
let element = $state<HTMLElement>();
|
|
77
77
|
let editor = $state<Editor | null>(null);
|
|
78
78
|
let editorState = $state(0);
|
|
79
|
+
// Stored content this field's current config can't represent. TipTap's answer
|
|
80
|
+
// is to open an empty document with only a console warning, and the first
|
|
81
|
+
// keystroke would then autosave that over the real draft (aphex #334).
|
|
82
|
+
let contentBlocked = $state(false);
|
|
83
|
+
|
|
84
|
+
function reportBlockedContent(cause: unknown) {
|
|
85
|
+
contentBlocked = true;
|
|
86
|
+
console.error(`[RichtextField] "${field.name}" holds content its config can't show`, cause);
|
|
87
|
+
}
|
|
79
88
|
let internalVersion = 0;
|
|
80
89
|
let isSyncingFromParent = false;
|
|
81
90
|
|
|
@@ -534,16 +543,24 @@
|
|
|
534
543
|
lastSyncedVersion = 0;
|
|
535
544
|
editorJustCreated = true;
|
|
536
545
|
expanded = false;
|
|
546
|
+
contentBlocked = false;
|
|
547
|
+
let unreadable = false;
|
|
548
|
+
try {
|
|
549
|
+
getSchema(extensions).nodeFromJSON(tiptapDoc);
|
|
550
|
+
} catch (cause) {
|
|
551
|
+
unreadable = true;
|
|
552
|
+
reportBlockedContent(cause);
|
|
553
|
+
}
|
|
537
554
|
editor = new Editor({
|
|
538
555
|
element,
|
|
539
|
-
editable: !readonly,
|
|
556
|
+
editable: !readonly && !unreadable,
|
|
540
557
|
extensions,
|
|
541
558
|
content: tiptapDoc,
|
|
542
559
|
editorProps: {
|
|
543
560
|
transformPastedHTML: sanitizePastedHTML
|
|
544
561
|
},
|
|
545
562
|
onUpdate: ({ editor: e }) => {
|
|
546
|
-
if (isSyncingFromParent) return;
|
|
563
|
+
if (isSyncingFromParent || contentBlocked) return;
|
|
547
564
|
internalVersion++;
|
|
548
565
|
const json = e.getJSON();
|
|
549
566
|
const pt = tiptapToPortableText(json);
|
|
@@ -692,7 +709,21 @@
|
|
|
692
709
|
// "changed" for some docs (notably lists + links) — which triggers a destructive
|
|
693
710
|
// replaceWith that resets the caret and makes links impossible to click. Round-tripping
|
|
694
711
|
// the incoming doc through `nodeFromJSON().toJSON()` normalizes both sides identically.
|
|
695
|
-
|
|
712
|
+
let incomingDoc;
|
|
713
|
+
try {
|
|
714
|
+
incomingDoc = editor.state.schema.nodeFromJSON(tiptapDoc);
|
|
715
|
+
} catch (cause) {
|
|
716
|
+
if (!contentBlocked) {
|
|
717
|
+
editor.setEditable(false, false);
|
|
718
|
+
reportBlockedContent(cause);
|
|
719
|
+
}
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
// A readable value arrived (a restored version, say), so editing is safe again.
|
|
723
|
+
if (contentBlocked) {
|
|
724
|
+
contentBlocked = false;
|
|
725
|
+
editor.setEditable(!readonly, false);
|
|
726
|
+
}
|
|
696
727
|
if (
|
|
697
728
|
JSON.stringify(stripVolatileMarks(incomingDoc.toJSON())) ===
|
|
698
729
|
JSON.stringify(stripVolatileMarks(editor.getJSON()))
|
|
@@ -959,7 +990,7 @@
|
|
|
959
990
|
? `position: fixed; top: ${containerBounds.top}px; left: ${containerBounds.left}px; width: ${containerBounds.width}px; height: ${containerBounds.height}px; z-index: 50;`
|
|
960
991
|
: ''}
|
|
961
992
|
>
|
|
962
|
-
{#if editor && !readonly}
|
|
993
|
+
{#if editor && !readonly && !contentBlocked}
|
|
963
994
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
964
995
|
<Tooltip.Provider>
|
|
965
996
|
<!--
|
|
@@ -1199,7 +1230,18 @@
|
|
|
1199
1230
|
</Tooltip.Provider>
|
|
1200
1231
|
{/if}
|
|
1201
1232
|
|
|
1202
|
-
|
|
1233
|
+
{#if contentBlocked}
|
|
1234
|
+
<div role="alert" class="text-destructive p-3 text-sm">
|
|
1235
|
+
This text can't be shown because this field's settings changed after it was written. Your
|
|
1236
|
+
saved text is safe, and editing is locked here so it can't be overwritten. Please ask your web
|
|
1237
|
+
team to look at it.
|
|
1238
|
+
</div>
|
|
1239
|
+
{/if}
|
|
1240
|
+
<div
|
|
1241
|
+
bind:this={element}
|
|
1242
|
+
class="richtext-content"
|
|
1243
|
+
style:display={contentBlocked ? 'none' : undefined}
|
|
1244
|
+
></div>
|
|
1203
1245
|
|
|
1204
1246
|
{#if linkMode === 'preview'}
|
|
1205
1247
|
<div
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichtextField.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/admin/fields/richtext/RichtextField.svelte.ts"],"names":[],"mappings":"AA4BA,OAAO,EAGL,KAAK,iBAAiB,EACtB,MAAM,4BAA4B,CAAC;AASrC,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAc,MAAM,2BAA2B,CAAC;AAYzF,UAAU,KAAK;IACd,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC;
|
|
1
|
+
{"version":3,"file":"RichtextField.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/admin/fields/richtext/RichtextField.svelte.ts"],"names":[],"mappings":"AA4BA,OAAO,EAGL,KAAK,iBAAiB,EACtB,MAAM,4BAA4B,CAAC;AASrC,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAc,MAAM,2BAA2B,CAAC;AAYzF,UAAU,KAAK;IACd,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC;AA2rCF,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
<Settings class="mr-2 h-4 w-4" />
|
|
88
88
|
<span>Account Settings</span>
|
|
89
89
|
</DropdownMenuItem>
|
|
90
|
-
<DropdownMenuItem class="cursor-pointer" onclick={() => goto('/invitations')}>
|
|
90
|
+
<DropdownMenuItem class="cursor-pointer" onclick={() => goto('/admin/invitations')}>
|
|
91
91
|
<Mail class="mr-2 h-4 w-4" />
|
|
92
92
|
<span>Invitations</span>
|
|
93
93
|
</DropdownMenuItem>
|
|
94
94
|
{#if user.role === 'super_admin'}
|
|
95
|
-
<DropdownMenuItem class="cursor-pointer" onclick={() => goto('/god-mode')}>
|
|
95
|
+
<DropdownMenuItem class="cursor-pointer" onclick={() => goto('/admin/god-mode')}>
|
|
96
96
|
<Shield class="mr-2 h-4 w-4" />
|
|
97
97
|
<span>God Mode</span>
|
|
98
98
|
</DropdownMenuItem>
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { CMSConfig } from './types/index.js';
|
|
1
|
+
import type { CMSConfig, CMSConfigInput } from './types/index.js';
|
|
2
2
|
export declare function createCMSConfig(config: CMSConfig): CMSConfig;
|
|
3
|
+
export declare function createCMSConfig(config: CMSConfigInput): CMSConfigInput;
|
|
3
4
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/lib/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/lib/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/D,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;AAC9D,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC"}
|
package/dist/email/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/email/index.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/email/index.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AAGnC,cAAc,cAAc,CAAC"}
|
package/dist/email/index.js
CHANGED
|
@@ -26,6 +26,8 @@ export interface SendEmailResult {
|
|
|
26
26
|
}
|
|
27
27
|
export interface EmailAdapter {
|
|
28
28
|
readonly name: string;
|
|
29
|
+
/** The sender used when a template doesn't name one, such as `My App <hi@example.com>`. */
|
|
30
|
+
readonly defaultFrom?: string;
|
|
29
31
|
send(options: SendEmailOptions): Promise<SendEmailResult>;
|
|
30
32
|
sendBatch?(emails: SendEmailOptions[]): Promise<SendEmailResult[]>;
|
|
31
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/lib/email/interfaces/email.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,KAAK,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE1D,SAAS,CAAC,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,YAAY,CAAC;CACjD;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACnB,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/lib/email/interfaces/email.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,KAAK,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE1D,SAAS,CAAC,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,YAAY,CAAC;CACjD;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LinkEmailContent {
|
|
2
|
+
subject: string;
|
|
3
|
+
/** Optional opening line, such as `Hi Sam,`. */
|
|
4
|
+
greeting?: string;
|
|
5
|
+
intro: string;
|
|
6
|
+
action: string;
|
|
7
|
+
url: string;
|
|
8
|
+
note: string;
|
|
9
|
+
}
|
|
10
|
+
/** A plain, dependency-free email carrying one link. Apps that care supply their own. */
|
|
11
|
+
export declare function renderLinkEmail({ subject, greeting, intro, action, url, note }: LinkEmailContent): {
|
|
12
|
+
html: string;
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=link-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-email.d.ts","sourceRoot":"","sources":["../../src/lib/email/link-email.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACb;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,EAC/B,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAI,EACJ,EAAE,gBAAgB,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb,CAmBA"}
|